mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
dmaengine: pl330: Add support for dmamux parsed from DT
dmamux pair0: args[1]: reg0 args[2]: val0
dmamux pair1: args[3]: reg1 args[4]: val1
e.g. rk3506
sai0 {
dmas = <&dmac0 9 0xff2880a4 0x01000100 0xff2880ac 0x000c0000>,
<&dmac0 8 0xff2880a4 0x00800080 0xff2880ac 0x00030002>;
}
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I81a2d5e8de37954930b6d0e0aab061273ae76cd2
This commit is contained in:
@@ -2331,19 +2331,49 @@ static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec,
|
||||
{
|
||||
int count = dma_spec->args_count;
|
||||
struct pl330_dmac *pl330 = ofdma->of_dma_data;
|
||||
struct dma_chan *chan;
|
||||
unsigned int chan_id;
|
||||
|
||||
if (!pl330)
|
||||
return NULL;
|
||||
|
||||
if (count != 1)
|
||||
if (count < 1)
|
||||
return NULL;
|
||||
|
||||
chan_id = dma_spec->args[0];
|
||||
if (chan_id >= pl330->num_peripherals)
|
||||
return NULL;
|
||||
|
||||
return dma_get_slave_channel(&pl330->peripherals[chan_id].chan);
|
||||
chan = dma_get_slave_channel(&pl330->peripherals[chan_id].chan);
|
||||
|
||||
/* Support dmamux set, such as rk3506 */
|
||||
if (chan && count == 5) {
|
||||
void __iomem *r;
|
||||
|
||||
/* dmamux pair0: args[1]: reg0 args[2]: val0 */
|
||||
if (dma_spec->args[1]) {
|
||||
r = ioremap(dma_spec->args[1], 0x4);
|
||||
if (r) {
|
||||
writel(dma_spec->args[2], r);
|
||||
iounmap(r);
|
||||
}
|
||||
}
|
||||
|
||||
/* dmamux pair1: args[3]: reg1 args[4]: val1 */
|
||||
if (dma_spec->args[3]) {
|
||||
r = ioremap(dma_spec->args[3], 0x4);
|
||||
if (r) {
|
||||
writel(dma_spec->args[4], r);
|
||||
iounmap(r);
|
||||
}
|
||||
}
|
||||
|
||||
dev_dbg(pl330->ddma.dev, "r0: 0x%08x v0: 0x%08x r1: 0x%08x, v1: 0x%08x\n",
|
||||
dma_spec->args[1], dma_spec->args[2],
|
||||
dma_spec->args[3], dma_spec->args[4]);
|
||||
}
|
||||
|
||||
return chan;
|
||||
}
|
||||
|
||||
static int pl330_alloc_chan_resources(struct dma_chan *chan)
|
||||
|
||||
Reference in New Issue
Block a user