Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
[linux-2.6-block.git] / drivers / mmc / host / atmel-mci.c
index 390863e7efbde4bb4ba37e210a1e694438b12cdd..9819dc09ce08d24f7bd2924fd35d786cc013b0ac 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 #include <linux/stat.h>
+#include <linux/types.h>
 
 #include <linux/mmc/host.h>
 #include <linux/mmc/sdio.h>
@@ -173,6 +174,7 @@ struct atmel_mci {
 
        struct atmel_mci_dma    dma;
        struct dma_chan         *data_chan;
+       struct dma_slave_config dma_conf;
 
        u32                     cmd_status;
        u32                     data_status;
@@ -863,16 +865,17 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
 
        if (data->flags & MMC_DATA_READ) {
                direction = DMA_FROM_DEVICE;
-               slave_dirn = DMA_DEV_TO_MEM;
+               host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM;
        } else {
                direction = DMA_TO_DEVICE;
-               slave_dirn = DMA_MEM_TO_DEV;
+               host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV;
        }
 
        sglen = dma_map_sg(chan->device->dev, data->sg,
                        data->sg_len, direction);
 
-       desc = chan->device->device_prep_slave_sg(chan,
+       dmaengine_slave_config(chan, &host->dma_conf);
+       desc = dmaengine_prep_slave_sg(chan,
                        data->sg, sglen, slave_dirn,
                        DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
        if (!desc)
@@ -1960,10 +1963,6 @@ static bool atmci_configure_dma(struct atmel_mci *host)
        if (pdata && find_slave_dev(pdata->dma_slave)) {
                dma_cap_mask_t mask;
 
-               setup_dma_addr(pdata->dma_slave,
-                              host->mapbase + ATMCI_TDR,
-                              host->mapbase + ATMCI_RDR);
-
                /* Try to grab a DMA channel */
                dma_cap_zero(mask);
                dma_cap_set(DMA_SLAVE, mask);
@@ -1977,6 +1976,14 @@ static bool atmci_configure_dma(struct atmel_mci *host)
                dev_info(&host->pdev->dev,
                                        "using %s for DMA transfers\n",
                                        dma_chan_name(host->dma.chan));
+
+               host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
+               host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+               host->dma_conf.src_maxburst = 1;
+               host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR;
+               host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+               host->dma_conf.dst_maxburst = 1;
+               host->dma_conf.device_fc = false;
                return true;
        }
 }