diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-06-18 04:59:28 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-07-08 05:07:11 -0400 |
commit | 016b10f4ea76ba2189d476b4a5f7168e57a8d7ad (patch) | |
tree | f2286eaabae114bee6a27e4db4cfeadde4ac5230 /drivers/dma | |
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/dma')
-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 2de77289a2e9..858483bce719 100644 --- a/drivers/dma/sh/rcar-audmapp.c +++ b/drivers/dma/sh/rcar-audmapp.c | |||
@@ -47,6 +47,7 @@ struct audmapp_chan { | |||
47 | struct shdma_chan shdma_chan; | 47 | struct shdma_chan shdma_chan; |
48 | struct audmapp_slave_config *config; | 48 | struct audmapp_slave_config *config; |
49 | void __iomem *base; | 49 | void __iomem *base; |
50 | dma_addr_t slave_addr; | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | struct audmapp_device { | 53 | struct audmapp_device { |
@@ -56,7 +57,14 @@ struct audmapp_device { | |||
56 | void __iomem *chan_reg; | 57 | void __iomem *chan_reg; |
57 | }; | 58 | }; |
58 | 59 | ||
60 | struct audmapp_desc { | ||
61 | struct shdma_desc shdma_desc; | ||
62 | dma_addr_t src; | ||
63 | dma_addr_t dst; | ||
64 | }; | ||
65 | |||
59 | #define to_chan(chan) container_of(chan, struct audmapp_chan, shdma_chan) | 66 | #define to_chan(chan) container_of(chan, struct audmapp_chan, shdma_chan) |
67 | #define to_desc(sdesc) container_of(sdesc, struct audmapp_desc, shdma_desc) | ||
60 | #define to_dev(chan) container_of(chan->shdma_chan.dma_chan.device, \ | 68 | #define to_dev(chan) container_of(chan->shdma_chan.dma_chan.device, \ |
61 | struct audmapp_device, shdma_dev.dma_dev) | 69 | struct audmapp_device, shdma_dev.dma_dev) |
62 | 70 | ||
@@ -90,19 +98,20 @@ static void audmapp_halt(struct shdma_chan *schan) | |||
90 | } | 98 | } |
91 | 99 | ||
92 | static void audmapp_start_xfer(struct shdma_chan *schan, | 100 | static void audmapp_start_xfer(struct shdma_chan *schan, |
93 | struct shdma_desc *sdecs) | 101 | struct shdma_desc *sdesc) |
94 | { | 102 | { |
95 | struct audmapp_chan *auchan = to_chan(schan); | 103 | struct audmapp_chan *auchan = to_chan(schan); |
96 | struct audmapp_device *audev = to_dev(auchan); | 104 | struct audmapp_device *audev = to_dev(auchan); |
105 | struct audmapp_desc *desc = to_desc(sdesc); | ||
97 | struct audmapp_slave_config *cfg = auchan->config; | 106 | struct audmapp_slave_config *cfg = auchan->config; |
98 | struct device *dev = audev->dev; | 107 | struct device *dev = audev->dev; |
99 | u32 chcr = cfg->chcr | PDMACHCR_DE; | 108 | u32 chcr = cfg->chcr | PDMACHCR_DE; |
100 | 109 | ||
101 | dev_dbg(dev, "src/dst/chcr = %pad/%pad/%x\n", | 110 | dev_dbg(dev, "src/dst/chcr = %pad/%pad/%08x\n", |
102 | &cfg->src, &cfg->dst, cfg->chcr); | 111 | &desc->src, &desc->dst, chcr); |
103 | 112 | ||
104 | audmapp_write(auchan, cfg->src, PDMASAR); | 113 | audmapp_write(auchan, desc->src, PDMASAR); |
105 | audmapp_write(auchan, cfg->dst, PDMADAR); | 114 | audmapp_write(auchan, desc->dst, PDMADAR); |
106 | audmapp_write(auchan, chcr, PDMACHCR); | 115 | audmapp_write(auchan, chcr, PDMACHCR); |
107 | } | 116 | } |
108 | 117 | ||
@@ -137,14 +146,16 @@ static int audmapp_set_slave(struct shdma_chan *schan, int slave_id, | |||
137 | return 0; | 146 | return 0; |
138 | 147 | ||
139 | auchan->config = cfg; | 148 | auchan->config = cfg; |
149 | auchan->slave_addr = slave_addr ? : cfg->dst; | ||
140 | 150 | ||
141 | return 0; | 151 | return 0; |
142 | } | 152 | } |
143 | 153 | ||
144 | static int audmapp_desc_setup(struct shdma_chan *schan, | 154 | static int audmapp_desc_setup(struct shdma_chan *schan, |
145 | struct shdma_desc *sdecs, | 155 | struct shdma_desc *sdesc, |
146 | dma_addr_t src, dma_addr_t dst, size_t *len) | 156 | dma_addr_t src, dma_addr_t dst, size_t *len) |
147 | { | 157 | { |
158 | struct audmapp_desc *desc = to_desc(sdesc); | ||
148 | struct audmapp_chan *auchan = to_chan(schan); | 159 | struct audmapp_chan *auchan = to_chan(schan); |
149 | struct audmapp_slave_config *cfg = auchan->config; | 160 | struct audmapp_slave_config *cfg = auchan->config; |
150 | 161 | ||
@@ -154,6 +165,9 @@ static int audmapp_desc_setup(struct shdma_chan *schan, | |||
154 | if (*len > (size_t)AUDMAPP_LEN_MAX) | 165 | if (*len > (size_t)AUDMAPP_LEN_MAX) |
155 | *len = (size_t)AUDMAPP_LEN_MAX; | 166 | *len = (size_t)AUDMAPP_LEN_MAX; |
156 | 167 | ||
168 | desc->src = src; | ||
169 | desc->dst = dst; | ||
170 | |||
157 | return 0; | 171 | return 0; |
158 | } | 172 | } |
159 | 173 | ||
@@ -164,7 +178,9 @@ static void audmapp_setup_xfer(struct shdma_chan *schan, | |||
164 | 178 | ||
165 | static dma_addr_t audmapp_slave_addr(struct shdma_chan *schan) | 179 | static dma_addr_t audmapp_slave_addr(struct shdma_chan *schan) |
166 | { | 180 | { |
167 | return 0; /* always fixed address */ | 181 | struct audmapp_chan *auchan = to_chan(schan); |
182 | |||
183 | return auchan->slave_addr; | ||
168 | } | 184 | } |
169 | 185 | ||
170 | static bool audmapp_channel_busy(struct shdma_chan *schan) | 186 | static bool audmapp_channel_busy(struct shdma_chan *schan) |
@@ -183,7 +199,7 @@ static bool audmapp_desc_completed(struct shdma_chan *schan, | |||
183 | 199 | ||
184 | static struct shdma_desc *audmapp_embedded_desc(void *buf, int i) | 200 | static struct shdma_desc *audmapp_embedded_desc(void *buf, int i) |
185 | { | 201 | { |
186 | return &((struct shdma_desc *)buf)[i]; | 202 | return &((struct audmapp_desc *)buf)[i].shdma_desc; |
187 | } | 203 | } |
188 | 204 | ||
189 | static const struct shdma_ops audmapp_shdma_ops = { | 205 | static const struct shdma_ops audmapp_shdma_ops = { |
@@ -260,7 +276,7 @@ static int audmapp_probe(struct platform_device *pdev) | |||
260 | 276 | ||
261 | sdev = &audev->shdma_dev; | 277 | sdev = &audev->shdma_dev; |
262 | sdev->ops = &audmapp_shdma_ops; | 278 | sdev->ops = &audmapp_shdma_ops; |
263 | sdev->desc_size = sizeof(struct shdma_desc); | 279 | sdev->desc_size = sizeof(struct audmapp_desc); |
264 | 280 | ||
265 | dma_dev = &sdev->dma_dev; | 281 | dma_dev = &sdev->dma_dev; |
266 | dma_dev->copy_align = LOG2_DEFAULT_XFER_SIZE; | 282 | dma_dev->copy_align = LOG2_DEFAULT_XFER_SIZE; |