diff mbox

[04/11] sh_mmcif: map DMA buffers on the DMA engine device

Message ID AANLkTinoqkaxuHx6vTB+WPPP3z-DiOA44X90yGzKur7H@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:09 PM
Subject: [PATCH 04/11] sh_mmcif: 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>, Paul Mundt
<lethal@linux-sh.org>, 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/sh_mmcif.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

               host->dma_sglen = ret;
               desc = chan->device->device_prep_slave_sg(chan, sg, ret,
@@ -263,7 +266,8 @@ static void sh_mmcif_start_dma_tx(struct
sh_mmcif_host *host)
       dma_cookie_t cookie = -EINVAL;
       int ret;

-       ret = dma_map_sg(&host->pd->dev, sg, host->data->sg_len, DMA_TO_DEVICE);
+       ret = dma_map_sg(chan->device->dev, sg, host->data->sg_len,
+                        DMA_TO_DEVICE);
       if (ret > 0) {
               host->dma_sglen = ret;
               desc = chan->device->device_prep_slave_sg(chan, sg, ret,
--
1.7.4
diff mbox

Patch

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 12884c2..8e4aba9 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -194,10 +194,12 @@  static void mmcif_dma_complete(void *arg)
               return;

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

       complete(&host->dma_complete);
@@ -211,7 +213,8 @@  static void sh_mmcif_start_dma_rx(struct
sh_mmcif_host *host)
       dma_cookie_t cookie = -EINVAL;
       int ret;

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