aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/cppi41.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/cppi41.c')
-rw-r--r--drivers/dma/cppi41.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index 200828c60db9..d74cee077842 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -79,14 +79,6 @@
79#define QMGR_QUEUE_C(n) (0x2008 + (n) * 0x10) 79#define QMGR_QUEUE_C(n) (0x2008 + (n) * 0x10)
80#define QMGR_QUEUE_D(n) (0x200c + (n) * 0x10) 80#define QMGR_QUEUE_D(n) (0x200c + (n) * 0x10)
81 81
82/* Glue layer specific */
83/* USBSS / USB AM335x */
84#define USBSS_IRQ_STATUS 0x28
85#define USBSS_IRQ_ENABLER 0x2c
86#define USBSS_IRQ_CLEARR 0x30
87
88#define USBSS_IRQ_PD_COMP (1 << 2)
89
90/* Packet Descriptor */ 82/* Packet Descriptor */
91#define PD2_ZERO_LENGTH (1 << 19) 83#define PD2_ZERO_LENGTH (1 << 19)
92 84
@@ -294,14 +286,8 @@ static irqreturn_t cppi41_irq(int irq, void *data)
294{ 286{
295 struct cppi41_dd *cdd = data; 287 struct cppi41_dd *cdd = data;
296 struct cppi41_channel *c; 288 struct cppi41_channel *c;
297 u32 status;
298 int i; 289 int i;
299 290
300 status = cppi_readl(cdd->usbss_mem + USBSS_IRQ_STATUS);
301 if (!(status & USBSS_IRQ_PD_COMP))
302 return IRQ_NONE;
303 cppi_writel(status, cdd->usbss_mem + USBSS_IRQ_STATUS);
304
305 for (i = QMGR_PENDING_SLOT_Q(FIST_COMPLETION_QUEUE); i < QMGR_NUM_PEND; 291 for (i = QMGR_PENDING_SLOT_Q(FIST_COMPLETION_QUEUE); i < QMGR_NUM_PEND;
306 i++) { 292 i++) {
307 u32 val; 293 u32 val;
@@ -618,6 +604,7 @@ static void cppi41_compute_td_desc(struct cppi41_desc *d)
618 604
619static int cppi41_tear_down_chan(struct cppi41_channel *c) 605static int cppi41_tear_down_chan(struct cppi41_channel *c)
620{ 606{
607 struct dmaengine_result abort_result;
621 struct cppi41_dd *cdd = c->cdd; 608 struct cppi41_dd *cdd = c->cdd;
622 struct cppi41_desc *td; 609 struct cppi41_desc *td;
623 u32 reg; 610 u32 reg;
@@ -701,6 +688,12 @@ static int cppi41_tear_down_chan(struct cppi41_channel *c)
701 c->td_seen = 0; 688 c->td_seen = 0;
702 c->td_desc_seen = 0; 689 c->td_desc_seen = 0;
703 cppi_writel(0, c->gcr_reg); 690 cppi_writel(0, c->gcr_reg);
691
692 /* Invoke the callback to do the necessary clean-up */
693 abort_result.result = DMA_TRANS_ABORTED;
694 dma_cookie_complete(&c->txd);
695 dmaengine_desc_get_callback_invoke(&c->txd, &abort_result);
696
704 return 0; 697 return 0;
705} 698}
706 699
@@ -1066,8 +1059,6 @@ static int cppi41_dma_probe(struct platform_device *pdev)
1066 goto err_irq; 1059 goto err_irq;
1067 } 1060 }
1068 1061
1069 cppi_writel(USBSS_IRQ_PD_COMP, cdd->usbss_mem + USBSS_IRQ_ENABLER);
1070
1071 ret = devm_request_irq(&pdev->dev, irq, glue_info->isr, IRQF_SHARED, 1062 ret = devm_request_irq(&pdev->dev, irq, glue_info->isr, IRQF_SHARED,
1072 dev_name(dev), cdd); 1063 dev_name(dev), cdd);
1073 if (ret) 1064 if (ret)
@@ -1091,7 +1082,6 @@ err_of:
1091 dma_async_device_unregister(&cdd->ddev); 1082 dma_async_device_unregister(&cdd->ddev);
1092err_dma_reg: 1083err_dma_reg:
1093err_irq: 1084err_irq:
1094 cppi_writel(0, cdd->usbss_mem + USBSS_IRQ_CLEARR);
1095 cleanup_chans(cdd); 1085 cleanup_chans(cdd);
1096err_chans: 1086err_chans:
1097 deinit_cppi41(dev, cdd); 1087 deinit_cppi41(dev, cdd);
@@ -1119,7 +1109,6 @@ static int cppi41_dma_remove(struct platform_device *pdev)
1119 of_dma_controller_free(pdev->dev.of_node); 1109 of_dma_controller_free(pdev->dev.of_node);
1120 dma_async_device_unregister(&cdd->ddev); 1110 dma_async_device_unregister(&cdd->ddev);
1121 1111
1122 cppi_writel(0, cdd->usbss_mem + USBSS_IRQ_CLEARR);
1123 devm_free_irq(&pdev->dev, cdd->irq, cdd); 1112 devm_free_irq(&pdev->dev, cdd->irq, cdd);
1124 cleanup_chans(cdd); 1113 cleanup_chans(cdd);
1125 deinit_cppi41(&pdev->dev, cdd); 1114 deinit_cppi41(&pdev->dev, cdd);
@@ -1138,7 +1127,6 @@ static int __maybe_unused cppi41_suspend(struct device *dev)
1138 struct cppi41_dd *cdd = dev_get_drvdata(dev); 1127 struct cppi41_dd *cdd = dev_get_drvdata(dev);
1139 1128
1140 cdd->dma_tdfdq = cppi_readl(cdd->ctrl_mem + DMA_TDFDQ); 1129 cdd->dma_tdfdq = cppi_readl(cdd->ctrl_mem + DMA_TDFDQ);
1141 cppi_writel(0, cdd->usbss_mem + USBSS_IRQ_CLEARR);
1142 disable_sched(cdd); 1130 disable_sched(cdd);
1143 1131
1144 return 0; 1132 return 0;
@@ -1164,8 +1152,6 @@ static int __maybe_unused cppi41_resume(struct device *dev)
1164 cppi_writel(QMGR_SCRATCH_SIZE, cdd->qmgr_mem + QMGR_LRAM_SIZE); 1152 cppi_writel(QMGR_SCRATCH_SIZE, cdd->qmgr_mem + QMGR_LRAM_SIZE);
1165 cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE); 1153 cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE);
1166 1154
1167 cppi_writel(USBSS_IRQ_PD_COMP, cdd->usbss_mem + USBSS_IRQ_ENABLER);
1168
1169 return 0; 1155 return 0;
1170} 1156}
1171 1157