From 7513e006c64fbe2f43aef2139c8c1f2b1a9cb6b9 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Mon, 6 Apr 2009 19:00:32 -0700 Subject: 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 Signed-off-by: Bryan Wu Acked-by: David Brownell Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/spi/spi_bfin5xx.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/spi') diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index e440718b320..a3e06283f74 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; } -- cgit v1.2.3-70-g09d2