aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/edma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/edma.c')
-rw-r--r--drivers/dma/edma.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index b512caf46944..7b65633f495e 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -23,6 +23,7 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/of.h>
26 27
27#include <linux/platform_data/edma.h> 28#include <linux/platform_data/edma.h>
28 29
@@ -256,8 +257,13 @@ static int edma_terminate_all(struct edma_chan *echan)
256 * echan->edesc is NULL and exit.) 257 * echan->edesc is NULL and exit.)
257 */ 258 */
258 if (echan->edesc) { 259 if (echan->edesc) {
260 int cyclic = echan->edesc->cyclic;
259 echan->edesc = NULL; 261 echan->edesc = NULL;
260 edma_stop(echan->ch_num); 262 edma_stop(echan->ch_num);
263 /* Move the cyclic channel back to default queue */
264 if (cyclic)
265 edma_assign_channel_eventq(echan->ch_num,
266 EVENTQ_DEFAULT);
261 } 267 }
262 268
263 vchan_get_all_descriptors(&echan->vchan, &head); 269 vchan_get_all_descriptors(&echan->vchan, &head);
@@ -592,7 +598,7 @@ struct dma_async_tx_descriptor *edma_prep_dma_memcpy(
592static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( 598static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
593 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 599 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
594 size_t period_len, enum dma_transfer_direction direction, 600 size_t period_len, enum dma_transfer_direction direction,
595 unsigned long tx_flags, void *context) 601 unsigned long tx_flags)
596{ 602{
597 struct edma_chan *echan = to_edma_chan(chan); 603 struct edma_chan *echan = to_edma_chan(chan);
598 struct device *dev = chan->device->dev; 604 struct device *dev = chan->device->dev;
@@ -718,12 +724,15 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
718 edesc->absync = ret; 724 edesc->absync = ret;
719 725
720 /* 726 /*
721 * Enable interrupts for every period because callback 727 * Enable period interrupt only if it is requested
722 * has to be called for every period.
723 */ 728 */
724 edesc->pset[i].param.opt |= TCINTEN; 729 if (tx_flags & DMA_PREP_INTERRUPT)
730 edesc->pset[i].param.opt |= TCINTEN;
725 } 731 }
726 732
733 /* Place the cyclic channel to highest priority queue */
734 edma_assign_channel_eventq(echan->ch_num, EVENTQ_0);
735
727 return vchan_tx_prep(&echan->vchan, &edesc->vdesc, tx_flags); 736 return vchan_tx_prep(&echan->vchan, &edesc->vdesc, tx_flags);
728} 737}
729 738
@@ -993,7 +1002,7 @@ static int edma_dma_device_slave_caps(struct dma_chan *dchan,
993 caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); 1002 caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
994 caps->cmd_pause = true; 1003 caps->cmd_pause = true;
995 caps->cmd_terminate = true; 1004 caps->cmd_terminate = true;
996 caps->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR; 1005 caps->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
997 1006
998 return 0; 1007 return 0;
999} 1008}
@@ -1040,7 +1049,7 @@ static int edma_probe(struct platform_device *pdev)
1040 ecc->dummy_slot = edma_alloc_slot(ecc->ctlr, EDMA_SLOT_ANY); 1049 ecc->dummy_slot = edma_alloc_slot(ecc->ctlr, EDMA_SLOT_ANY);
1041 if (ecc->dummy_slot < 0) { 1050 if (ecc->dummy_slot < 0) {
1042 dev_err(&pdev->dev, "Can't allocate PaRAM dummy slot\n"); 1051 dev_err(&pdev->dev, "Can't allocate PaRAM dummy slot\n");
1043 return -EIO; 1052 return ecc->dummy_slot;
1044 } 1053 }
1045 1054
1046 dma_cap_zero(ecc->dma_slave.cap_mask); 1055 dma_cap_zero(ecc->dma_slave.cap_mask);
@@ -1125,7 +1134,7 @@ static int edma_init(void)
1125 } 1134 }
1126 } 1135 }
1127 1136
1128 if (EDMA_CTLRS == 2) { 1137 if (!of_have_populated_dt() && EDMA_CTLRS == 2) {
1129 pdev1 = platform_device_register_full(&edma_dev_info1); 1138 pdev1 = platform_device_register_full(&edma_dev_info1);
1130 if (IS_ERR(pdev1)) { 1139 if (IS_ERR(pdev1)) {
1131 platform_driver_unregister(&edma_driver); 1140 platform_driver_unregister(&edma_driver);