summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2009-04-07 04:00:32 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 17:31:04 +0200
commit7513e006c64fbe2f43aef2139c8c1f2b1a9cb6b9 (patch)
tree44817ca1febd0599ea8bff50825fc58568f4e7c3 /drivers/spi
parentBlackfin SPI Driver: ensure cache coherency before doing DMA (diff)
downloadlinux-7513e006c64fbe2f43aef2139c8c1f2b1a9cb6b9.tar.xz
linux-7513e006c64fbe2f43aef2139c8c1f2b1a9cb6b9.zip
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_bfin5xx.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index e440718b3209..a3e06283f74d 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -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;
}