[PATCH 06/11] dmaengine: dw-axi-dmac: move ch irq handling into common routine
From: Jisheng Zhang
Date: Mon Mar 13 2023 - 13:23:54 EST
In next patch, we will add per-channel irq support, we will use the
common routine in per-channel irq handler.
Signed-off-by: Jisheng Zhang <jszhang@xxxxxxxxxx>
---
.../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 30 ++++++++++++-------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index 6087fb7d567a..796fd0136781 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -1101,13 +1101,30 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)
spin_unlock_irqrestore(&chan->vc.lock, flags);
}
+static void dw_axi_dma_handle_ch(struct axi_dma_chan *chan)
+{
+ u32 status;
+
+ /* Poll, clear and process this channel interrupt status */
+ status = axi_chan_irq_read(chan);
+ axi_chan_irq_clear(chan, status);
+
+ dev_vdbg(chan->chip->dev, "%s IRQ status: 0x%08x\n", axi_chan_name(chan), status);
+
+ if (status & DWAXIDMAC_IRQ_ALL_ERR)
+ axi_chan_handle_err(chan, status);
+ else if (status & DWAXIDMAC_IRQ_DMA_TRF)
+ axi_chan_block_xfer_complete(chan);
+
+}
+
static irqreturn_t dw_axi_dma_interrupt(int irq, void *dev_id)
{
struct axi_dma_chip *chip = dev_id;
struct dw_axi_dma *dw = chip->dw;
struct axi_dma_chan *chan;
- u32 status, i;
+ u32 i;
/* Disable DMAC interrupts. We'll enable them after processing channels */
axi_dma_irq_disable(chip);
@@ -1115,16 +1132,7 @@ static irqreturn_t dw_axi_dma_interrupt(int irq, void *dev_id)
/* Poll, clear and process every channel interrupt status */
for (i = 0; i < dw->hdata->nr_channels; i++) {
chan = &dw->chan[i];
- status = axi_chan_irq_read(chan);
- axi_chan_irq_clear(chan, status);
-
- dev_vdbg(chip->dev, "%s %u IRQ status: 0x%08x\n",
- axi_chan_name(chan), i, status);
-
- if (status & DWAXIDMAC_IRQ_ALL_ERR)
- axi_chan_handle_err(chan, status);
- else if (status & DWAXIDMAC_IRQ_DMA_TRF)
- axi_chan_block_xfer_complete(chan);
+ dw_axi_dma_handle_ch(chan);
}
/* Re-enable interrupts */
--
2.39.2