提交 bce95c63 编写于 作者: A Andy Shevchenko 提交者: Vinod Koul

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: NMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NVinod Koul <vinod.koul@intel.com>
上级 f73bb9b3
...@@ -1001,6 +1001,13 @@ static inline void convert_burst(u32 *maxburst) ...@@ -1001,6 +1001,13 @@ static inline void convert_burst(u32 *maxburst)
*maxburst = 0; *maxburst = 0;
} }
static inline void convert_slave_id(struct dw_dma_chan *dwc)
{
struct dw_dma *dw = to_dw_dma(dwc->chan.device);
dwc->dma_sconfig.slave_id -= dw->request_line_base;
}
static int static int
set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
{ {
...@@ -1015,6 +1022,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) ...@@ -1015,6 +1022,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
convert_burst(&dwc->dma_sconfig.src_maxburst); convert_burst(&dwc->dma_sconfig.src_maxburst);
convert_burst(&dwc->dma_sconfig.dst_maxburst); convert_burst(&dwc->dma_sconfig.dst_maxburst);
convert_slave_id(dwc);
return 0; return 0;
} }
...@@ -1628,6 +1636,7 @@ dw_dma_parse_dt(struct platform_device *pdev) ...@@ -1628,6 +1636,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
static int dw_probe(struct platform_device *pdev) static int dw_probe(struct platform_device *pdev)
{ {
const struct platform_device_id *match;
struct dw_dma_platform_data *pdata; struct dw_dma_platform_data *pdata;
struct resource *io; struct resource *io;
struct dw_dma *dw; struct dw_dma *dw;
...@@ -1711,6 +1720,11 @@ static int dw_probe(struct platform_device *pdev) ...@@ -1711,6 +1720,11 @@ static int dw_probe(struct platform_device *pdev)
memcpy(dw->data_width, pdata->data_width, 4); memcpy(dw->data_width, pdata->data_width, 4);
} }
/* Get the base request line if set */
match = platform_get_device_id(pdev);
if (match)
dw->request_line_base = (unsigned int)match->driver_data;
/* Calculate all channel mask before DMA setup */ /* Calculate all channel mask before DMA setup */
dw->all_chan_mask = (1 << nr_channels) - 1; dw->all_chan_mask = (1 << nr_channels) - 1;
...@@ -1906,7 +1920,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_id_table); ...@@ -1906,7 +1920,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_id_table);
#endif #endif
static const struct platform_device_id dw_dma_ids[] = { static const struct platform_device_id dw_dma_ids[] = {
{ "INTL9C60", 0 }, /* Name, Request Line Base */
{ "INTL9C60", (kernel_ulong_t)16 },
{ } { }
}; };
......
...@@ -247,6 +247,7 @@ struct dw_dma { ...@@ -247,6 +247,7 @@ struct dw_dma {
/* hardware configuration */ /* hardware configuration */
unsigned char nr_masters; unsigned char nr_masters;
unsigned char data_width[4]; unsigned char data_width[4];
unsigned int request_line_base;
struct dw_dma_chan chan[0]; struct dw_dma_chan chan[0];
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册