]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/spi/spi-bitbang-txrx.h
Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
[karo-tx-linux.git] / drivers / spi / spi-bitbang-txrx.h
index 06b34e5bcfa37eaf9eba3e9ff8d1d017454dc81d..47bb9b898dfdc6ab18ae5fd10349f23882200e4f 100644 (file)
@@ -49,7 +49,7 @@ bitbang_txrx_be_cpha0(struct spi_device *spi,
 {
        /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
 
-       bool oldbit = !(word & 1);
+       u32 oldbit = (!(word & (1<<(bits-1)))) << 31;
        /* clock starts at inactive polarity */
        for (word <<= (32 - bits); likely(bits); bits--) {
 
@@ -81,7 +81,7 @@ bitbang_txrx_be_cpha1(struct spi_device *spi,
 {
        /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */
 
-       bool oldbit = !(word & (1 << 31));
+       u32 oldbit = (!(word & (1<<(bits-1)))) << 31;
        /* clock starts at inactive polarity */
        for (word <<= (32 - bits); likely(bits); bits--) {