aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/shdma.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@stericsson.com>2010-03-26 19:44:01 -0400
committerDan Williams <dan.j.williams@intel.com>2010-03-26 19:44:01 -0400
commitc3635c78e500a52c9fcd55de381a72928d9e054d (patch)
tree87403f402227cd8b5572550e70facf81c9eaa0d9 /drivers/dma/shdma.c
parent0f65169b1bf44220308e1ce1f6666ad03ddc27af (diff)
DMAENGINE: generic slave control v2
Convert the device_terminate_all() operation on the DMA engine to a generic device_control() operation which can now optionally support also pausing and resuming DMA on a certain channel. Implemented for the COH 901 318 DMAC as an example. [dan.j.williams@intel.com: update for timberdale] Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Maciej Sosnowski <maciej.sosnowski@intel.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Li Yang <leoli@freescale.com> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Cc: Magnus Damm <damm@opensource.se> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Cc: Joe Perches <joe@perches.com> Cc: Roland Dreier <rdreier@cisco.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/shdma.c')
-rw-r--r--drivers/dma/shdma.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 5d17e09cb625..ce28c1e22825 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -580,12 +580,16 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
580 direction, flags); 580 direction, flags);
581} 581}
582 582
583static void sh_dmae_terminate_all(struct dma_chan *chan) 583static int sh_dmae_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
584{ 584{
585 struct sh_dmae_chan *sh_chan = to_sh_chan(chan); 585 struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
586 586
587 /* Only supports DMA_TERMINATE_ALL */
588 if (cmd != DMA_TERMINATE_ALL)
589 return -ENXIO;
590
587 if (!chan) 591 if (!chan)
588 return; 592 return -EINVAL;
589 593
590 dmae_halt(sh_chan); 594 dmae_halt(sh_chan);
591 595
@@ -601,6 +605,8 @@ static void sh_dmae_terminate_all(struct dma_chan *chan)
601 spin_unlock_bh(&sh_chan->desc_lock); 605 spin_unlock_bh(&sh_chan->desc_lock);
602 606
603 sh_dmae_chan_ld_cleanup(sh_chan, true); 607 sh_dmae_chan_ld_cleanup(sh_chan, true);
608
609 return 0;
604} 610}
605 611
606static dma_async_tx_callback __ld_cleanup(struct sh_dmae_chan *sh_chan, bool all) 612static dma_async_tx_callback __ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
@@ -1029,7 +1035,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1029 1035
1030 /* Compulsory for DMA_SLAVE fields */ 1036 /* Compulsory for DMA_SLAVE fields */
1031 shdev->common.device_prep_slave_sg = sh_dmae_prep_slave_sg; 1037 shdev->common.device_prep_slave_sg = sh_dmae_prep_slave_sg;
1032 shdev->common.device_terminate_all = sh_dmae_terminate_all; 1038 shdev->common.device_control = sh_dmae_control;
1033 1039
1034 shdev->common.dev = &pdev->dev; 1040 shdev->common.dev = &pdev->dev;
1035 /* Default transfer size of 32 bytes requires 32-byte alignment */ 1041 /* Default transfer size of 32 bytes requires 32-byte alignment */