aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/dma/dw_dmac.c12
-rw-r--r--drivers/dma/dw_dmac_regs.h14
2 files changed, 18 insertions, 8 deletions
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index e554027849b7..a2c5a60bc2e2 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -178,9 +178,9 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
178 cfghi = dws->cfg_hi; 178 cfghi = dws->cfg_hi;
179 cfglo |= dws->cfg_lo & ~DWC_CFGL_CH_PRIOR_MASK; 179 cfglo |= dws->cfg_lo & ~DWC_CFGL_CH_PRIOR_MASK;
180 } else { 180 } else {
181 if (dwc->dma_sconfig.direction == DMA_MEM_TO_DEV) 181 if (dwc->direction == DMA_MEM_TO_DEV)
182 cfghi = DWC_CFGH_DST_PER(dwc->dma_sconfig.slave_id); 182 cfghi = DWC_CFGH_DST_PER(dwc->dma_sconfig.slave_id);
183 else if (dwc->dma_sconfig.direction == DMA_DEV_TO_MEM) 183 else if (dwc->direction == DMA_DEV_TO_MEM)
184 cfghi = DWC_CFGH_SRC_PER(dwc->dma_sconfig.slave_id); 184 cfghi = DWC_CFGH_SRC_PER(dwc->dma_sconfig.slave_id);
185 } 185 }
186 186
@@ -721,6 +721,8 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
721 return NULL; 721 return NULL;
722 } 722 }
723 723
724 dwc->direction = DMA_MEM_TO_MEM;
725
724 data_width = min_t(unsigned int, dwc->dw->data_width[dwc_get_sms(dws)], 726 data_width = min_t(unsigned int, dwc->dw->data_width[dwc_get_sms(dws)],
725 dwc->dw->data_width[dwc_get_dms(dws)]); 727 dwc->dw->data_width[dwc_get_dms(dws)]);
726 728
@@ -805,6 +807,8 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
805 if (unlikely(!dws || !sg_len)) 807 if (unlikely(!dws || !sg_len))
806 return NULL; 808 return NULL;
807 809
810 dwc->direction = direction;
811
808 prev = first = NULL; 812 prev = first = NULL;
809 813
810 switch (direction) { 814 switch (direction) {
@@ -981,6 +985,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
981 return -EINVAL; 985 return -EINVAL;
982 986
983 memcpy(&dwc->dma_sconfig, sconfig, sizeof(*sconfig)); 987 memcpy(&dwc->dma_sconfig, sconfig, sizeof(*sconfig));
988 dwc->direction = sconfig->direction;
984 989
985 convert_burst(&dwc->dma_sconfig.src_maxburst); 990 convert_burst(&dwc->dma_sconfig.src_maxburst);
986 convert_burst(&dwc->dma_sconfig.dst_maxburst); 991 convert_burst(&dwc->dma_sconfig.dst_maxburst);
@@ -1358,6 +1363,8 @@ struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
1358 if (unlikely(!is_slave_direction(direction))) 1363 if (unlikely(!is_slave_direction(direction)))
1359 goto out_err; 1364 goto out_err;
1360 1365
1366 dwc->direction = direction;
1367
1361 if (direction == DMA_MEM_TO_DEV) 1368 if (direction == DMA_MEM_TO_DEV)
1362 reg_width = __ffs(sconfig->dst_addr_width); 1369 reg_width = __ffs(sconfig->dst_addr_width);
1363 else 1370 else
@@ -1732,6 +1739,7 @@ static int dw_probe(struct platform_device *pdev)
1732 channel_clear_bit(dw, CH_EN, dwc->mask); 1739 channel_clear_bit(dw, CH_EN, dwc->mask);
1733 1740
1734 dwc->dw = dw; 1741 dwc->dw = dw;
1742 dwc->direction = DMA_TRANS_NONE;
1735 1743
1736 /* hardware configuration */ 1744 /* hardware configuration */
1737 if (autocfg) { 1745 if (autocfg) {
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index 8881e9b277a3..f9532c29b808 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -9,6 +9,7 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/dmaengine.h>
12#include <linux/dw_dmac.h> 13#include <linux/dw_dmac.h>
13 14
14#define DW_DMA_MAX_NR_CHANNELS 8 15#define DW_DMA_MAX_NR_CHANNELS 8
@@ -184,12 +185,13 @@ enum dw_dmac_flags {
184}; 185};
185 186
186struct dw_dma_chan { 187struct dw_dma_chan {
187 struct dma_chan chan; 188 struct dma_chan chan;
188 void __iomem *ch_regs; 189 void __iomem *ch_regs;
189 u8 mask; 190 u8 mask;
190 u8 priority; 191 u8 priority;
191 bool paused; 192 enum dma_transfer_direction direction;
192 bool initialized; 193 bool paused;
194 bool initialized;
193 195
194 /* software emulation of the LLP transfers */ 196 /* software emulation of the LLP transfers */
195 struct list_head *tx_list; 197 struct list_head *tx_list;