diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-01-10 03:53:05 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-01-12 08:07:23 -0500 |
commit | 23d5f4ec9de43dbc73a42f1483d9339b907c3dff (patch) | |
tree | fa19bbfd959291a624433b6f328017160b1dc0d9 /drivers/dma | |
parent | 495aea4b571d1b7f77883f87754247b115627f68 (diff) |
dw_dmac: backlink to dw_dma in dw_dma_chan is superfluous
The same information could be extracted from the struct dma_chan.
The patch introduces helper function dwc_get_data_width() as well.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/dw_dmac.c | 27 | ||||
-rw-r--r-- | drivers/dma/dw_dmac_regs.h | 3 |
2 files changed, 20 insertions, 10 deletions
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index e5378b5741be..154952abc2e9 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
@@ -73,6 +73,22 @@ static inline unsigned int dwc_get_sms(struct dw_dma_slave *slave) | |||
73 | */ | 73 | */ |
74 | #define NR_DESCS_PER_CHANNEL 64 | 74 | #define NR_DESCS_PER_CHANNEL 64 |
75 | 75 | ||
76 | #define SRC_MASTER 0 | ||
77 | #define DST_MASTER 1 | ||
78 | |||
79 | static inline unsigned int dwc_get_data_width(struct dma_chan *chan, int master) | ||
80 | { | ||
81 | struct dw_dma *dw = to_dw_dma(chan->device); | ||
82 | struct dw_dma_slave *dws = chan->private; | ||
83 | |||
84 | if (master == SRC_MASTER) | ||
85 | return dw->data_width[dwc_get_sms(dws)]; | ||
86 | else if (master == DST_MASTER) | ||
87 | return dw->data_width[dwc_get_dms(dws)]; | ||
88 | |||
89 | return 0; | ||
90 | } | ||
91 | |||
76 | /*----------------------------------------------------------------------*/ | 92 | /*----------------------------------------------------------------------*/ |
77 | 93 | ||
78 | /* | 94 | /* |
@@ -701,7 +717,6 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, | |||
701 | size_t len, unsigned long flags) | 717 | size_t len, unsigned long flags) |
702 | { | 718 | { |
703 | struct dw_dma_chan *dwc = to_dw_dma_chan(chan); | 719 | struct dw_dma_chan *dwc = to_dw_dma_chan(chan); |
704 | struct dw_dma_slave *dws = chan->private; | ||
705 | struct dw_desc *desc; | 720 | struct dw_desc *desc; |
706 | struct dw_desc *first; | 721 | struct dw_desc *first; |
707 | struct dw_desc *prev; | 722 | struct dw_desc *prev; |
@@ -724,8 +739,8 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, | |||
724 | 739 | ||
725 | dwc->direction = DMA_MEM_TO_MEM; | 740 | dwc->direction = DMA_MEM_TO_MEM; |
726 | 741 | ||
727 | data_width = min_t(unsigned int, dwc->dw->data_width[dwc_get_sms(dws)], | 742 | data_width = min_t(unsigned int, dwc_get_data_width(chan, SRC_MASTER), |
728 | dwc->dw->data_width[dwc_get_dms(dws)]); | 743 | dwc_get_data_width(chan, DST_MASTER)); |
729 | 744 | ||
730 | src_width = dst_width = min_t(unsigned int, data_width, | 745 | src_width = dst_width = min_t(unsigned int, data_width, |
731 | dwc_fast_fls(src | dest | len)); | 746 | dwc_fast_fls(src | dest | len)); |
@@ -790,7 +805,6 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
790 | unsigned long flags, void *context) | 805 | unsigned long flags, void *context) |
791 | { | 806 | { |
792 | struct dw_dma_chan *dwc = to_dw_dma_chan(chan); | 807 | struct dw_dma_chan *dwc = to_dw_dma_chan(chan); |
793 | struct dw_dma_slave *dws = chan->private; | ||
794 | struct dma_slave_config *sconfig = &dwc->dma_sconfig; | 808 | struct dma_slave_config *sconfig = &dwc->dma_sconfig; |
795 | struct dw_desc *prev; | 809 | struct dw_desc *prev; |
796 | struct dw_desc *first; | 810 | struct dw_desc *first; |
@@ -824,7 +838,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
824 | ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_M2P) : | 838 | ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_M2P) : |
825 | DWC_CTLL_FC(DW_DMA_FC_D_M2P); | 839 | DWC_CTLL_FC(DW_DMA_FC_D_M2P); |
826 | 840 | ||
827 | data_width = dwc->dw->data_width[dwc_get_sms(dws)]; | 841 | data_width = dwc_get_data_width(chan, SRC_MASTER); |
828 | 842 | ||
829 | for_each_sg(sgl, sg, sg_len, i) { | 843 | for_each_sg(sgl, sg, sg_len, i) { |
830 | struct dw_desc *desc; | 844 | struct dw_desc *desc; |
@@ -887,7 +901,7 @@ slave_sg_todev_fill_desc: | |||
887 | ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_P2M) : | 901 | ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_P2M) : |
888 | DWC_CTLL_FC(DW_DMA_FC_D_P2M); | 902 | DWC_CTLL_FC(DW_DMA_FC_D_P2M); |
889 | 903 | ||
890 | data_width = dwc->dw->data_width[dwc_get_dms(dws)]; | 904 | data_width = dwc_get_data_width(chan, DST_MASTER); |
891 | 905 | ||
892 | for_each_sg(sgl, sg, sg_len, i) { | 906 | for_each_sg(sgl, sg, sg_len, i) { |
893 | struct dw_desc *desc; | 907 | struct dw_desc *desc; |
@@ -1739,7 +1753,6 @@ static int dw_probe(struct platform_device *pdev) | |||
1739 | 1753 | ||
1740 | channel_clear_bit(dw, CH_EN, dwc->mask); | 1754 | channel_clear_bit(dw, CH_EN, dwc->mask); |
1741 | 1755 | ||
1742 | dwc->dw = dw; | ||
1743 | dwc->direction = DMA_TRANS_NONE; | 1756 | dwc->direction = DMA_TRANS_NONE; |
1744 | 1757 | ||
1745 | /* hardware configuration */ | 1758 | /* hardware configuration */ |
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h index f9532c29b808..577f2dd35882 100644 --- a/drivers/dma/dw_dmac_regs.h +++ b/drivers/dma/dw_dmac_regs.h | |||
@@ -214,9 +214,6 @@ struct dw_dma_chan { | |||
214 | 214 | ||
215 | /* configuration passed via DMA_SLAVE_CONFIG */ | 215 | /* configuration passed via DMA_SLAVE_CONFIG */ |
216 | struct dma_slave_config dma_sconfig; | 216 | struct dma_slave_config dma_sconfig; |
217 | |||
218 | /* backlink to dw_dma */ | ||
219 | struct dw_dma *dw; | ||
220 | }; | 217 | }; |
221 | 218 | ||
222 | static inline struct dw_dma_chan_regs __iomem * | 219 | static inline struct dw_dma_chan_regs __iomem * |