]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Blackfin SPI Driver: Fix erroneous SPI Clock divisor calculation
authorMichael Hennerich <michael.hennerich@analog.com>
Tue, 7 Apr 2009 02:00:32 +0000 (19:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2009 15:31:04 +0000 (08:31 -0700)
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>
arch/blackfin/include/asm/bfin5xx_spi.h
drivers/spi/spi_bfin5xx.c

index 0292d58f9362e84e3b337c575a54b0b1ff6d9cad..ea2d24af9542dfc5db9cbdfc0ee5e31db12d59c5 100644 (file)
@@ -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
 
index e440718b3209a023078528b7e0f3ca018854d8f9..a3e06283f74d4398b12fdd01f513c4de7f507509 100644 (file)
@@ -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;
 }