summaryrefslogtreecommitdiff
path: root/drivers/dma/xilinx/xdma.c
diff options
context:
space:
mode:
authorJan Kuliga <jankul@alatek.krakow.pl>2023-12-18 12:39:40 +0100
committerVinod Koul <vkoul@kernel.org>2023-12-22 12:19:41 +0530
commitd0f22a3f55044f91b98e5536aa2c4d51d41cf8e7 (patch)
treed6b4b4f1717f217651b84d5ad9ebc47947264193 /drivers/dma/xilinx/xdma.c
parent855c2e1d1842f0101a051378094548ca581d7a7d (diff)
dmaengine: xilinx: xdma: Add error checking in xdma_channel_isr()
Check and clear the status register value before proceeding any further in xdma_channel_isr(). It is necessary to do it since the interrupt may occur on any error condition enabled at the start of a transfer. Signed-off-by: Jan Kuliga <jankul@alatek.krakow.pl> Link: https://lore.kernel.org/r/20231218113943.9099-6-jankul@alatek.krakow.pl Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/xilinx/xdma.c')
-rw-r--r--drivers/dma/xilinx/xdma.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c
index 0c7350863873..9a1d2939a333 100644
--- a/drivers/dma/xilinx/xdma.c
+++ b/drivers/dma/xilinx/xdma.c
@@ -811,6 +811,18 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id)
desc = to_xdma_desc(vd);
xdev = xchan->xdev_hdl;
+ /* Clear-on-read the status register */
+ ret = regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_STATUS_RC, &st);
+ if (ret)
+ goto out;
+
+ st &= XDMA_CHAN_STATUS_MASK;
+ if ((st & XDMA_CHAN_ERROR_MASK) ||
+ !(st & (CHAN_CTRL_IE_DESC_COMPLETED | CHAN_CTRL_IE_DESC_STOPPED))) {
+ xdma_err(xdev, "channel error, status register value: 0x%x", st);
+ goto out;
+ }
+
ret = regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_COMPLETED_DESC,
&complete_desc_num);
if (ret)
@@ -818,14 +830,6 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id)
if (desc->cyclic) {
desc->completed_desc_num = complete_desc_num;
-
- ret = regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_STATUS,
- &st);
- if (ret)
- goto out;
-
- regmap_write(xdev->rmap, xchan->base + XDMA_CHAN_STATUS, st);
-
vchan_cyclic_callback(vd);
} else {
xchan->busy = false;