From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Thu, 2 Oct 2014 13:31:09 +0000 (+0300)
Subject: spi: dw-mid: follow new DMAengine workflow
X-Git-Tag: firefly_0821_release~176^2~3136^2~3^4
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f7477c2be8689ee8355db345f107744c9bd7f112;p=firefly-linux-kernel-4.4.55.git

spi: dw-mid: follow new DMAengine workflow

Though intel-mid-dma does not follow a new DMA workflow (*) let's prepare SPI
DW driver for that.

(*) The client is obliged to call dma_async_issue_pending() which starts the
actual transfers. Old DMA drivers do not follow this, since requirement was
introduced in the discussion of [1].

[1] http://www.spinics.net/lists/arm-kernel/msg125987.html

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---

diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index a507add6231e..46c6d58e1fda 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -150,7 +150,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 				&dws->tx_sgl,
 				1,
 				DMA_MEM_TO_DEV,
-				DMA_PREP_INTERRUPT);
+				DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	txdesc->callback = dw_spi_dma_done;
 	txdesc->callback_param = dws;
 
@@ -172,13 +172,17 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 				&dws->rx_sgl,
 				1,
 				DMA_DEV_TO_MEM,
-				DMA_PREP_INTERRUPT);
+				DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	rxdesc->callback = dw_spi_dma_done;
 	rxdesc->callback_param = dws;
 
 	/* rx must be started before tx due to spi instinct */
 	dmaengine_submit(rxdesc);
+	dma_async_issue_pending(dws->rxchan);
+
 	dmaengine_submit(txdesc);
+	dma_async_issue_pending(dws->txchan);
+
 	return 0;
 }