dmaengine: dw: don't perform DMA when dmaengine_submit is called
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 18 Jun 2014 09:15:38 +0000 (12:15 +0300)
committerVinod Koul <vinod.koul@intel.com>
Tue, 15 Jul 2014 16:44:30 +0000 (22:14 +0530)
Accordingly to discussion [1] and followed up documentation the DMA controller
driver shouldn't start any DMA operations when dmaengine_submit() is called.

This patch fixes the workflow in dw_dmac driver to follow the documentation.

[1] http://www.spinics.net/lists/arm-kernel/msg125987.html

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/TODO
drivers/dma/dw/core.c

index 734ed0206cd5ead8f9cc554e94ff168b59fc3dae..b8045cd42ee13f67bf54169443b8b61a83062e36 100644 (file)
@@ -7,7 +7,6 @@ TODO for slave dma
        - imx-dma
        - imx-sdma
        - mxs-dma.c
-       - dw_dmac
        - intel_mid_dma
 4. Check other subsystems for dma drivers and merge/move to dmaengine
 5. Remove dma_slave_config's dma direction.
index 52815b905b7c9c8e79f5f625b4d54477d9d747d1..1af731b83b3f56f284fd5655f85d90cda09bf2ca 100644 (file)
@@ -684,17 +684,9 @@ static dma_cookie_t dwc_tx_submit(struct dma_async_tx_descriptor *tx)
         * possible, perhaps even appending to those already submitted
         * for DMA. But this is hard to do in a race-free manner.
         */
-       if (list_empty(&dwc->active_list)) {
-               dev_vdbg(chan2dev(tx->chan), "%s: started %u\n", __func__,
-                               desc->txd.cookie);
-               list_add_tail(&desc->desc_node, &dwc->active_list);
-               dwc_dostart(dwc, dwc_first_active(dwc));
-       } else {
-               dev_vdbg(chan2dev(tx->chan), "%s: queued %u\n", __func__,
-                               desc->txd.cookie);
 
-               list_add_tail(&desc->desc_node, &dwc->queue);
-       }
+       dev_vdbg(chan2dev(tx->chan), "%s: queued %u\n", __func__, desc->txd.cookie);
+       list_add_tail(&desc->desc_node, &dwc->queue);
 
        spin_unlock_irqrestore(&dwc->lock, flags);
 
@@ -1099,9 +1091,12 @@ dwc_tx_status(struct dma_chan *chan,
 static void dwc_issue_pending(struct dma_chan *chan)
 {
        struct dw_dma_chan      *dwc = to_dw_dma_chan(chan);
+       unsigned long           flags;
 
-       if (!list_empty(&dwc->queue))
-               dwc_scan_descriptors(to_dw_dma(chan->device), dwc);
+       spin_lock_irqsave(&dwc->lock, flags);
+       if (list_empty(&dwc->active_list))
+               dwc_dostart_first_queued(dwc);
+       spin_unlock_irqrestore(&dwc->lock, flags);
 }
 
 static int dwc_alloc_chan_resources(struct dma_chan *chan)