diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-06-18 01:59:28 -0700 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-07-08 11:07:11 +0200 |
commit | 016b10f4ea76ba2189d476b4a5f7168e57a8d7ad (patch) | |
tree | f2286eaabae114bee6a27e4db4cfeadde4ac5230 /drivers | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) |
dma: rcar-audmapp: enable .set_slave
Current .set_slave callback did nothing,
since it assumed src/dst address come from platform settings.
But, it isn't good match to DT probing.
This patch enables .set_slave callback to this issue.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/sh/rcar-audmapp.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/drivers/dma/sh/rcar-audmapp.c b/drivers/dma/sh/rcar-audmapp.c index 2de77289a2e..858483bce71 100644 --- a/drivers/dma/sh/rcar-audmapp.c +++ b/drivers/dma/sh/rcar-audmapp.c @@ -47,6 +47,7 @@ struct audmapp_chan { struct shdma_chan shdma_chan; struct audmapp_slave_config *config; void __iomem *base; + dma_addr_t slave_addr; }; struct audmapp_device { @@ -56,7 +57,14 @@ struct audmapp_device { void __iomem *chan_reg; }; +struct audmapp_desc { + struct shdma_desc shdma_desc; + dma_addr_t src; + dma_addr_t dst; +}; + #define to_chan(chan) container_of(chan, struct audmapp_chan, shdma_chan) +#define to_desc(sdesc) container_of(sdesc, struct audmapp_desc, shdma_desc) #define to_dev(chan) container_of(chan->shdma_chan.dma_chan.device, \ struct audmapp_device, shdma_dev.dma_dev) @@ -90,19 +98,20 @@ static void audmapp_halt(struct shdma_chan *schan) } static void audmapp_start_xfer(struct shdma_chan *schan, - struct shdma_desc *sdecs) + struct shdma_desc *sdesc) { struct audmapp_chan *auchan = to_chan(schan); struct audmapp_device *audev = to_dev(auchan); + struct audmapp_desc *desc = to_desc(sdesc); struct audmapp_slave_config *cfg = auchan->config; struct device *dev = audev->dev; u32 chcr = cfg->chcr | PDMACHCR_DE; - dev_dbg(dev, "src/dst/chcr = %pad/%pad/%x\n", - &cfg->src, &cfg->dst, cfg->chcr); + dev_dbg(dev, "src/dst/chcr = %pad/%pad/%08x\n", + &desc->src, &desc->dst, chcr); - audmapp_write(auchan, cfg->src, PDMASAR); - audmapp_write(auchan, cfg->dst, PDMADAR); + audmapp_write(auchan, desc->src, PDMASAR); + audmapp_write(auchan, desc->dst, PDMADAR); audmapp_write(auchan, chcr, PDMACHCR); } @@ -137,14 +146,16 @@ static int audmapp_set_slave(struct shdma_chan *schan, int slave_id, return 0; auchan->config = cfg; + auchan->slave_addr = slave_addr ? : cfg->dst; return 0; } static int audmapp_desc_setup(struct shdma_chan *schan, - struct shdma_desc *sdecs, + struct shdma_desc *sdesc, dma_addr_t src, dma_addr_t dst, size_t *len) { + struct audmapp_desc *desc = to_desc(sdesc); struct audmapp_chan *auchan = to_chan(schan); struct audmapp_slave_config *cfg = auchan->config; @@ -154,6 +165,9 @@ static int audmapp_desc_setup(struct shdma_chan *schan, if (*len > (size_t)AUDMAPP_LEN_MAX) *len = (size_t)AUDMAPP_LEN_MAX; + desc->src = src; + desc->dst = dst; + return 0; } @@ -164,7 +178,9 @@ static void audmapp_setup_xfer(struct shdma_chan *schan, static dma_addr_t audmapp_slave_addr(struct shdma_chan *schan) { - return 0; /* always fixed address */ + struct audmapp_chan *auchan = to_chan(schan); + + return auchan->slave_addr; } static bool audmapp_channel_busy(struct shdma_chan *schan) @@ -183,7 +199,7 @@ static bool audmapp_desc_completed(struct shdma_chan *schan, static struct shdma_desc *audmapp_embedded_desc(void *buf, int i) { - return &((struct shdma_desc *)buf)[i]; + return &((struct audmapp_desc *)buf)[i].shdma_desc; } static const struct shdma_ops audmapp_shdma_ops = { @@ -260,7 +276,7 @@ static int audmapp_probe(struct platform_device *pdev) sdev = &audev->shdma_dev; sdev->ops = &audmapp_shdma_ops; - sdev->desc_size = sizeof(struct shdma_desc); + sdev->desc_size = sizeof(struct audmapp_desc); dma_dev = &sdev->dma_dev; dma_dev->copy_align = LOG2_DEFAULT_XFER_SIZE; |