From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
To: Frank Li <Frank.Li@nxp.com>, Vinod Koul <vkoul@kernel.org>,
Angelo Dureghello <angelo@sysam.it>
Cc: Frank Li <Frank.Li@kernel.org>,
imx@lists.linux.dev, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org,
Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Subject: [PATCH v3 4/5] dmaengine: mcf-edma: Fix error handler for all 64 DMA channels
Date: Thu, 25 Jun 2026 10:59:40 +0200 [thread overview]
Message-ID: <20260625-b4-edma-dmaengine-v3-4-44be00ace37d@yoseli.org> (raw)
In-Reply-To: <20260625-b4-edma-dmaengine-v3-0-44be00ace37d@yoseli.org>
Fix the DMA error interrupt handler to properly handle errors on all
64 channels. The previous implementation had several issues:
1. Returned IRQ_NONE if low channels had no errors, even if high
channels did
2. Used direct status assignment instead of fsl_edma_err_chan_handler()
for high channels
Split the error handling into two separate loops for the low (0-31)
and high (32-63) channel groups, using for_each_set_bit() for cleaner
iteration. Both groups now consistently use fsl_edma_err_chan_handler()
for proper error status reporting.
Fixes: e7a3ff92eaf1 ("dmaengine: fsl-edma: add ColdFire mcf5441x edma support")
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
---
drivers/dma/mcf-edma-main.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
index 953b20f99f25..3dab5d475d1b 100644
--- a/drivers/dma/mcf-edma-main.c
+++ b/drivers/dma/mcf-edma-main.c
@@ -42,30 +42,22 @@ static irqreturn_t mcf_edma_err_handler(int irq, void *dev_id)
{
struct fsl_edma_engine *mcf_edma = dev_id;
struct edma_regs *regs = &mcf_edma->regs;
- unsigned int err, ch;
+ unsigned long ch;
+ DECLARE_BITMAP(err_mask, 64);
+ u64 errmap;
- err = ioread32(regs->errl);
- if (!err)
+ errmap = ioread32(regs->errh);
+ errmap <<= 32;
+ errmap |= ioread32(regs->errl);
+ if (!errmap)
return IRQ_NONE;
- for (ch = 0; ch < (EDMA_CHANNELS / 2); ch++) {
- if (err & BIT(ch)) {
- fsl_edma_disable_request(&mcf_edma->chans[ch]);
- iowrite8(EDMA_CERR_CERR(ch), regs->cerr);
- fsl_edma_err_chan_handler(&mcf_edma->chans[ch]);
- }
- }
-
- err = ioread32(regs->errh);
- if (!err)
- return IRQ_NONE;
+ bitmap_from_u64(err_mask, errmap);
- for (ch = (EDMA_CHANNELS / 2); ch < EDMA_CHANNELS; ch++) {
- if (err & (BIT(ch - (EDMA_CHANNELS / 2)))) {
- fsl_edma_disable_request(&mcf_edma->chans[ch]);
- iowrite8(EDMA_CERR_CERR(ch), regs->cerr);
- mcf_edma->chans[ch].status = DMA_ERROR;
- }
+ for_each_set_bit(ch, err_mask, mcf_edma->n_chans) {
+ fsl_edma_disable_request(&mcf_edma->chans[ch]);
+ iowrite8(EDMA_MASK_CH(ch), regs->cerr);
+ fsl_edma_err_chan_handler(&mcf_edma->chans[ch]);
}
return IRQ_HANDLED;
--
2.39.5
next prev parent reply other threads:[~2026-06-25 8:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 8:59 [PATCH v3 0/5] dmaengine: mcf-edma: fix 64-channel handling and modernize IRQ setup Jean-Michel Hautbois
2026-06-25 8:59 ` [PATCH v3 1/5] dmaengine: fsl-edma: Move error handler out of header file Jean-Michel Hautbois
2026-06-25 15:33 ` Frank Li
2026-06-25 8:59 ` [PATCH v3 2/5] dmaengine: fsl-edma: Add FSL_EDMA_DRV_MCF flag for ColdFire eDMA Jean-Michel Hautbois
2026-06-25 15:16 ` Frank Li
2026-06-25 8:59 ` [PATCH v3 3/5] dmaengine: mcf-edma: Fix interrupt handler for 64 DMA channels Jean-Michel Hautbois
2026-06-25 15:30 ` Frank Li
2026-06-25 8:59 ` Jean-Michel Hautbois [this message]
2026-06-25 15:23 ` [PATCH v3 4/5] dmaengine: mcf-edma: Fix error handler for all " Frank Li
2026-06-25 8:59 ` [PATCH v3 5/5] dmaengine: mcf-edma: Use devm for per-channel IRQ registration Jean-Michel Hautbois
2026-06-25 15:26 ` Frank Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260625-b4-edma-dmaengine-v3-4-44be00ace37d@yoseli.org \
--to=jeanmichel.hautbois@yoseli.org \
--cc=Frank.Li@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=angelo@sysam.it \
--cc=dmaengine@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®