[04/10] spi: dw-mid: follow new DMAengine workflow
diff mbox

Message ID 1411060140-2801-5-git-send-email-andriy.shevchenko@linux.intel.com
State New, archived
Headers show

Commit Message

Andy Shevchenko Sept. 18, 2014, 5:08 p.m. UTC
Though intel-mid-dma does not follow a new DMA workflow let's prepare SPI DW
driver for that.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-dw-mid.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Mark Brown Sept. 24, 2014, 8:44 a.m. UTC | #1
On Thu, Sep 18, 2014 at 08:08:54PM +0300, Andy Shevchenko wrote:
> Though intel-mid-dma does not follow a new DMA workflow let's prepare SPI DW
> driver for that.

I don't understand what this change is supposed to do - what is "a new
DMA workflow"?
Andy Shevchenko Sept. 24, 2014, 10:35 a.m. UTC | #2
On Wed, 2014-09-24 at 09:44 +0100, Mark Brown wrote:
> On Thu, Sep 18, 2014 at 08:08:54PM +0300, Andy Shevchenko wrote:
> > Though intel-mid-dma does not follow a new DMA workflow let's prepare SPI DW
> > driver for that.
> 
> I don't understand what this change is supposed to do - what is "a new
> DMA workflow"?


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 2011 IIRC.

Current DMA driver for spi-dw doesn't follow this, but dw_dmac does.
Mark Brown Sept. 24, 2014, 11:08 a.m. UTC | #3
On Wed, Sep 24, 2014 at 01:35:38PM +0300, Andy Shevchenko wrote:
> On Wed, 2014-09-24 at 09:44 +0100, Mark Brown wrote:
> > On Thu, Sep 18, 2014 at 08:08:54PM +0300, Andy Shevchenko wrote:
> > > Though intel-mid-dma does not follow a new DMA workflow let's prepare SPI DW
> > > driver for that.

> > I don't understand what this change is supposed to do - what is "a new
> > DMA workflow"?

> 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 2011 IIRC.

> Current DMA driver for spi-dw doesn't follow this, but dw_dmac does.

So be specific about it missing the call so someone reading the
changelog can understand what this is supposed to do.
Andy Shevchenko Sept. 24, 2014, 11:59 a.m. UTC | #4
On Wed, 2014-09-24 at 12:08 +0100, Mark Brown wrote:
> On Wed, Sep 24, 2014 at 01:35:38PM +0300, Andy Shevchenko wrote:
> > On Wed, 2014-09-24 at 09:44 +0100, Mark Brown wrote:
> > > On Thu, Sep 18, 2014 at 08:08:54PM +0300, Andy Shevchenko wrote:
> > > > Though intel-mid-dma does not follow a new DMA workflow let's prepare SPI DW
> > > > driver for that.
> 
> > > I don't understand what this change is supposed to do - what is "a new
> > > DMA workflow"?
> 
> > 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 2011 IIRC.
> 
> > Current DMA driver for spi-dw doesn't follow this, but dw_dmac does.
> 
> So be specific about it missing the call so someone reading the
> changelog can understand what this is supposed to do.

Will do.

Patch
diff mbox

diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index 27150c7..a62413d 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -152,7 +152,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;
 
@@ -175,13 +175,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 */
 	rxdesc->tx_submit(rxdesc);
 	txdesc->tx_submit(txdesc);
+
+	dma_async_issue_pending(rxchan);
+	dma_async_issue_pending(txchan);
+
 	return 0;
 }