|
24 | 24 | #include <linux/seq_file.h> |
25 | 25 | #include <linux/slab.h> |
26 | 26 | #include <linux/stat.h> |
| 27 | +#include <linux/types.h> |
27 | 28 |
|
28 | 29 | #include <linux/mmc/host.h> |
29 | 30 | #include <linux/mmc/sdio.h> |
@@ -173,6 +174,7 @@ struct atmel_mci { |
173 | 174 |
|
174 | 175 | struct atmel_mci_dma dma; |
175 | 176 | struct dma_chan *data_chan; |
| 177 | + struct dma_slave_config dma_conf; |
176 | 178 |
|
177 | 179 | u32 cmd_status; |
178 | 180 | u32 data_status; |
@@ -863,15 +865,16 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) |
863 | 865 |
|
864 | 866 | if (data->flags & MMC_DATA_READ) { |
865 | 867 | direction = DMA_FROM_DEVICE; |
866 | | - slave_dirn = DMA_DEV_TO_MEM; |
| 868 | + host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM; |
867 | 869 | } else { |
868 | 870 | direction = DMA_TO_DEVICE; |
869 | | - slave_dirn = DMA_MEM_TO_DEV; |
| 871 | + host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV; |
870 | 872 | } |
871 | 873 |
|
872 | 874 | sglen = dma_map_sg(chan->device->dev, data->sg, |
873 | 875 | data->sg_len, direction); |
874 | 876 |
|
| 877 | + dmaengine_slave_config(chan, &host->dma_conf); |
875 | 878 | desc = chan->device->device_prep_slave_sg(chan, |
876 | 879 | data->sg, sglen, slave_dirn, |
877 | 880 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
@@ -1957,22 +1960,27 @@ static void atmci_configure_dma(struct atmel_mci *host) |
1957 | 1960 | if (pdata && find_slave_dev(pdata->dma_slave)) { |
1958 | 1961 | dma_cap_mask_t mask; |
1959 | 1962 |
|
1960 | | - setup_dma_addr(pdata->dma_slave, |
1961 | | - host->mapbase + ATMCI_TDR, |
1962 | | - host->mapbase + ATMCI_RDR); |
1963 | | - |
1964 | 1963 | /* Try to grab a DMA channel */ |
1965 | 1964 | dma_cap_zero(mask); |
1966 | 1965 | dma_cap_set(DMA_SLAVE, mask); |
1967 | 1966 | host->dma.chan = |
1968 | 1967 | dma_request_channel(mask, atmci_filter, pdata->dma_slave); |
1969 | 1968 | } |
1970 | | - if (!host->dma.chan) |
| 1969 | + if (!host->dma.chan) { |
1971 | 1970 | dev_notice(&host->pdev->dev, "DMA not available, using PIO\n"); |
1972 | | - else |
| 1971 | + } else { |
1973 | 1972 | dev_info(&host->pdev->dev, |
1974 | 1973 | "Using %s for DMA transfers\n", |
1975 | 1974 | dma_chan_name(host->dma.chan)); |
| 1975 | + |
| 1976 | + host->dma_conf.src_addr = host->mapbase + ATMCI_RDR; |
| 1977 | + host->dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
| 1978 | + host->dma_conf.src_maxburst = 1; |
| 1979 | + host->dma_conf.dst_addr = host->mapbase + ATMCI_TDR; |
| 1980 | + host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
| 1981 | + host->dma_conf.dst_maxburst = 1; |
| 1982 | + host->dma_conf.device_fc = false; |
| 1983 | + } |
1976 | 1984 | } |
1977 | 1985 |
|
1978 | 1986 | static inline unsigned int atmci_get_version(struct atmel_mci *host) |
|
0 commit comments