In case of DMA we never got things done until we enable both channels. In case
of receive only or send only mode the user has to provide a dummy buffer.

Signed-off-by: Andy Shevchenko <[email protected]>
---
 drivers/spi/spi-dw-mid.c | 6 ++----
 drivers/spi/spi-dw.h     | 4 ++++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index f7f0ad2..97156e4 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -119,10 +119,8 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int 
cs_change)
                spi_enable_chip(dws, 0);
                dw_writew(dws, DW_SPI_DMARDLR, 0xf);
                dw_writew(dws, DW_SPI_DMATDLR, 0x10);
-               if (dws->tx_dma)
-                       dma_ctrl |= 0x2;
-               if (dws->rx_dma)
-                       dma_ctrl |= 0x1;
+               dma_ctrl |= SPI_DMA_TDMAE;
+               dma_ctrl |= SPI_DMA_RDMAE;
                dw_writew(dws, DW_SPI_DMACR, dma_ctrl);
                spi_enable_chip(dws, 1);
        }
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
index 089fc4b..83a103a 100644
--- a/drivers/spi/spi-dw.h
+++ b/drivers/spi/spi-dw.h
@@ -74,6 +74,10 @@
 #define SPI_INT_RXFI                   (1 << 4)
 #define SPI_INT_MSTI                   (1 << 5)
 
+/* Bit fields in DMACR */
+#define SPI_DMA_RDMAE                  (1 << 0)
+#define SPI_DMA_TDMAE                  (1 << 1)
+
 /* TX RX interrupt level threshold, max can be 256 */
 #define SPI_INT_THRESHOLD              32
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to