aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/shdma.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-05-23 19:52:55 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-05-23 19:52:55 -0400
commit1f782fee18b39b9ad438ebbd82c2915a16c879ee (patch)
treef292930065e6c860714c134790ab8882680ac739 /drivers/dma/shdma.c
parent8eda2f21ed9c936a54fd7bc16cbfa5ee656635c2 (diff)
parentf4b87dee923342505e1ddba8d34ce9de33e75050 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/dma/shdma.c')
-rw-r--r--drivers/dma/shdma.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index c2b0172a7589..a2585c90a139 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -597,12 +597,17 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
597 direction, flags); 597 direction, flags);
598} 598}
599 599
600static void sh_dmae_terminate_all(struct dma_chan *chan) 600static int sh_dmae_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
601 unsigned long arg)
601{ 602{
602 struct sh_dmae_chan *sh_chan = to_sh_chan(chan); 603 struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
603 604
605 /* Only supports DMA_TERMINATE_ALL */
606 if (cmd != DMA_TERMINATE_ALL)
607 return -ENXIO;
608
604 if (!chan) 609 if (!chan)
605 return; 610 return -EINVAL;
606 611
607 dmae_halt(sh_chan); 612 dmae_halt(sh_chan);
608 613
@@ -618,6 +623,8 @@ static void sh_dmae_terminate_all(struct dma_chan *chan)
618 spin_unlock_bh(&sh_chan->desc_lock); 623 spin_unlock_bh(&sh_chan->desc_lock);
619 624
620 sh_dmae_chan_ld_cleanup(sh_chan, true); 625 sh_dmae_chan_ld_cleanup(sh_chan, true);
626
627 return 0;
621} 628}
622 629
623static dma_async_tx_callback __ld_cleanup(struct sh_dmae_chan *sh_chan, bool all) 630static dma_async_tx_callback __ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
@@ -749,10 +756,9 @@ static void sh_dmae_memcpy_issue_pending(struct dma_chan *chan)
749 sh_chan_xfer_ld_queue(sh_chan); 756 sh_chan_xfer_ld_queue(sh_chan);
750} 757}
751 758
752static enum dma_status sh_dmae_is_complete(struct dma_chan *chan, 759static enum dma_status sh_dmae_tx_status(struct dma_chan *chan,
753 dma_cookie_t cookie, 760 dma_cookie_t cookie,
754 dma_cookie_t *done, 761 struct dma_tx_state *txstate)
755 dma_cookie_t *used)
756{ 762{
757 struct sh_dmae_chan *sh_chan = to_sh_chan(chan); 763 struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
758 dma_cookie_t last_used; 764 dma_cookie_t last_used;
@@ -764,12 +770,7 @@ static enum dma_status sh_dmae_is_complete(struct dma_chan *chan,
764 last_used = chan->cookie; 770 last_used = chan->cookie;
765 last_complete = sh_chan->completed_cookie; 771 last_complete = sh_chan->completed_cookie;
766 BUG_ON(last_complete < 0); 772 BUG_ON(last_complete < 0);
767 773 dma_set_tx_state(txstate, last_complete, last_used, 0);
768 if (done)
769 *done = last_complete;
770
771 if (used)
772 *used = last_used;
773 774
774 spin_lock_bh(&sh_chan->desc_lock); 775 spin_lock_bh(&sh_chan->desc_lock);
775 776
@@ -1041,12 +1042,12 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1041 = sh_dmae_alloc_chan_resources; 1042 = sh_dmae_alloc_chan_resources;
1042 shdev->common.device_free_chan_resources = sh_dmae_free_chan_resources; 1043 shdev->common.device_free_chan_resources = sh_dmae_free_chan_resources;
1043 shdev->common.device_prep_dma_memcpy = sh_dmae_prep_memcpy; 1044 shdev->common.device_prep_dma_memcpy = sh_dmae_prep_memcpy;
1044 shdev->common.device_is_tx_complete = sh_dmae_is_complete; 1045 shdev->common.device_tx_status = sh_dmae_tx_status;
1045 shdev->common.device_issue_pending = sh_dmae_memcpy_issue_pending; 1046 shdev->common.device_issue_pending = sh_dmae_memcpy_issue_pending;
1046 1047
1047 /* Compulsory for DMA_SLAVE fields */ 1048 /* Compulsory for DMA_SLAVE fields */
1048 shdev->common.device_prep_slave_sg = sh_dmae_prep_slave_sg; 1049 shdev->common.device_prep_slave_sg = sh_dmae_prep_slave_sg;
1049 shdev->common.device_terminate_all = sh_dmae_terminate_all; 1050 shdev->common.device_control = sh_dmae_control;
1050 1051
1051 shdev->common.dev = &pdev->dev; 1052 shdev->common.dev = &pdev->dev;
1052 /* Default transfer size of 32 bytes requires 32-byte alignment */ 1053 /* Default transfer size of 32 bytes requires 32-byte alignment */