From 1490b86f74a637c5e8586d95f97937f434795089 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Wed, 15 Feb 2006 18:02:02 +0200 Subject: [PATCH] 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: Imre Deak Signed-off-by: Juha Yrjola --- drivers/spi/omap_uwire.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c index 0b52a73b153..8d2e4949eb4 100644 --- a/drivers/spi/omap_uwire.c +++ b/drivers/spi/omap_uwire.c @@ -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) -- 2.41.1