mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
Blackfin SPI Driver: Fix erroneous SPI Clock divisor calculation
Fix erroneous SPI Clock divisor calculation. Make sure SPI_BAUD is always >= 2. Writing a value of 0 or 1 to the SPI_BAUD register disables the serial clock. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
8cf5858c51
commit
7513e006c6
2 changed files with 5 additions and 0 deletions
|
@ -11,6 +11,8 @@
|
|||
#ifndef _SPI_CHANNEL_H_
|
||||
#define _SPI_CHANNEL_H_
|
||||
|
||||
#define MIN_SPI_BAUD_VAL 2
|
||||
|
||||
#define SPI_READ 0
|
||||
#define SPI_WRITE 1
|
||||
|
||||
|
|
|
@ -158,6 +158,9 @@ static u16 hz_to_spi_baud(u32 speed_hz)
|
|||
if ((sclk % (2 * speed_hz)) > 0)
|
||||
spi_baud++;
|
||||
|
||||
if (spi_baud < MIN_SPI_BAUD_VAL)
|
||||
spi_baud = MIN_SPI_BAUD_VAL;
|
||||
|
||||
return spi_baud;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue