linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] spi/pl022: use dmaengine helper macros
@ 2011-02-08 12:03 Linus Walleij
       [not found] ` <1297166592-5098-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2011-02-08 12:03 UTC (permalink / raw)
  To: Grant Likely, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Linus Walleij, Linus Walleij, Russell King, Dan Williams,
	Lee Jones, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

This simplifies the DMA code a bit by using the dmaengine helpers.
The cookie from descriptor submission can be ignored in this case
as has been established in review of the MMCI/PL180 driver.

Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Russell King <rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Signed-off-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/spi/amba-pl022.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index 71a1219..4220aad 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -917,7 +917,6 @@ static int configure_dma(struct pl022 *pl022)
 	struct dma_chan *txchan = pl022->dma_tx_channel;
 	struct dma_async_tx_descriptor *rxdesc;
 	struct dma_async_tx_descriptor *txdesc;
-	dma_cookie_t cookie;
 
 	/* Check that the channels are available */
 	if (!rxchan || !txchan)
@@ -962,10 +961,8 @@ static int configure_dma(struct pl022 *pl022)
 		tx_conf.dst_addr_width = rx_conf.src_addr_width;
 	BUG_ON(rx_conf.src_addr_width != tx_conf.dst_addr_width);
 
-	rxchan->device->device_control(rxchan, DMA_SLAVE_CONFIG,
-				       (unsigned long) &rx_conf);
-	txchan->device->device_control(txchan, DMA_SLAVE_CONFIG,
-				       (unsigned long) &tx_conf);
+	dmaengine_slave_config(rxchan, &rx_conf);
+	dmaengine_slave_config(txchan, &tx_conf);
 
 	/* Create sglists for the transfers */
 	pages = (pl022->cur_transfer->len >> PAGE_SHIFT) + 1;
@@ -1018,23 +1015,19 @@ static int configure_dma(struct pl022 *pl022)
 	rxdesc->callback_param = pl022;
 
 	/* Submit and fire RX and TX with TX last so we're ready to read! */
-	cookie = rxdesc->tx_submit(rxdesc);
-	if (dma_submit_error(cookie))
-		goto err_submit_rx;
-	cookie = txdesc->tx_submit(txdesc);
-	if (dma_submit_error(cookie))
-		goto err_submit_tx;
-	rxchan->device->device_issue_pending(rxchan);
-	txchan->device->device_issue_pending(txchan);
+	dmaengine_submit(rxdesc);
+	dmaengine_submit(txdesc);
+	dma_async_issue_pending(rxchan);
+	dma_async_issue_pending(txchan);
 
 	return 0;
 
 err_submit_tx:
 err_submit_rx:
 err_txdesc:
-	txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0);
+	dmaengine_terminate_all(txchan);
 err_rxdesc:
-	rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0);
+	dmaengine_terminate_all(rxchan);
 	dma_unmap_sg(txchan->device->dev, pl022->sgt_tx.sgl,
 		     pl022->sgt_tx.nents, DMA_TO_DEVICE);
 err_tx_sgmap:
@@ -1101,8 +1094,8 @@ static void terminate_dma(struct pl022 *pl022)
 	struct dma_chan *rxchan = pl022->dma_rx_channel;
 	struct dma_chan *txchan = pl022->dma_tx_channel;
 
-	rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0);
-	txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0);
+	dmaengine_terminate_all(rxchan);
+	dmaengine_terminate_all(txchan);
 	unmap_free_dma_scatter(pl022);
 }
 
-- 
1.7.3.2


------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/4] spi/pl022: use dmaengine helper macros
       [not found] ` <1297166592-5098-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
@ 2011-02-15 22:09   ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2011-02-15 22:09 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Linus Walleij, Russell King,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Dan Williams,
	Lee Jones, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Feb 08, 2011 at 01:03:12PM +0100, Linus Walleij wrote:
> This simplifies the DMA code a bit by using the dmaengine helpers.
> The cookie from descriptor submission can be ignored in this case
> as has been established in review of the MMCI/PL180 driver.
> 
> Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Russell King <rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
> Signed-off-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Applied, thanks.

g.

> ---
>  drivers/spi/amba-pl022.c |   27 ++++++++++-----------------
>  1 files changed, 10 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
> index 71a1219..4220aad 100644
> --- a/drivers/spi/amba-pl022.c
> +++ b/drivers/spi/amba-pl022.c
> @@ -917,7 +917,6 @@ static int configure_dma(struct pl022 *pl022)
>  	struct dma_chan *txchan = pl022->dma_tx_channel;
>  	struct dma_async_tx_descriptor *rxdesc;
>  	struct dma_async_tx_descriptor *txdesc;
> -	dma_cookie_t cookie;
>  
>  	/* Check that the channels are available */
>  	if (!rxchan || !txchan)
> @@ -962,10 +961,8 @@ static int configure_dma(struct pl022 *pl022)
>  		tx_conf.dst_addr_width = rx_conf.src_addr_width;
>  	BUG_ON(rx_conf.src_addr_width != tx_conf.dst_addr_width);
>  
> -	rxchan->device->device_control(rxchan, DMA_SLAVE_CONFIG,
> -				       (unsigned long) &rx_conf);
> -	txchan->device->device_control(txchan, DMA_SLAVE_CONFIG,
> -				       (unsigned long) &tx_conf);
> +	dmaengine_slave_config(rxchan, &rx_conf);
> +	dmaengine_slave_config(txchan, &tx_conf);
>  
>  	/* Create sglists for the transfers */
>  	pages = (pl022->cur_transfer->len >> PAGE_SHIFT) + 1;
> @@ -1018,23 +1015,19 @@ static int configure_dma(struct pl022 *pl022)
>  	rxdesc->callback_param = pl022;
>  
>  	/* Submit and fire RX and TX with TX last so we're ready to read! */
> -	cookie = rxdesc->tx_submit(rxdesc);
> -	if (dma_submit_error(cookie))
> -		goto err_submit_rx;
> -	cookie = txdesc->tx_submit(txdesc);
> -	if (dma_submit_error(cookie))
> -		goto err_submit_tx;
> -	rxchan->device->device_issue_pending(rxchan);
> -	txchan->device->device_issue_pending(txchan);
> +	dmaengine_submit(rxdesc);
> +	dmaengine_submit(txdesc);
> +	dma_async_issue_pending(rxchan);
> +	dma_async_issue_pending(txchan);
>  
>  	return 0;
>  
>  err_submit_tx:
>  err_submit_rx:
>  err_txdesc:
> -	txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0);
> +	dmaengine_terminate_all(txchan);
>  err_rxdesc:
> -	rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0);
> +	dmaengine_terminate_all(rxchan);
>  	dma_unmap_sg(txchan->device->dev, pl022->sgt_tx.sgl,
>  		     pl022->sgt_tx.nents, DMA_TO_DEVICE);
>  err_tx_sgmap:
> @@ -1101,8 +1094,8 @@ static void terminate_dma(struct pl022 *pl022)
>  	struct dma_chan *rxchan = pl022->dma_rx_channel;
>  	struct dma_chan *txchan = pl022->dma_tx_channel;
>  
> -	rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0);
> -	txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0);
> +	dmaengine_terminate_all(rxchan);
> +	dmaengine_terminate_all(txchan);
>  	unmap_free_dma_scatter(pl022);
>  }
>  
> -- 
> 1.7.3.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-15 22:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-08 12:03 [PATCH 1/4] spi/pl022: use dmaengine helper macros Linus Walleij
     [not found] ` <1297166592-5098-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2011-02-15 22:09   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).