Skip to content

Commit e2b35f3

Browse files
Viresh KumarVinod Koul
authored andcommitted
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>
1 parent 327e697 commit e2b35f3

5 files changed

Lines changed: 63 additions & 40 deletions

File tree

‎arch/avr32/mach-at32ap/at32ap700x.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,6 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
13531353
goto fail;
13541354

13551355
slave->sdata.dma_dev = &dw_dmac0_device.dev;
1356-
slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
13571356
slave->sdata.cfg_hi = (DWC_CFGH_SRC_PER(0)
13581357
| DWC_CFGH_DST_PER(1));
13591358
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,
20482047
/* Check if DMA slave interface for capture should be configured. */
20492048
if (flags & AC97C_CAPTURE) {
20502049
rx_dws->dma_dev = &dw_dmac0_device.dev;
2051-
rx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
20522050
rx_dws->cfg_hi = DWC_CFGH_SRC_PER(3);
20532051
rx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
20542052
rx_dws->src_master = 0;
20552053
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;
20592054
}
20602055

20612056
/* Check if DMA slave interface for playback should be configured. */
20622057
if (flags & AC97C_PLAYBACK) {
20632058
tx_dws->dma_dev = &dw_dmac0_device.dev;
2064-
tx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
20652059
tx_dws->cfg_hi = DWC_CFGH_DST_PER(4);
20662060
tx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
20672061
tx_dws->src_master = 0;
20682062
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;
20722063
}
20732064

20742065
if (platform_device_add_data(pdev, data,
@@ -2138,14 +2129,10 @@ at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data)
21382129
dws = &data->dws;
21392130

21402131
dws->dma_dev = &dw_dmac0_device.dev;
2141-
dws->reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
21422132
dws->cfg_hi = DWC_CFGH_DST_PER(2);
21432133
dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
21442134
dws->src_master = 0;
21452135
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;
21492136

21502137
if (platform_device_add_data(pdev, data,
21512138
sizeof(struct atmel_abdac_pdata)))

‎arch/avr32/mach-at32ap/include/mach/atmel-mci.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,4 @@ struct mci_dma_data {
1414
#define slave_data_ptr(s) (&(s)->sdata)
1515
#define find_slave_dev(s) ((s)->sdata.dma_dev)
1616

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-
2417
#endif /* __MACH_ATMEL_MCI_H */

‎drivers/mmc/host/atmel-mci.c‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/seq_file.h>
2525
#include <linux/slab.h>
2626
#include <linux/stat.h>
27+
#include <linux/types.h>
2728

2829
#include <linux/mmc/host.h>
2930
#include <linux/mmc/sdio.h>
@@ -173,6 +174,7 @@ struct atmel_mci {
173174

174175
struct atmel_mci_dma dma;
175176
struct dma_chan *data_chan;
177+
struct dma_slave_config dma_conf;
176178

177179
u32 cmd_status;
178180
u32 data_status;
@@ -863,15 +865,16 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
863865

864866
if (data->flags & MMC_DATA_READ) {
865867
direction = DMA_FROM_DEVICE;
866-
slave_dirn = DMA_DEV_TO_MEM;
868+
host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM;
867869
} else {
868870
direction = DMA_TO_DEVICE;
869-
slave_dirn = DMA_MEM_TO_DEV;
871+
host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV;
870872
}
871873

872874
sglen = dma_map_sg(chan->device->dev, data->sg,
873875
data->sg_len, direction);
874876

877+
dmaengine_slave_config(chan, &host->dma_conf);
875878
desc = chan->device->device_prep_slave_sg(chan,
876879
data->sg, sglen, slave_dirn,
877880
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
@@ -1957,22 +1960,27 @@ static void atmci_configure_dma(struct atmel_mci *host)
19571960
if (pdata && find_slave_dev(pdata->dma_slave)) {
19581961
dma_cap_mask_t mask;
19591962

1960-
setup_dma_addr(pdata->dma_slave,
1961-
host->mapbase + ATMCI_TDR,
1962-
host->mapbase + ATMCI_RDR);
1963-
19641963
/* Try to grab a DMA channel */
19651964
dma_cap_zero(mask);
19661965
dma_cap_set(DMA_SLAVE, mask);
19671966
host->dma.chan =
19681967
dma_request_channel(mask, atmci_filter, pdata->dma_slave);
19691968
}
1970-
if (!host->dma.chan)
1969+
if (!host->dma.chan) {
19711970
dev_notice(&host->pdev->dev, "DMA not available, using PIO\n");
1972-
else
1971+
} else {
19731972
dev_info(&host->pdev->dev,
19741973
"Using %s for DMA transfers\n",
19751974
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+
}
19761984
}
19771985

19781986
static inline unsigned int atmci_get_version(struct atmel_mci *host)

‎sound/atmel/abdac.c‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/interrupt.h>
1717
#include <linux/module.h>
1818
#include <linux/platform_device.h>
19+
#include <linux/types.h>
1920
#include <linux/io.h>
2021

2122
#include <sound/core.h>
@@ -467,15 +468,24 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev)
467468
snd_card_set_dev(card, &pdev->dev);
468469

469470
if (pdata->dws.dma_dev) {
470-
struct dw_dma_slave *dws = &pdata->dws;
471471
dma_cap_mask_t mask;
472472

473-
dws->tx_reg = regs->start + DAC_DATA;
474-
475473
dma_cap_zero(mask);
476474
dma_cap_set(DMA_SLAVE, mask);
477475

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+
}
479489
}
480490
if (!pdata->dws.dma_dev || !dac->dma.chan) {
481491
dev_dbg(&pdev->dev, "DMA not available\n");

‎sound/atmel/ac97c.c‎

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/platform_device.h>
2121
#include <linux/mutex.h>
2222
#include <linux/gpio.h>
23+
#include <linux/types.h>
2324
#include <linux/io.h>
2425

2526
#include <sound/core.h>
@@ -1014,33 +1015,57 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
10141015

10151016
if (cpu_is_at32ap7000()) {
10161017
if (pdata->rx_dws.dma_dev) {
1017-
struct dw_dma_slave *dws = &pdata->rx_dws;
10181018
dma_cap_mask_t mask;
10191019

1020-
dws->rx_reg = regs->start + AC97C_CARHR + 2;
1021-
10221020
dma_cap_zero(mask);
10231021
dma_cap_set(DMA_SLAVE, mask);
10241022

10251023
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+
}
10271040

10281041
dev_info(&chip->pdev->dev, "using %s for DMA RX\n",
10291042
dev_name(&chip->dma.rx_chan->dev->device));
10301043
set_bit(DMA_RX_CHAN_PRESENT, &chip->flags);
10311044
}
10321045

10331046
if (pdata->tx_dws.dma_dev) {
1034-
struct dw_dma_slave *dws = &pdata->tx_dws;
10351047
dma_cap_mask_t mask;
10361048

1037-
dws->tx_reg = regs->start + AC97C_CATHR + 2;
1038-
10391049
dma_cap_zero(mask);
10401050
dma_cap_set(DMA_SLAVE, mask);
10411051

10421052
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+
}
10441069

10451070
dev_info(&chip->pdev->dev, "using %s for DMA TX\n",
10461071
dev_name(&chip->dma.tx_chan->dev->device));

0 commit comments

Comments
 (0)