From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
To: Frank Li <Frank.Li@nxp.com>, Vinod Koul <vkoul@kernel.org>
Cc: Greg Ungerer <gerg@linux-m68k.org>,
imx@lists.linux.dev, dmaengine@vger.kernel.org,
linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Subject: [PATCH 2/7] dma: fsl-edma: Add FSL_EDMA_DRV_MCF flag for ColdFire eDMA
Date: Mon, 24 Nov 2025 13:50:23 +0100 [thread overview]
Message-ID: <20251124-dma-coldfire-v1-2-dc8f93185464@yoseli.org> (raw)
In-Reply-To: <20251124-dma-coldfire-v1-0-dc8f93185464@yoseli.org>
Add FSL_EDMA_DRV_MCF driver flag to identify MCF ColdFire eDMA
controllers which have a native M68K register layout.
The edma_writeb() function applies an XOR ^ 0x3 byte-lane adjustment for
big-endian eDMA controllers where byte registers within a 32-bit word
need address correction.
However, the MCF54418 eDMA 8-bit registers (SERQ, CERQ, SEEI, CEEI,
CINT, CERR, SSRT, CDNE) are located at sequential byte addresses
(0x4018-0x401F) as documented in the MCF54418 Reference Manual Table
19-2. No byte-lane adjustment is needed, as applying the XOR causes
writes to target incorrect registers (writing to CERR at 0x401D would
actually access SSRT at 0x401E).
Set this flag in the MCF eDMA driver to bypass the XOR adjustment and
access registers at their documented addresses.
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
---
drivers/dma/fsl-edma-common.h | 5 ++++-
drivers/dma/mcf-edma-main.c | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index 205a96489094805aa728b72a51ae101cd88fa003..4c86f2f39c1db9a812245fe85755ec8d1169c44c 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -225,6 +225,8 @@ struct fsl_edma_desc {
#define FSL_EDMA_DRV_TCD64 BIT(15)
/* All channel ERR IRQ share one IRQ line */
#define FSL_EDMA_DRV_ERRIRQ_SHARE BIT(16)
+/* MCF eDMA: Different register layout, no XOR for byte access */
+#define FSL_EDMA_DRV_MCF BIT(17)
#define FSL_EDMA_DRV_EDMA3 (FSL_EDMA_DRV_SPLIT_REG | \
@@ -419,7 +421,8 @@ static inline void edma_writeb(struct fsl_edma_engine *edma,
u8 val, void __iomem *addr)
{
/* swap the reg offset for these in big-endian mode */
- if (edma->big_endian)
+ /* MCF eDMA has different register layout, no XOR needed */
+ if (edma->big_endian && !(edma->drvdata->flags & FSL_EDMA_DRV_MCF))
iowrite8(val, (void __iomem *)((unsigned long)addr ^ 0x3));
else
iowrite8(val, addr);
diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
index 9e1c6400c77be237684855759382d7b7bd2e6ea0..f95114829d8006fe4558169888ff38037d7610de 100644
--- a/drivers/dma/mcf-edma-main.c
+++ b/drivers/dma/mcf-edma-main.c
@@ -145,7 +145,7 @@ static void mcf_edma_irq_free(struct platform_device *pdev,
}
static struct fsl_edma_drvdata mcf_data = {
- .flags = FSL_EDMA_DRV_EDMA64,
+ .flags = FSL_EDMA_DRV_EDMA64 | FSL_EDMA_DRV_MCF,
.setup_irq = mcf_edma_irq_init,
};
--
2.39.5
next prev parent reply other threads:[~2025-11-24 12:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 12:50 [PATCH 0/7] dma: fsl/mcf-edma: Bug fixes and enhancements for ColdFire support Jean-Michel Hautbois
2025-11-24 12:50 ` [PATCH 1/7] dma: fsl-edma: Add write barrier after TCD descriptor fill Jean-Michel Hautbois
2025-11-24 15:57 ` Frank Li
2025-11-25 8:18 ` Jean-Michel Hautbois
2025-11-24 12:50 ` Jean-Michel Hautbois [this message]
2025-11-24 16:03 ` [PATCH 2/7] dma: fsl-edma: Add FSL_EDMA_DRV_MCF flag for ColdFire eDMA Frank Li
2025-11-24 12:50 ` [PATCH 3/7] dma: mcf-edma: Add per-channel IRQ naming for debugging Jean-Michel Hautbois
2025-11-24 13:05 ` Geert Uytterhoeven
2025-11-25 8:35 ` kernel test robot
2025-11-25 12:06 ` kernel test robot
2025-11-24 12:50 ` [PATCH 4/7] dma: mcf-edma: Fix interrupt handler for 64 DMA channels Jean-Michel Hautbois
2025-11-24 16:09 ` Frank Li
2025-11-25 8:02 ` Jean-Michel Hautbois
2025-11-25 16:14 ` Frank Li
2025-11-24 12:50 ` [PATCH 5/7] dma: fsl-edma: Move error handler out of header file Jean-Michel Hautbois
2025-11-24 16:10 ` Frank Li
2025-11-24 12:50 ` [PATCH 6/7] dma: mcf-edma: Fix error handler for all 64 DMA channels Jean-Michel Hautbois
2025-11-24 16:16 ` Frank Li
2025-11-24 12:50 ` [PATCH 7/7] dma: fsl-edma: Support source stride for interleaved DMA transfers Jean-Michel Hautbois
2025-11-24 16:29 ` 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=20251124-dma-coldfire-v1-2-dc8f93185464@yoseli.org \
--to=jeanmichel.hautbois@yoseli.org \
--cc=Frank.Li@nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=gerg@linux-m68k.org \
--cc=imx@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.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