aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/dw_dmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/dw_dmac.c')
-rw-r--r--drivers/dma/dw_dmac.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index d28369f7afd2..a3991ab0d67e 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -781,13 +781,18 @@ err_desc_get:
781 return NULL; 781 return NULL;
782} 782}
783 783
784static void dwc_terminate_all(struct dma_chan *chan) 784static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
785 unsigned long arg)
785{ 786{
786 struct dw_dma_chan *dwc = to_dw_dma_chan(chan); 787 struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
787 struct dw_dma *dw = to_dw_dma(chan->device); 788 struct dw_dma *dw = to_dw_dma(chan->device);
788 struct dw_desc *desc, *_desc; 789 struct dw_desc *desc, *_desc;
789 LIST_HEAD(list); 790 LIST_HEAD(list);
790 791
792 /* Only supports DMA_TERMINATE_ALL */
793 if (cmd != DMA_TERMINATE_ALL)
794 return -ENXIO;
795
791 /* 796 /*
792 * This is only called when something went wrong elsewhere, so 797 * This is only called when something went wrong elsewhere, so
793 * we don't really care about the data. Just disable the 798 * we don't really care about the data. Just disable the
@@ -810,12 +815,14 @@ static void dwc_terminate_all(struct dma_chan *chan)
810 /* Flush all pending and queued descriptors */ 815 /* Flush all pending and queued descriptors */
811 list_for_each_entry_safe(desc, _desc, &list, desc_node) 816 list_for_each_entry_safe(desc, _desc, &list, desc_node)
812 dwc_descriptor_complete(dwc, desc); 817 dwc_descriptor_complete(dwc, desc);
818
819 return 0;
813} 820}
814 821
815static enum dma_status 822static enum dma_status
816dwc_is_tx_complete(struct dma_chan *chan, 823dwc_tx_status(struct dma_chan *chan,
817 dma_cookie_t cookie, 824 dma_cookie_t cookie,
818 dma_cookie_t *done, dma_cookie_t *used) 825 struct dma_tx_state *txstate)
819{ 826{
820 struct dw_dma_chan *dwc = to_dw_dma_chan(chan); 827 struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
821 dma_cookie_t last_used; 828 dma_cookie_t last_used;
@@ -835,10 +842,7 @@ dwc_is_tx_complete(struct dma_chan *chan,
835 ret = dma_async_is_complete(cookie, last_complete, last_used); 842 ret = dma_async_is_complete(cookie, last_complete, last_used);
836 } 843 }
837 844
838 if (done) 845 dma_set_tx_state(txstate, last_complete, last_used, 0);
839 *done = last_complete;
840 if (used)
841 *used = last_used;
842 846
843 return ret; 847 return ret;
844} 848}
@@ -1338,9 +1342,9 @@ static int __init dw_probe(struct platform_device *pdev)
1338 dw->dma.device_prep_dma_memcpy = dwc_prep_dma_memcpy; 1342 dw->dma.device_prep_dma_memcpy = dwc_prep_dma_memcpy;
1339 1343
1340 dw->dma.device_prep_slave_sg = dwc_prep_slave_sg; 1344 dw->dma.device_prep_slave_sg = dwc_prep_slave_sg;
1341 dw->dma.device_terminate_all = dwc_terminate_all; 1345 dw->dma.device_control = dwc_control;
1342 1346
1343 dw->dma.device_is_tx_complete = dwc_is_tx_complete; 1347 dw->dma.device_tx_status = dwc_tx_status;
1344 dw->dma.device_issue_pending = dwc_issue_pending; 1348 dw->dma.device_issue_pending = dwc_issue_pending;
1345 1349
1346 dma_writel(dw, CFG, DW_CFG_DMA_EN); 1350 dma_writel(dw, CFG, DW_CFG_DMA_EN);