diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-02-20 06:52:17 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-03-29 19:04:07 -0400 |
commit | bce95c63ef1bcf528ea45c41505eb4c21560d92d (patch) | |
tree | 4ca2d02533a8ebf1341a9b81a4f046ca651ab0d6 | |
parent | f73bb9b35596e045feacdf4d2fd32cfb087e2411 (diff) |
dw_dmac: adjust slave_id accordingly to request line base
On some hardware configurations we have got the request line with the offset.
The patch introduces convert_slave_id() helper for that cases. The request line
base is came from the driver data provided by the platform_device_id table.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/dw_dmac.c | 17 | ||||
-rw-r--r-- | drivers/dma/dw_dmac_regs.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index eb81ec9d5b91..43a5329d4483 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
@@ -1001,6 +1001,13 @@ static inline void convert_burst(u32 *maxburst) | |||
1001 | *maxburst = 0; | 1001 | *maxburst = 0; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | static inline void convert_slave_id(struct dw_dma_chan *dwc) | ||
1005 | { | ||
1006 | struct dw_dma *dw = to_dw_dma(dwc->chan.device); | ||
1007 | |||
1008 | dwc->dma_sconfig.slave_id -= dw->request_line_base; | ||
1009 | } | ||
1010 | |||
1004 | static int | 1011 | static int |
1005 | set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) | 1012 | set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) |
1006 | { | 1013 | { |
@@ -1015,6 +1022,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) | |||
1015 | 1022 | ||
1016 | convert_burst(&dwc->dma_sconfig.src_maxburst); | 1023 | convert_burst(&dwc->dma_sconfig.src_maxburst); |
1017 | convert_burst(&dwc->dma_sconfig.dst_maxburst); | 1024 | convert_burst(&dwc->dma_sconfig.dst_maxburst); |
1025 | convert_slave_id(dwc); | ||
1018 | 1026 | ||
1019 | return 0; | 1027 | return 0; |
1020 | } | 1028 | } |
@@ -1628,6 +1636,7 @@ dw_dma_parse_dt(struct platform_device *pdev) | |||
1628 | 1636 | ||
1629 | static int dw_probe(struct platform_device *pdev) | 1637 | static int dw_probe(struct platform_device *pdev) |
1630 | { | 1638 | { |
1639 | const struct platform_device_id *match; | ||
1631 | struct dw_dma_platform_data *pdata; | 1640 | struct dw_dma_platform_data *pdata; |
1632 | struct resource *io; | 1641 | struct resource *io; |
1633 | struct dw_dma *dw; | 1642 | struct dw_dma *dw; |
@@ -1711,6 +1720,11 @@ static int dw_probe(struct platform_device *pdev) | |||
1711 | memcpy(dw->data_width, pdata->data_width, 4); | 1720 | memcpy(dw->data_width, pdata->data_width, 4); |
1712 | } | 1721 | } |
1713 | 1722 | ||
1723 | /* Get the base request line if set */ | ||
1724 | match = platform_get_device_id(pdev); | ||
1725 | if (match) | ||
1726 | dw->request_line_base = (unsigned int)match->driver_data; | ||
1727 | |||
1714 | /* Calculate all channel mask before DMA setup */ | 1728 | /* Calculate all channel mask before DMA setup */ |
1715 | dw->all_chan_mask = (1 << nr_channels) - 1; | 1729 | dw->all_chan_mask = (1 << nr_channels) - 1; |
1716 | 1730 | ||
@@ -1906,7 +1920,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_id_table); | |||
1906 | #endif | 1920 | #endif |
1907 | 1921 | ||
1908 | static const struct platform_device_id dw_dma_ids[] = { | 1922 | static const struct platform_device_id dw_dma_ids[] = { |
1909 | { "INTL9C60", 0 }, | 1923 | /* Name, Request Line Base */ |
1924 | { "INTL9C60", (kernel_ulong_t)16 }, | ||
1910 | { } | 1925 | { } |
1911 | }; | 1926 | }; |
1912 | 1927 | ||
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h index cf0ce5c77d60..4d02c3669b75 100644 --- a/drivers/dma/dw_dmac_regs.h +++ b/drivers/dma/dw_dmac_regs.h | |||
@@ -247,6 +247,7 @@ struct dw_dma { | |||
247 | /* hardware configuration */ | 247 | /* hardware configuration */ |
248 | unsigned char nr_masters; | 248 | unsigned char nr_masters; |
249 | unsigned char data_width[4]; | 249 | unsigned char data_width[4]; |
250 | unsigned int request_line_base; | ||
250 | 251 | ||
251 | struct dw_dma_chan chan[0]; | 252 | struct dw_dma_chan chan[0]; |
252 | }; | 253 | }; |