]> Pileus Git - ~andy/linux/commitdiff
mmc: tmio_mmc: map DMA buffers on the DMA engine device
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 10 Feb 2011 15:10:37 +0000 (16:10 +0100)
committerChris Ball <cjb@laptop.org>
Tue, 15 Mar 2011 17:49:18 +0000 (13:49 -0400)
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>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/tmio_mmc.c

index a33f71841dec642abdd654f4185c3228b7470c65..0d36fa9c629e09fb3718f0e593a4307c831b2b67 100644 (file)
@@ -829,7 +829,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;
                desc = chan->device->device_prep_slave_sg(chan, sg, ret,
@@ -910,7 +910,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,
@@ -982,10 +982,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);