Skip to contentSkip to conversation

dw_dmac: utilize slave_id to pass request line

PATCH In review Andy Shevchenko 3 participants 3 messages Sep 3, 2012 – Sep 14, 2012 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dw_dmac: utilize slave_id to pass request line

There is slave_id field in the generic slave config structure that is dedicated for the uniq slave number. In our case we have the request lines wired to the certain hardware. Therefore the number of the request line is uniq and could be used as slave_id. It allows us in some cases to drop out the usage of the custom slave config structure.

---
 drivers/dma/dw_dmac.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/dma/dw_dmac.c +5 -0
index f0c9403..7a67673 100644
@@ -187,6 +187,11 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 
 		cfghi = dws->cfg_hi;
 		cfglo |= dws->cfg_lo & ~DWC_CFGL_CH_PRIOR_MASK;
+	} else {
+		if (dwc->dma_sconfig.direction == DMA_MEM_TO_DEV)
+			cfghi = DWC_CFGH_DST_PER(dwc->dma_sconfig.slave_id);
+		else if (dwc->dma_sconfig.direction == DMA_DEV_TO_MEM)
+			cfghi = DWC_CFGH_SRC_PER(dwc->dma_sconfig.slave_id);
 	}
 
 	channel_writel(dwc, CFG_LO, cfglo);
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Andy Shevchenko

There is slave_id field in the generic slave config structure that is dedicated for the uniq slave number. In our case we have the request lines wired to the certain hardware. Therefore the number of the request line is uniq and could be used as slave_id. It allows us in some cases to drop out the usage of the custom slave config structure.

---
 drivers/dma/dw_dmac.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/dma/dw_dmac.c +0 -0
index f0c9403..7a67673 100644
@@ -187,6 +187,11 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 

drivers/dma/dw_dmac.c static void dwc_initialize(struct dw_dma_chan *dwc) · line 197

Quoted 10 lines
drivers/dma/dw_dmac.c +5 -0
                cfghi = dws->cfg_hi;
                cfglo |= dws->cfg_lo & ~DWC_CFGL_CH_PRIOR_MASK;
+       } else {
+               if (dwc->dma_sconfig.direction == DMA_MEM_TO_DEV)
+                       cfghi = DWC_CFGH_DST_PER(dwc->dma_sconfig.slave_id);
+               else if (dwc->dma_sconfig.direction == DMA_DEV_TO_MEM)
+                       cfghi = DWC_CFGH_SRC_PER(dwc->dma_sconfig.slave_id);
        }
 
        channel_writel(dwc, CFG_LO, cfglo);
#2 lore raw
In reply to Andy Shevchenko
Quoted 7 lines · Andy Shevchenko

There is slave_id field in the generic slave config structure that is dedicated for the uniq slave number. In our case we have the request lines wired to the certain hardware. Therefore the number of the request line is uniq and could be used as slave_id. It allows us in some cases to drop out the usage of the custom slave config structure.

Applied thanks

Quoted 20 lines
---
 drivers/dma/dw_dmac.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/dma/dw_dmac.c +5 -0
index f0c9403..7a67673 100644
@@ -187,6 +187,11 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 
 		cfghi = dws->cfg_hi;
 		cfglo |= dws->cfg_lo & ~DWC_CFGL_CH_PRIOR_MASK;
+	} else {
+		if (dwc->dma_sconfig.direction == DMA_MEM_TO_DEV)
+			cfghi = DWC_CFGH_DST_PER(dwc->dma_sconfig.slave_id);
+		else if (dwc->dma_sconfig.direction == DMA_DEV_TO_MEM)
+			cfghi = DWC_CFGH_SRC_PER(dwc->dma_sconfig.slave_id);
 	}
 
 	channel_writel(dwc, CFG_LO, cfglo);
Signature · 1 line
~Vinod