Skip to content

Commit 0bb4428

Browse files
committed
Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine fixes from Vinod Koul: "Two fixes for slave-dmaengine. The first one is for making slave_id value correct for dw_dmac and the other one fixes the endieness in DT parsing" * 'fixes' of git://git.infradead.org/users/vkoul/slave-dma: dw_dmac: adjust slave_id accordingly to request line base dmaengine: dw_dma: fix endianess for DT xlate function
2 parents a7b436d + bce95c6 commit 0bb4428

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

drivers/dma/dw_dmac.c

Lines changed: 19 additions & 4 deletions
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
}
@@ -1276,9 +1284,9 @@ static struct dma_chan *dw_dma_xlate(struct of_phandle_args *dma_spec,
12761284
if (dma_spec->args_count != 3)
12771285
return NULL;
12781286

1279-
fargs.req = be32_to_cpup(dma_spec->args+0);
1280-
fargs.src = be32_to_cpup(dma_spec->args+1);
1281-
fargs.dst = be32_to_cpup(dma_spec->args+2);
1287+
fargs.req = dma_spec->args[0];
1288+
fargs.src = dma_spec->args[1];
1289+
fargs.dst = dma_spec->args[2];
12821290

12831291
if (WARN_ON(fargs.req >= DW_DMA_MAX_NR_REQUESTS ||
12841292
fargs.src >= dw->nr_masters ||
@@ -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)