aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2012-02-01 05:42:27 -0500
committerVinod Koul <vinod.koul@linux.intel.com>2012-02-22 07:45:39 -0500
commite2b35f3dbfc080f15b72834d08f04f0269dbe9be (patch)
treefda60f8be147b57cf01155528dda33a9a99b0dab
parent327e6970258618da810f72e86cf2a8b803927e14 (diff)
dmaengine/dw_dmac: Fix dw_dmac user drivers to adapt to slave_config changes
There are few existing user drivers of dw_dmac. They will break as soon as we remove unused fields from struct dw_dma_slave. This patch focuses to fix these user drivers to use dma_slave_config() routine. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c13
-rw-r--r--arch/avr32/mach-at32ap/include/mach/atmel-mci.h7
-rw-r--r--drivers/mmc/host/atmel-mci.c24
-rw-r--r--sound/atmel/abdac.c18
-rw-r--r--sound/atmel/ac97c.c41
5 files changed, 63 insertions, 40 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 402a7bb72669..43c44e77d83c 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1353,7 +1353,6 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
1353 goto fail; 1353 goto fail;
1354 1354
1355 slave->sdata.dma_dev = &dw_dmac0_device.dev; 1355 slave->sdata.dma_dev = &dw_dmac0_device.dev;
1356 slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
1357 slave->sdata.cfg_hi = (DWC_CFGH_SRC_PER(0) 1356 slave->sdata.cfg_hi = (DWC_CFGH_SRC_PER(0)
1358 | DWC_CFGH_DST_PER(1)); 1357 | DWC_CFGH_DST_PER(1));
1359 slave->sdata.cfg_lo &= ~(DWC_CFGL_HS_DST_POL 1358 slave->sdata.cfg_lo &= ~(DWC_CFGL_HS_DST_POL
@@ -2048,27 +2047,19 @@ at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
2048 /* Check if DMA slave interface for capture should be configured. */ 2047 /* Check if DMA slave interface for capture should be configured. */
2049 if (flags & AC97C_CAPTURE) { 2048 if (flags & AC97C_CAPTURE) {
2050 rx_dws->dma_dev = &dw_dmac0_device.dev; 2049 rx_dws->dma_dev = &dw_dmac0_device.dev;
2051 rx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
2052 rx_dws->cfg_hi = DWC_CFGH_SRC_PER(3); 2050 rx_dws->cfg_hi = DWC_CFGH_SRC_PER(3);
2053 rx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL); 2051 rx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2054 rx_dws->src_master = 0; 2052 rx_dws->src_master = 0;
2055 rx_dws->dst_master = 1; 2053 rx_dws->dst_master = 1;
2056 rx_dws->src_msize = DW_DMA_MSIZE_1;
2057 rx_dws->dst_msize = DW_DMA_MSIZE_1;
2058 rx_dws->fc = DW_DMA_FC_D_P2M;
2059 } 2054 }
2060 2055
2061 /* Check if DMA slave interface for playback should be configured. */ 2056 /* Check if DMA slave interface for playback should be configured. */
2062 if (flags & AC97C_PLAYBACK) { 2057 if (flags & AC97C_PLAYBACK) {
2063 tx_dws->dma_dev = &dw_dmac0_device.dev; 2058 tx_dws->dma_dev = &dw_dmac0_device.dev;
2064 tx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
2065 tx_dws->cfg_hi = DWC_CFGH_DST_PER(4); 2059 tx_dws->cfg_hi = DWC_CFGH_DST_PER(4);
2066 tx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL); 2060 tx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2067 tx_dws->src_master = 0; 2061 tx_dws->src_master = 0;
2068 tx_dws->dst_master = 1; 2062 tx_dws->dst_master = 1;
2069 tx_dws->src_msize = DW_DMA_MSIZE_1;
2070 tx_dws->dst_msize = DW_DMA_MSIZE_1;
2071 tx_dws->fc = DW_DMA_FC_D_M2P;
2072 } 2063 }
2073 2064
2074 if (platform_device_add_data(pdev, data, 2065 if (platform_device_add_data(pdev, data,
@@ -2138,14 +2129,10 @@ at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data)
2138 dws = &data->dws; 2129 dws = &data->dws;
2139 2130
2140 dws->dma_dev = &dw_dmac0_device.dev; 2131 dws->dma_dev = &dw_dmac0_device.dev;
2141 dws->reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
2142 dws->cfg_hi = DWC_CFGH_DST_PER(2); 2132 dws->cfg_hi = DWC_CFGH_DST_PER(2);
2143 dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL); 2133 dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2144 dws->src_master = 0; 2134 dws->src_master = 0;
2145 dws->dst_master = 1; 2135 dws->dst_master = 1;
2146 dws->src_msize = DW_DMA_MSIZE_1;
2147 dws->dst_msize = DW_DMA_MSIZE_1;
2148 dws->fc = DW_DMA_FC_D_M2P;
2149 2136
2150 if (platform_device_add_data(pdev, data, 2137 if (platform_device_add_data(pdev, data,
2151 sizeof(struct atmel_abdac_pdata))) 2138 sizeof(struct atmel_abdac_pdata)))
diff --git a/arch/avr32/mach-at32ap/include/mach/atmel-mci.h b/arch/avr32/mach-at32ap/include/mach/atmel-mci.h
index a9b38967f703..4bba58561d5c 100644
--- a/arch/avr32/mach-at32ap/include/mach/atmel-mci.h
+++ b/arch/avr32/mach-at32ap/include/mach/atmel-mci.h
@@ -14,11 +14,4 @@ struct mci_dma_data {
14#define slave_data_ptr(s) (&(s)->sdata) 14#define slave_data_ptr(s) (&(s)->sdata)
15#define find_slave_dev(s) ((s)->sdata.dma_dev) 15#define find_slave_dev(s) ((s)->sdata.dma_dev)
16 16
17#define setup_dma_addr(s, t, r) do { \
18 if (s) { \
19 (s)->sdata.tx_reg = (t); \
20 (s)->sdata.rx_reg = (r); \
21 } \
22} while (0)
23
24#endif /* __MACH_ATMEL_MCI_H */ 17#endif /* __MACH_ATMEL_MCI_H */
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index fcfe1eb5acc8..3ba865ddebc4 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -24,6 +24,7 @@
24#include <linux/seq_file.h> 24#include <linux/seq_file.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/stat.h> 26#include <linux/stat.h>
27#include <linux/types.h>
27 28
28#include <linux/mmc/host.h> 29#include <linux/mmc/host.h>
29#include <linux/mmc/sdio.h> 30#include <linux/mmc/sdio.h>
@@ -173,6 +174,7 @@ struct atmel_mci {
173 174
174 struct atmel_mci_dma dma; 175 struct atmel_mci_dma dma;
175 struct dma_chan *data_chan; 176 struct dma_chan *data_chan;
177 struct dma_slave_config dma_conf;
176 178
177 u32 cmd_status; 179 u32 cmd_status;
178 u32 data_status; 180 u32 data_status;
@@ -863,15 +865,16 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
863 865
864 if (data->flags & MMC_DATA_READ) { 866 if (data->flags & MMC_DATA_READ) {
865 direction = DMA_FROM_DEVICE; 867 direction = DMA_FROM_DEVICE;
866 slave_dirn = DMA_DEV_TO_MEM; 868 host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM;
867 } else { 869 } else {
868 direction = DMA_TO_DEVICE; 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 sglen = dma_map_sg(chan->device->dev, data->sg, 874 sglen = dma_map_sg(chan->device->dev, data->sg,
873 data->sg_len, direction); 875 data->sg_len, direction);
874 876
877 dmaengine_slave_config(chan, &host->dma_conf);
875 desc = chan->device->device_prep_slave_sg(chan, 878 desc = chan->device->device_prep_slave_sg(chan,
876 data->sg, sglen, slave_dirn, 879 data->sg, sglen, slave_dirn,
877 DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 880 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
@@ -1957,22 +1960,27 @@ static void atmci_configure_dma(struct atmel_mci *host)
1957 if (pdata && find_slave_dev(pdata->dma_slave)) { 1960 if (pdata && find_slave_dev(pdata->dma_slave)) {
1958 dma_cap_mask_t mask; 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 /* Try to grab a DMA channel */ 1963 /* Try to grab a DMA channel */
1965 dma_cap_zero(mask); 1964 dma_cap_zero(mask);
1966 dma_cap_set(DMA_SLAVE, mask); 1965 dma_cap_set(DMA_SLAVE, mask);
1967 host->dma.chan = 1966 host->dma.chan =
1968 dma_request_channel(mask, atmci_filter, pdata->dma_slave); 1967 dma_request_channel(mask, atmci_filter, pdata->dma_slave);
1969 } 1968 }
1970 if (!host->dma.chan) 1969 if (!host->dma.chan) {
1971 dev_notice(&host->pdev->dev, "DMA not available, using PIO\n"); 1970 dev_notice(&host->pdev->dev, "DMA not available, using PIO\n");
1972 else 1971 } else {
1973 dev_info(&host->pdev->dev, 1972 dev_info(&host->pdev->dev,
1974 "Using %s for DMA transfers\n", 1973 "Using %s for DMA transfers\n",
1975 dma_chan_name(host->dma.chan)); 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
1978static inline unsigned int atmci_get_version(struct atmel_mci *host) 1986static inline unsigned int atmci_get_version(struct atmel_mci *host)
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c
index 4fa1dbd8ee83..f7c2bb08055d 100644
--- a/sound/atmel/abdac.c
+++ b/sound/atmel/abdac.c
@@ -16,6 +16,7 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/types.h>
19#include <linux/io.h> 20#include <linux/io.h>
20 21
21#include <sound/core.h> 22#include <sound/core.h>
@@ -467,15 +468,24 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev)
467 snd_card_set_dev(card, &pdev->dev); 468 snd_card_set_dev(card, &pdev->dev);
468 469
469 if (pdata->dws.dma_dev) { 470 if (pdata->dws.dma_dev) {
470 struct dw_dma_slave *dws = &pdata->dws;
471 dma_cap_mask_t mask; 471 dma_cap_mask_t mask;
472 472
473 dws->tx_reg = regs->start + DAC_DATA;
474
475 dma_cap_zero(mask); 473 dma_cap_zero(mask);
476 dma_cap_set(DMA_SLAVE, mask); 474 dma_cap_set(DMA_SLAVE, mask);
477 475
478 dac->dma.chan = dma_request_channel(mask, filter, dws); 476 dac->dma.chan = dma_request_channel(mask, filter, &pdata->dws);
477 if (dac->dma.chan) {
478 struct dma_slave_config dma_conf = {
479 .dst_addr = regs->start + DAC_DATA,
480 .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
481 .src_maxburst = 1,
482 .dst_maxburst = 1,
483 .direction = DMA_MEM_TO_DEV,
484 .device_fc = false,
485 };
486
487 dmaengine_slave_config(dac->dma.chan, &dma_conf);
488 }
479 } 489 }
480 if (!pdata->dws.dma_dev || !dac->dma.chan) { 490 if (!pdata->dws.dma_dev || !dac->dma.chan) {
481 dev_dbg(&pdev->dev, "DMA not available\n"); 491 dev_dbg(&pdev->dev, "DMA not available\n");
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 61dade698358..115313ef54d6 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -20,6 +20,7 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/types.h>
23#include <linux/io.h> 24#include <linux/io.h>
24 25
25#include <sound/core.h> 26#include <sound/core.h>
@@ -1014,16 +1015,28 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
1014 1015
1015 if (cpu_is_at32ap7000()) { 1016 if (cpu_is_at32ap7000()) {
1016 if (pdata->rx_dws.dma_dev) { 1017 if (pdata->rx_dws.dma_dev) {
1017 struct dw_dma_slave *dws = &pdata->rx_dws;
1018 dma_cap_mask_t mask; 1018 dma_cap_mask_t mask;
1019 1019
1020 dws->rx_reg = regs->start + AC97C_CARHR + 2;
1021
1022 dma_cap_zero(mask); 1020 dma_cap_zero(mask);
1023 dma_cap_set(DMA_SLAVE, mask); 1021 dma_cap_set(DMA_SLAVE, mask);
1024 1022
1025 chip->dma.rx_chan = dma_request_channel(mask, filter, 1023 chip->dma.rx_chan = dma_request_channel(mask, filter,
1026 dws); 1024 &pdata->rx_dws);
1025 if (chip->dma.rx_chan) {
1026 struct dma_slave_config dma_conf = {
1027 .src_addr = regs->start + AC97C_CARHR +
1028 2,
1029 .src_addr_width =
1030 DMA_SLAVE_BUSWIDTH_2_BYTES,
1031 .src_maxburst = 1,
1032 .dst_maxburst = 1,
1033 .direction = DMA_DEV_TO_MEM,
1034 .device_fc = false,
1035 };
1036
1037 dmaengine_slave_config(chip->dma.rx_chan,
1038 &dma_conf);
1039 }
1027 1040
1028 dev_info(&chip->pdev->dev, "using %s for DMA RX\n", 1041 dev_info(&chip->pdev->dev, "using %s for DMA RX\n",
1029 dev_name(&chip->dma.rx_chan->dev->device)); 1042 dev_name(&chip->dma.rx_chan->dev->device));
@@ -1031,16 +1044,28 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
1031 } 1044 }
1032 1045
1033 if (pdata->tx_dws.dma_dev) { 1046 if (pdata->tx_dws.dma_dev) {
1034 struct dw_dma_slave *dws = &pdata->tx_dws;
1035 dma_cap_mask_t mask; 1047 dma_cap_mask_t mask;
1036 1048
1037 dws->tx_reg = regs->start + AC97C_CATHR + 2;
1038
1039 dma_cap_zero(mask); 1049 dma_cap_zero(mask);
1040 dma_cap_set(DMA_SLAVE, mask); 1050 dma_cap_set(DMA_SLAVE, mask);
1041 1051
1042 chip->dma.tx_chan = dma_request_channel(mask, filter, 1052 chip->dma.tx_chan = dma_request_channel(mask, filter,
1043 dws); 1053 &pdata->tx_dws);
1054 if (chip->dma.tx_chan) {
1055 struct dma_slave_config dma_conf = {
1056 .dst_addr = regs->start + AC97C_CATHR +
1057 2,
1058 .dst_addr_width =
1059 DMA_SLAVE_BUSWIDTH_2_BYTES,
1060 .src_maxburst = 1,
1061 .dst_maxburst = 1,
1062 .direction = DMA_MEM_TO_DEV,
1063 .device_fc = false,
1064 };
1065
1066 dmaengine_slave_config(chip->dma.tx_chan,
1067 &dma_conf);
1068 }
1044 1069
1045 dev_info(&chip->pdev->dev, "using %s for DMA TX\n", 1070 dev_info(&chip->pdev->dev, "using %s for DMA TX\n",
1046 dev_name(&chip->dma.tx_chan->dev->device)); 1071 dev_name(&chip->dma.tx_chan->dev->device));