* [PATCH 1/4] spi/pl022: map the buffers on the DMA engine
@ 2010-12-22 22:13 Linus Walleij
[not found] ` <1293055987-12656-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2010-12-22 22:13 UTC (permalink / raw)
To: Grant Likely, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: Linus Walleij
The struct device for the DMA engine is the apropriate one to use
when mapping/unmapping buffers. This is because the memory which
is addressable by DMA is determined by the DMA engine rather than
the device.
Reported-by: Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
---
drivers/spi/amba-pl022.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index fb3d1b3..9a14c45 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -782,9 +782,9 @@ static void *next_transfer(struct pl022 *pl022)
static void unmap_free_dma_scatter(struct pl022 *pl022)
{
/* Unmap and free the SG tables */
- dma_unmap_sg(&pl022->adev->dev, pl022->sgt_tx.sgl,
+ dma_unmap_sg(pl022->dma_tx_channel->device->dev, pl022->sgt_tx.sgl,
pl022->sgt_tx.nents, DMA_TO_DEVICE);
- dma_unmap_sg(&pl022->adev->dev, pl022->sgt_rx.sgl,
+ dma_unmap_sg(pl022->dma_rx_channel->device->dev, pl022->sgt_rx.sgl,
pl022->sgt_rx.nents, DMA_FROM_DEVICE);
sg_free_table(&pl022->sgt_rx);
sg_free_table(&pl022->sgt_tx);
@@ -991,12 +991,12 @@ static int configure_dma(struct pl022 *pl022)
pl022->cur_transfer->len, &pl022->sgt_tx);
/* Map DMA buffers */
- sglen = dma_map_sg(&pl022->adev->dev, pl022->sgt_rx.sgl,
+ sglen = dma_map_sg(rxchan->device->dev, pl022->sgt_rx.sgl,
pl022->sgt_rx.nents, DMA_FROM_DEVICE);
if (!sglen)
goto err_rx_sgmap;
- sglen = dma_map_sg(&pl022->adev->dev, pl022->sgt_tx.sgl,
+ sglen = dma_map_sg(txchan->device->dev, pl022->sgt_tx.sgl,
pl022->sgt_tx.nents, DMA_TO_DEVICE);
if (!sglen)
goto err_tx_sgmap;
@@ -1040,10 +1040,10 @@ err_txdesc:
txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0);
err_rxdesc:
rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0);
- dma_unmap_sg(&pl022->adev->dev, pl022->sgt_tx.sgl,
+ dma_unmap_sg(txchan->device->dev, pl022->sgt_tx.sgl,
pl022->sgt_tx.nents, DMA_TO_DEVICE);
err_tx_sgmap:
- dma_unmap_sg(&pl022->adev->dev, pl022->sgt_rx.sgl,
+ dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl,
pl022->sgt_tx.nents, DMA_FROM_DEVICE);
err_rx_sgmap:
sg_free_table(&pl022->sgt_tx);
--
1.7.3.3
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/4] spi/pl022: map the buffers on the DMA engine
[not found] ` <1293055987-12656-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
@ 2010-12-24 4:07 ` Grant Likely
0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2010-12-24 4:07 UTC (permalink / raw)
To: Linus Walleij; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Wed, Dec 22, 2010 at 11:13:07PM +0100, Linus Walleij wrote:
> The struct device for the DMA engine is the apropriate one to use
> when mapping/unmapping buffers. This is because the memory which
> is addressable by DMA is determined by the DMA engine rather than
> the device.
>
> Reported-by: Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
> Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
merged for -next, thanks.
g.
> ---
> drivers/spi/amba-pl022.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
> index fb3d1b3..9a14c45 100644
> --- a/drivers/spi/amba-pl022.c
> +++ b/drivers/spi/amba-pl022.c
> @@ -782,9 +782,9 @@ static void *next_transfer(struct pl022 *pl022)
> static void unmap_free_dma_scatter(struct pl022 *pl022)
> {
> /* Unmap and free the SG tables */
> - dma_unmap_sg(&pl022->adev->dev, pl022->sgt_tx.sgl,
> + dma_unmap_sg(pl022->dma_tx_channel->device->dev, pl022->sgt_tx.sgl,
> pl022->sgt_tx.nents, DMA_TO_DEVICE);
> - dma_unmap_sg(&pl022->adev->dev, pl022->sgt_rx.sgl,
> + dma_unmap_sg(pl022->dma_rx_channel->device->dev, pl022->sgt_rx.sgl,
> pl022->sgt_rx.nents, DMA_FROM_DEVICE);
> sg_free_table(&pl022->sgt_rx);
> sg_free_table(&pl022->sgt_tx);
> @@ -991,12 +991,12 @@ static int configure_dma(struct pl022 *pl022)
> pl022->cur_transfer->len, &pl022->sgt_tx);
>
> /* Map DMA buffers */
> - sglen = dma_map_sg(&pl022->adev->dev, pl022->sgt_rx.sgl,
> + sglen = dma_map_sg(rxchan->device->dev, pl022->sgt_rx.sgl,
> pl022->sgt_rx.nents, DMA_FROM_DEVICE);
> if (!sglen)
> goto err_rx_sgmap;
>
> - sglen = dma_map_sg(&pl022->adev->dev, pl022->sgt_tx.sgl,
> + sglen = dma_map_sg(txchan->device->dev, pl022->sgt_tx.sgl,
> pl022->sgt_tx.nents, DMA_TO_DEVICE);
> if (!sglen)
> goto err_tx_sgmap;
> @@ -1040,10 +1040,10 @@ err_txdesc:
> txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0);
> err_rxdesc:
> rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0);
> - dma_unmap_sg(&pl022->adev->dev, pl022->sgt_tx.sgl,
> + dma_unmap_sg(txchan->device->dev, pl022->sgt_tx.sgl,
> pl022->sgt_tx.nents, DMA_TO_DEVICE);
> err_tx_sgmap:
> - dma_unmap_sg(&pl022->adev->dev, pl022->sgt_rx.sgl,
> + dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl,
> pl022->sgt_tx.nents, DMA_FROM_DEVICE);
> err_rx_sgmap:
> sg_free_table(&pl022->sgt_tx);
> --
> 1.7.3.3
>
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-24 4:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-22 22:13 [PATCH 1/4] spi/pl022: map the buffers on the DMA engine Linus Walleij
[not found] ` <1293055987-12656-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2010-12-24 4:07 ` 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).