Skip to content

Commit bce95c6

Browse files
andy-shevVinod Koul
authored andcommitted
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 <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Cc: Viresh Kumar <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Vinod Koul <[email protected]>
1 parent f73bb9b commit bce95c6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

drivers/dma/dw_dmac.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,13 @@ static inline void convert_burst(u32 *maxburst)
10011001
*maxburst = 0;
10021002
}
10031003

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+
10041011
static int
10051012
set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
10061013
{
@@ -1015,6 +1022,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
10151022

10161023
convert_burst(&dwc->dma_sconfig.src_maxburst);
10171024
convert_burst(&dwc->dma_sconfig.dst_maxburst);
1025+
convert_slave_id(dwc);
10181026

10191027
return 0;
10201028
}
@@ -1628,6 +1636,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
16281636

16291637
static int dw_probe(struct platform_device *pdev)
16301638
{
1639+
const struct platform_device_id *match;
16311640
struct dw_dma_platform_data *pdata;
16321641
struct resource *io;
16331642
struct dw_dma *dw;
@@ -1711,6 +1720,11 @@ static int dw_probe(struct platform_device *pdev)
17111720
memcpy(dw->data_width, pdata->data_width, 4);
17121721
}
17131722

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+
17141728
/* Calculate all channel mask before DMA setup */
17151729
dw->all_chan_mask = (1 << nr_channels) - 1;
17161730

@@ -1906,7 +1920,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_id_table);
19061920
#endif
19071921

19081922
static const struct platform_device_id dw_dma_ids[] = {
1909-
{ "INTL9C60", 0 },
1923+
/* Name, Request Line Base */
1924+
{ "INTL9C60", (kernel_ulong_t)16 },
19101925
{ }
19111926
};
19121927

drivers/dma/dw_dmac_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ struct dw_dma {
247247
/* hardware configuration */
248248
unsigned char nr_masters;
249249
unsigned char data_width[4];
250+
unsigned int request_line_base;
250251

251252
struct dw_dma_chan chan[0];
252253
};

0 commit comments

Comments
 (0)