Skip to content

Commit d0f22a3

Browse files
Jan Kuligavinodkoul
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 855c2e1 commit d0f22a3

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

drivers/dma/xilinx/xdma.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -811,21 +811,25 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id)
811811
desc = to_xdma_desc(vd);
812812
xdev = xchan->xdev_hdl;
813813

814+
/* Clear-on-read the status register */
815+
ret = regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_STATUS_RC, &st);
816+
if (ret)
817+
goto out;
818+
819+
st &= XDMA_CHAN_STATUS_MASK;
820+
if ((st & XDMA_CHAN_ERROR_MASK) ||
821+
!(st & (CHAN_CTRL_IE_DESC_COMPLETED | CHAN_CTRL_IE_DESC_STOPPED))) {
822+
xdma_err(xdev, "channel error, status register value: 0x%x", st);
823+
goto out;
824+
}
825+
814826
ret = regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_COMPLETED_DESC,
815827
&complete_desc_num);
816828
if (ret)
817829
goto out;
818830

819831
if (desc->cyclic) {
820832
desc->completed_desc_num = complete_desc_num;
821-
822-
ret = regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_STATUS,
823-
&st);
824-
if (ret)
825-
goto out;
826-
827-
regmap_write(xdev->rmap, xchan->base + XDMA_CHAN_STATUS, st);
828-
829833
vchan_cyclic_callback(vd);
830834
} else {
831835
xchan->busy = false;

0 commit comments

Comments
 (0)