aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/edma.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2014-11-17 08:42:13 -0500
committerVinod Koul <vinod.koul@intel.com>2014-12-22 01:58:58 -0500
commitaa7c09b65beed65f007605853592342d9a615890 (patch)
tree04f54d970f1a029a1cd5a942324f38957605d534 /drivers/dma/edma.c
parenta4b0d348f60122eb45c50b3e79a8edaec6fee534 (diff)
dmaengine: edma: Split device_control
Split the device_control callback of the TI EDMA driver to make use of the newly introduced callbacks, that will eventually be used to retrieve slave capabilities. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/edma.c')
-rw-r--r--drivers/dma/edma.c50
1 files changed, 15 insertions, 35 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 2b49fe6f0465..8feb096786f8 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -244,8 +244,9 @@ static void edma_execute(struct edma_chan *echan)
244 } 244 }
245} 245}
246 246
247static int edma_terminate_all(struct edma_chan *echan) 247static int edma_terminate_all(struct dma_chan *chan)
248{ 248{
249 struct edma_chan *echan = to_edma_chan(chan);
249 unsigned long flags; 250 unsigned long flags;
250 LIST_HEAD(head); 251 LIST_HEAD(head);
251 252
@@ -273,9 +274,11 @@ static int edma_terminate_all(struct edma_chan *echan)
273 return 0; 274 return 0;
274} 275}
275 276
276static int edma_slave_config(struct edma_chan *echan, 277static int edma_slave_config(struct dma_chan *chan,
277 struct dma_slave_config *cfg) 278 struct dma_slave_config *cfg)
278{ 279{
280 struct edma_chan *echan = to_edma_chan(chan);
281
279 if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES || 282 if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
280 cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES) 283 cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
281 return -EINVAL; 284 return -EINVAL;
@@ -285,8 +288,10 @@ static int edma_slave_config(struct edma_chan *echan,
285 return 0; 288 return 0;
286} 289}
287 290
288static int edma_dma_pause(struct edma_chan *echan) 291static int edma_dma_pause(struct dma_chan *chan)
289{ 292{
293 struct edma_chan *echan = to_edma_chan(chan);
294
290 /* Pause/Resume only allowed with cyclic mode */ 295 /* Pause/Resume only allowed with cyclic mode */
291 if (!echan->edesc || !echan->edesc->cyclic) 296 if (!echan->edesc || !echan->edesc->cyclic)
292 return -EINVAL; 297 return -EINVAL;
@@ -295,8 +300,10 @@ static int edma_dma_pause(struct edma_chan *echan)
295 return 0; 300 return 0;
296} 301}
297 302
298static int edma_dma_resume(struct edma_chan *echan) 303static int edma_dma_resume(struct dma_chan *chan)
299{ 304{
305 struct edma_chan *echan = to_edma_chan(chan);
306
300 /* Pause/Resume only allowed with cyclic mode */ 307 /* Pause/Resume only allowed with cyclic mode */
301 if (!echan->edesc->cyclic) 308 if (!echan->edesc->cyclic)
302 return -EINVAL; 309 return -EINVAL;
@@ -305,36 +312,6 @@ static int edma_dma_resume(struct edma_chan *echan)
305 return 0; 312 return 0;
306} 313}
307 314
308static int edma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
309 unsigned long arg)
310{
311 int ret = 0;
312 struct dma_slave_config *config;
313 struct edma_chan *echan = to_edma_chan(chan);
314
315 switch (cmd) {
316 case DMA_TERMINATE_ALL:
317 edma_terminate_all(echan);
318 break;
319 case DMA_SLAVE_CONFIG:
320 config = (struct dma_slave_config *)arg;
321 ret = edma_slave_config(echan, config);
322 break;
323 case DMA_PAUSE:
324 ret = edma_dma_pause(echan);
325 break;
326
327 case DMA_RESUME:
328 ret = edma_dma_resume(echan);
329 break;
330
331 default:
332 ret = -ENOSYS;
333 }
334
335 return ret;
336}
337
338/* 315/*
339 * A PaRAM set configuration abstraction used by other modes 316 * A PaRAM set configuration abstraction used by other modes
340 * @chan: Channel who's PaRAM set we're configuring 317 * @chan: Channel who's PaRAM set we're configuring
@@ -1017,7 +994,10 @@ static void edma_dma_init(struct edma_cc *ecc, struct dma_device *dma,
1017 dma->device_free_chan_resources = edma_free_chan_resources; 994 dma->device_free_chan_resources = edma_free_chan_resources;
1018 dma->device_issue_pending = edma_issue_pending; 995 dma->device_issue_pending = edma_issue_pending;
1019 dma->device_tx_status = edma_tx_status; 996 dma->device_tx_status = edma_tx_status;
1020 dma->device_control = edma_control; 997 dma->device_config = edma_slave_config;
998 dma->device_pause = edma_dma_pause;
999 dma->device_resume = edma_dma_resume;
1000 dma->device_terminate_all = edma_terminate_all;
1021 dma->device_slave_caps = edma_dma_device_slave_caps; 1001 dma->device_slave_caps = edma_dma_device_slave_caps;
1022 dma->dev = dev; 1002 dma->dev = dev;
1023 1003