Commit 1490b86f authored by Imre Deak's avatar Imre Deak Committed by Juha Yrjola

ARM: OMAP: Fix uWire SPI driver CS deselect.

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: default avatarImre Deak <imre.deak@nokia.com>
Signed-off-by: default avatarJuha Yrjola <juha.yrjola@nokia.com>
parent b0a965da
...@@ -156,10 +156,18 @@ static int wait_uwire_csr_flag(u16 mask, u16 val, int might_not_catch) ...@@ -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) static void uwire_chipselect(struct spi_device *spi, int value)
{ {
u16 w; u16 w;
int old_cs;
BUG_ON(wait_uwire_csr_flag(CSRB, 0, 0)); 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) { if (value == BITBANG_CS_ACTIVE) {
/* invert clock? */ /* invert clock? */
if (spi->mode & SPI_CPOL) if (spi->mode & SPI_CPOL)
...@@ -169,9 +177,8 @@ static void uwire_chipselect(struct spi_device *spi, int value) ...@@ -169,9 +177,8 @@ static void uwire_chipselect(struct spi_device *spi, int value)
w = spi->chip_select << 10; w = spi->chip_select << 10;
w |= CS_CMD; 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) static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment