]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: Fix uWire SPI driver CS deselect.
authorImre Deak <imre.deak@nokia.com>
Wed, 15 Feb 2006 16:02:02 +0000 (18:02 +0200)
committerJuha Yrjola <juha.yrjola@nokia.com>
Tue, 21 Feb 2006 12:00:25 +0000 (14:00 +0200)
CS deselection didn't work as expected. Writing 0 to CSR isn't enough,
the given CS value with CS_CMD cleared has to be written.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@nokia.com>
drivers/spi/omap_uwire.c

index 0b52a73b1534ac439ec1a291cfa88d095d623df3..8d2e4949eb4bb2c90cf33159575b2f64c1131ee1 100644 (file)
@@ -156,10 +156,18 @@ static int wait_uwire_csr_flag(u16 mask, u16 val, int might_not_catch)
 static void uwire_chipselect(struct spi_device *spi, int value)
 {
        u16     w;
+       int     old_cs;
 
        BUG_ON(wait_uwire_csr_flag(CSRB, 0, 0));
 
-       /* activate/deactivate specfied chipselect */
+       w = uwire_read_reg(UWIRE_CSR);
+       old_cs = (w >> 10) & 0x03;
+       if (value == BITBANG_CS_INACTIVE || old_cs != spi->chip_select) {
+               /* Deselect this CS, or the previous CS */
+               w &= ~CS_CMD;
+               uwire_write_reg(UWIRE_CSR, w);
+       }
+       /* activate specfied chipselect */
        if (value == BITBANG_CS_ACTIVE) {
                /* invert clock? */
                if (spi->mode & SPI_CPOL)
@@ -169,9 +177,8 @@ static void uwire_chipselect(struct spi_device *spi, int value)
 
                w = spi->chip_select << 10;
                w |= CS_CMD;
-       } else
-               w = 0;
-       uwire_write_reg(UWIRE_CSR, w);
+               uwire_write_reg(UWIRE_CSR, w);
+       }
 }
 
 static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)