diff mbox

[08/11] tmio_mmc: map DMA buffers on the DMA engine device

Message ID AANLkTi=n8eVrZ2Xj6hKg3oOfVn5NkCxR=mgz=O4__r+Y@mail.gmail.com
State Accepted, archived
Headers show

Commit Message

Linus Walleij March 4, 2011, 10:26 a.m. UTC
---------- Forwarded message ----------
From: Linus Walleij <linus.walleij@linaro.org>
Date: Thu, Feb 10, 2011 at 4:10 PM
Subject: [PATCH 08/11] tmio_mmc: map DMA buffers on the DMA engine device
To: linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Cc: Dan Williams <dan.j.williams@intel.com>, Ian Molton
<ian@mnementh.co.uk>, Linus Walleij <linus.walleij@linaro.org>


As established for the MMCI, it is proper to map the DMA buffers
on the DMA engine which is the one actually performing the DMA.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mmc/host/tmio_mmc.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

               desc = chan->device->device_prep_slave_sg(chan, sg, ret,
@@ -906,7 +906,7 @@ static void tmio_mmc_start_dma_tx(struct
tmio_mmc_host *host)
               sg = host->sg_ptr;
       }

-       ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len, DMA_TO_DEVICE);
+       ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE);
       if (ret > 0) {
               host->dma_sglen = ret;
               desc = chan->device->device_prep_slave_sg(chan, sg, ret,
@@ -978,10 +978,12 @@ static void tmio_tasklet_fn(unsigned long arg)
               goto out;

       if (host->data->flags & MMC_DATA_READ)
-               dma_unmap_sg(&host->pdev->dev, host->sg_ptr, host->dma_sglen,
+               dma_unmap_sg(host->chan_rx->device->dev,
+                            host->sg_ptr, host->dma_sglen,
                            DMA_FROM_DEVICE);
       else
-               dma_unmap_sg(&host->pdev->dev, host->sg_ptr, host->dma_sglen,
+               dma_unmap_sg(host->chan_tx->device->dev,
+                            host->sg_ptr, host->dma_sglen,
                            DMA_TO_DEVICE);

       tmio_mmc_do_data_irq(host);
--
1.7.4
diff mbox

Patch

diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index e3c6ef2..c82d8e2 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -825,7 +825,7 @@  static void tmio_mmc_start_dma_rx(struct
tmio_mmc_host *host)
               sg = host->sg_ptr;
       }

-       ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len, DMA_FROM_DEVICE);
+       ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE);
       if (ret > 0) {
               host->dma_sglen = ret;