DMA Engine development
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs
@ 2024-12-19 10:24 Larisa Grigore
  2024-12-19 10:24 ` [PATCH v3 1/5] dmaengine: fsl-edma: select of_dma_xlate based on the dmamuxs presence Larisa Grigore
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Larisa Grigore @ 2024-12-19 10:24 UTC (permalink / raw)
  To: Frank Li, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Peng Fan
  Cc: imx, dmaengine, devicetree, linux-kernel, s32, Christophe Lizzi,
	Alberto Ruiz, Enric Balletbo, Larisa Grigore

S32G2 and S32G3 SoCs share the eDMAv3 module with i.MX SoCs, with some hardware
integration particularities.

S32G2/S32G3 includes two system eDMA instances based on v3 version, each of
them integrated with 2 DMAMUX blocks.
Another particularity of these SoCs is that the interrupts are shared between
channels as follows:
- DMA Channels 0-15 share the 'tx-0-15' interrupt
- DMA Channels 16-31 share the 'tx-16-31' interrupt
- all channels share the 'err' interrupt

Changes in V3:
- Added changelog.

Changes in V2:
- Added new lines in commit description.
- Added "Reviewed-by" tag where received.
- Removed the three commits:
"dmaengine: fsl-edma: move eDMAv2 related registers to a new structure ’edma2_regs’"
"dmaengine: fsl-edma: add eDMAv3 registers to edma_regs"
"dmaengine: fsl-edma: wait until no hardware request is in progress".
I will send a different patchset for them.

Larisa Grigore (5):
  dmaengine: fsl-edma: select of_dma_xlate based on the dmamuxs presence
  dmaengine: fsl-edma: remove FSL_EDMA_DRV_SPLIT_REG check when parsing
    muxbase
  dt-bindings: dma: fsl-edma: add nxp,s32g2-edma compatible string
  dmaengine: fsl-edma: add support for S32G based platforms
  dmaengine: fsl-edma: read/write multiple registers in cyclic
    transactions

 .../devicetree/bindings/dma/fsl,edma.yaml     |  34 ++++++
 drivers/dma/fsl-edma-common.c                 |  36 ++++--
 drivers/dma/fsl-edma-common.h                 |   3 +
 drivers/dma/fsl-edma-main.c                   | 115 +++++++++++++++++-
 4 files changed, 173 insertions(+), 15 deletions(-)

-- 
2.47.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/5] dmaengine: fsl-edma: select of_dma_xlate based on the dmamuxs presence
  2024-12-19 10:24 [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Larisa Grigore
@ 2024-12-19 10:24 ` Larisa Grigore
  2024-12-19 10:24 ` [PATCH v3 2/5] dmaengine: fsl-edma: remove FSL_EDMA_DRV_SPLIT_REG check when parsing muxbase Larisa Grigore
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Larisa Grigore @ 2024-12-19 10:24 UTC (permalink / raw)
  To: Frank Li, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Peng Fan
  Cc: imx, dmaengine, devicetree, linux-kernel, s32, Christophe Lizzi,
	Alberto Ruiz, Enric Balletbo, Larisa Grigore

Select the of_dma_xlate function based on the dmamuxs definition rather
than the FSL_EDMA_DRV_SPLIT_REG flag, which pertains to the eDMA3
layout.

This change is a prerequisite for the S32G platforms, which integrate both
eDMAv3 and DMAMUX.

Existing platforms with FSL_EDMA_DRV_SPLIT_REG will not be impacted, as
they all have dmamuxs set to zero.

Signed-off-by: Larisa Grigore <larisa.grigore@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/dma/fsl-edma-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 60de1003193a..2a7d19f51287 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -646,7 +646,7 @@ static int fsl_edma_probe(struct platform_device *pdev)
 	}
 
 	ret = of_dma_controller_register(np,
-			drvdata->flags & FSL_EDMA_DRV_SPLIT_REG ? fsl_edma3_xlate : fsl_edma_xlate,
+			drvdata->dmamuxs ? fsl_edma_xlate : fsl_edma3_xlate,
 			fsl_edma);
 	if (ret) {
 		dev_err(&pdev->dev,
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/5] dmaengine: fsl-edma: remove FSL_EDMA_DRV_SPLIT_REG check when parsing muxbase
  2024-12-19 10:24 [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Larisa Grigore
  2024-12-19 10:24 ` [PATCH v3 1/5] dmaengine: fsl-edma: select of_dma_xlate based on the dmamuxs presence Larisa Grigore
@ 2024-12-19 10:24 ` Larisa Grigore
  2024-12-19 10:24 ` [PATCH v3 3/5] dt-bindings: dma: fsl-edma: add nxp,s32g2-edma compatible string Larisa Grigore
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Larisa Grigore @ 2024-12-19 10:24 UTC (permalink / raw)
  To: Frank Li, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Peng Fan
  Cc: imx, dmaengine, devicetree, linux-kernel, s32, Christophe Lizzi,
	Alberto Ruiz, Enric Balletbo, Larisa Grigore

Clean up dead code. dmamuxs is always 0 when FSL_EDMA_DRV_SPLIT_REG set. So
it is redundant to check FSL_EDMA_DRV_SPLIT_REG again in the for loop
because it will never enter for loop.

Signed-off-by: Larisa Grigore <larisa.grigore@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/dma/fsl-edma-main.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 2a7d19f51287..9873cce00c68 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -517,10 +517,6 @@ static int fsl_edma_probe(struct platform_device *pdev)
 	for (i = 0; i < fsl_edma->drvdata->dmamuxs; i++) {
 		char clkname[32];
 
-		/* eDMAv3 mux register move to TCD area if ch_mux exist */
-		if (drvdata->flags & FSL_EDMA_DRV_SPLIT_REG)
-			break;
-
 		fsl_edma->muxbase[i] = devm_platform_ioremap_resource(pdev,
 								      1 + i);
 		if (IS_ERR(fsl_edma->muxbase[i])) {
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/5] dt-bindings: dma: fsl-edma: add nxp,s32g2-edma compatible string
  2024-12-19 10:24 [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Larisa Grigore
  2024-12-19 10:24 ` [PATCH v3 1/5] dmaengine: fsl-edma: select of_dma_xlate based on the dmamuxs presence Larisa Grigore
  2024-12-19 10:24 ` [PATCH v3 2/5] dmaengine: fsl-edma: remove FSL_EDMA_DRV_SPLIT_REG check when parsing muxbase Larisa Grigore
@ 2024-12-19 10:24 ` Larisa Grigore
  2024-12-19 19:46   ` Conor Dooley
  2024-12-19 10:24 ` [PATCH v3 4/5] dmaengine: fsl-edma: add support for S32G based platforms Larisa Grigore
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Larisa Grigore @ 2024-12-19 10:24 UTC (permalink / raw)
  To: Frank Li, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Peng Fan
  Cc: imx, dmaengine, devicetree, linux-kernel, s32, Christophe Lizzi,
	Alberto Ruiz, Enric Balletbo, Larisa Grigore

Introduce the compatible strings 'nxp,s32g2-edma' and 'nxp,s32g3-edma' to
enable the support for the eDMAv3 present on S32G2/S32G3 platforms.

The S32G2/S32G3 eDMA architecture features 32 DMA channels. Each of the
two eDMA instances is integrated with two DMAMUX blocks.

Another particularity of these SoCs is that the interrupts are shared
between channels in the following way:
- DMA Channels 0-15 share the 'tx-0-15' interrupt
- DMA Channels 16-31 share the 'tx-16-31' interrupt
- all channels share the 'err' interrupt

Signed-off-by: Larisa Grigore <larisa.grigore@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 .../devicetree/bindings/dma/fsl,edma.yaml     | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
index d54140f18d34..4f925469533e 100644
--- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
+++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
@@ -26,9 +26,13 @@ properties:
           - fsl,imx93-edma3
           - fsl,imx93-edma4
           - fsl,imx95-edma5
+          - nxp,s32g2-edma
       - items:
           - const: fsl,ls1028a-edma
           - const: fsl,vf610-edma
+      - items:
+          - const: nxp,s32g3-edma
+          - const: nxp,s32g2-edma
 
   reg:
     minItems: 1
@@ -221,6 +225,36 @@ allOf:
       properties:
         power-domains: false
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,s32g2-edma
+    then:
+      properties:
+        clocks:
+          minItems: 2
+          maxItems: 2
+        clock-names:
+          items:
+            - const: dmamux0
+            - const: dmamux1
+        interrupts:
+          minItems: 3
+          maxItems: 3
+        interrupt-names:
+          items:
+            - const: tx-0-15
+            - const: tx-16-31
+            - const: err
+        reg:
+          minItems: 3
+          maxItems: 3
+        "#dma-cells":
+          const: 2
+        dma-channels:
+          const: 32
+
 unevaluatedProperties: false
 
 examples:
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 4/5] dmaengine: fsl-edma: add support for S32G based platforms
  2024-12-19 10:24 [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Larisa Grigore
                   ` (2 preceding siblings ...)
  2024-12-19 10:24 ` [PATCH v3 3/5] dt-bindings: dma: fsl-edma: add nxp,s32g2-edma compatible string Larisa Grigore
@ 2024-12-19 10:24 ` Larisa Grigore
  2024-12-19 10:24 ` [PATCH v3 5/5] dmaengine: fsl-edma: read/write multiple registers in cyclic transactions Larisa Grigore
  2024-12-24 10:42 ` [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Vinod Koul
  5 siblings, 0 replies; 8+ messages in thread
From: Larisa Grigore @ 2024-12-19 10:24 UTC (permalink / raw)
  To: Frank Li, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Peng Fan
  Cc: imx, dmaengine, devicetree, linux-kernel, s32, Christophe Lizzi,
	Alberto Ruiz, Enric Balletbo, Larisa Grigore,
	Ciprian Marian Costea

S32G2/S32G3 includes two system eDMA instances based on v3 version, each of
them integrated with two DMAMUX blocks.

Another particularity of these SoCs is that the interrupts are shared
between channels as follows:
- DMA Channels 0-15 share the 'tx-0-15' interrupt
- DMA Channels 16-31 share the 'tx-16-31' interrupt
- all channels share the 'err' interrupt

Signed-off-by: Larisa Grigore <larisa.grigore@oss.nxp.com>
Co-developed-by: Ciprian Marian Costea <ciprianmarian.costea@nxp.com>
Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/dma/fsl-edma-common.h |   3 +
 drivers/dma/fsl-edma-main.c   | 109 +++++++++++++++++++++++++++++++++-
 2 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index ce37e1ee9c46..707fea4139b6 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -68,6 +68,8 @@
 #define EDMA_V3_CH_CSR_EEI         BIT(2)
 #define EDMA_V3_CH_CSR_DONE        BIT(30)
 #define EDMA_V3_CH_CSR_ACTIVE      BIT(31)
+#define EDMA_V3_CH_ES_ERR          BIT(31)
+#define EDMA_V3_MP_ES_VLD          BIT(31)
 
 enum fsl_edma_pm_state {
 	RUNNING = 0,
@@ -240,6 +242,7 @@ struct fsl_edma_engine {
 	const struct fsl_edma_drvdata *drvdata;
 	u32			n_chans;
 	int			txirq;
+	int			txirq_16_31;
 	int			errirq;
 	bool			big_endian;
 	struct edma_regs	regs;
diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 9873cce00c68..c9e3252d0da0 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -3,10 +3,11 @@
  * drivers/dma/fsl-edma.c
  *
  * Copyright 2013-2014 Freescale Semiconductor, Inc.
+ * Copyright 2024 NXP
  *
  * Driver for the Freescale eDMA engine with flexible channel multiplexing
  * capability for DMA request sources. The eDMA block can be found on some
- * Vybrid and Layerscape SoCs.
+ * Vybrid, Layerscape and S32G SoCs.
  */
 
 #include <dt-bindings/dma/fsl-edma.h>
@@ -72,6 +73,60 @@ static irqreturn_t fsl_edma2_tx_handler(int irq, void *devi_id)
 	return fsl_edma_tx_handler(irq, fsl_chan->edma);
 }
 
+static irqreturn_t fsl_edma3_or_tx_handler(int irq, void *dev_id,
+					   u8 start, u8 end)
+{
+	struct fsl_edma_engine *fsl_edma = dev_id;
+	struct fsl_edma_chan *chan;
+	int i;
+
+	end = min(end, fsl_edma->n_chans);
+
+	for (i = start; i < end; i++) {
+		chan = &fsl_edma->chans[i];
+
+		fsl_edma3_tx_handler(irq, chan);
+	}
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t fsl_edma3_tx_0_15_handler(int irq, void *dev_id)
+{
+	return fsl_edma3_or_tx_handler(irq, dev_id, 0, 16);
+}
+
+static irqreturn_t fsl_edma3_tx_16_31_handler(int irq, void *dev_id)
+{
+	return fsl_edma3_or_tx_handler(irq, dev_id, 16, 32);
+}
+
+static irqreturn_t fsl_edma3_or_err_handler(int irq, void *dev_id)
+{
+	struct fsl_edma_engine *fsl_edma = dev_id;
+	struct edma_regs *regs = &fsl_edma->regs;
+	unsigned int err, ch, ch_es;
+	struct fsl_edma_chan *chan;
+
+	err = edma_readl(fsl_edma, regs->es);
+	if (!(err & EDMA_V3_MP_ES_VLD))
+		return IRQ_NONE;
+
+	for (ch = 0; ch < fsl_edma->n_chans; ch++) {
+		chan = &fsl_edma->chans[ch];
+
+		ch_es = edma_readl_chreg(chan, ch_es);
+		if (!(ch_es & EDMA_V3_CH_ES_ERR))
+			continue;
+
+		edma_writel_chreg(chan, EDMA_V3_CH_ES_ERR, ch_es);
+		fsl_edma_disable_request(chan);
+		fsl_edma->chans[ch].status = DMA_ERROR;
+	}
+
+	return IRQ_HANDLED;
+}
+
 static irqreturn_t fsl_edma_err_handler(int irq, void *dev_id)
 {
 	struct fsl_edma_engine *fsl_edma = dev_id;
@@ -274,6 +329,49 @@ static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engi
 	return 0;
 }
 
+static int fsl_edma3_or_irq_init(struct platform_device *pdev,
+				 struct fsl_edma_engine *fsl_edma)
+{
+	int ret;
+
+	fsl_edma->txirq = platform_get_irq_byname(pdev, "tx-0-15");
+	if (fsl_edma->txirq < 0)
+		return fsl_edma->txirq;
+
+	fsl_edma->txirq_16_31 = platform_get_irq_byname(pdev, "tx-16-31");
+	if (fsl_edma->txirq_16_31 < 0)
+		return fsl_edma->txirq_16_31;
+
+	fsl_edma->errirq = platform_get_irq_byname(pdev, "err");
+	if (fsl_edma->errirq < 0)
+		return fsl_edma->errirq;
+
+	ret = devm_request_irq(&pdev->dev, fsl_edma->txirq,
+			       fsl_edma3_tx_0_15_handler, 0, "eDMA tx0_15",
+			       fsl_edma);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+			       "Can't register eDMA tx0_15 IRQ.\n");
+
+	if (fsl_edma->n_chans > 16) {
+		ret = devm_request_irq(&pdev->dev, fsl_edma->txirq_16_31,
+				       fsl_edma3_tx_16_31_handler, 0,
+				       "eDMA tx16_31", fsl_edma);
+		if (ret)
+			return dev_err_probe(&pdev->dev, ret,
+					"Can't register eDMA tx16_31 IRQ.\n");
+	}
+
+	ret = devm_request_irq(&pdev->dev, fsl_edma->errirq,
+			       fsl_edma3_or_err_handler, 0, "eDMA err",
+			       fsl_edma);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "Can't register eDMA err IRQ.\n");
+
+	return 0;
+}
+
 static int
 fsl_edma2_irq_init(struct platform_device *pdev,
 		   struct fsl_edma_engine *fsl_edma)
@@ -404,6 +502,14 @@ static struct fsl_edma_drvdata imx95_data5 = {
 	.setup_irq = fsl_edma3_irq_init,
 };
 
+static const struct fsl_edma_drvdata s32g2_data = {
+	.dmamuxs = DMAMUX_NR,
+	.chreg_space_sz = EDMA_TCD,
+	.chreg_off = 0x4000,
+	.flags = FSL_EDMA_DRV_EDMA3 | FSL_EDMA_DRV_MUX_SWAP,
+	.setup_irq = fsl_edma3_or_irq_init,
+};
+
 static const struct of_device_id fsl_edma_dt_ids[] = {
 	{ .compatible = "fsl,vf610-edma", .data = &vf610_data},
 	{ .compatible = "fsl,ls1028a-edma", .data = &ls1028a_data},
@@ -413,6 +519,7 @@ static const struct of_device_id fsl_edma_dt_ids[] = {
 	{ .compatible = "fsl,imx93-edma3", .data = &imx93_data3},
 	{ .compatible = "fsl,imx93-edma4", .data = &imx93_data4},
 	{ .compatible = "fsl,imx95-edma5", .data = &imx95_data5},
+	{ .compatible = "nxp,s32g2-edma", .data = &s32g2_data},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, fsl_edma_dt_ids);
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 5/5] dmaengine: fsl-edma: read/write multiple registers in cyclic transactions
  2024-12-19 10:24 [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Larisa Grigore
                   ` (3 preceding siblings ...)
  2024-12-19 10:24 ` [PATCH v3 4/5] dmaengine: fsl-edma: add support for S32G based platforms Larisa Grigore
@ 2024-12-19 10:24 ` Larisa Grigore
  2024-12-24 10:42 ` [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Vinod Koul
  5 siblings, 0 replies; 8+ messages in thread
From: Larisa Grigore @ 2024-12-19 10:24 UTC (permalink / raw)
  To: Frank Li, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Peng Fan
  Cc: imx, dmaengine, devicetree, linux-kernel, s32, Christophe Lizzi,
	Alberto Ruiz, Enric Balletbo, Larisa Grigore,
	Alexandru-Catalin Ionita

Add support for reading multiple registers in DEV_TO_MEM transactions and
for writing multiple registers in MEM_TO_DEV transactions.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Co-developed-by: Alexandru-Catalin Ionita <alexandru-catalin.ionita@nxp.com>
Signed-off-by: Alexandru-Catalin Ionita <alexandru-catalin.ionita@nxp.com>
Signed-off-by: Larisa Grigore <larisa.grigore@oss.nxp.com>
---
 drivers/dma/fsl-edma-common.c | 36 ++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index b7f15ab96855..443b2430466c 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -480,8 +480,8 @@ void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan,
 		       bool disable_req, bool enable_sg)
 {
 	struct dma_slave_config *cfg = &fsl_chan->cfg;
+	u32 burst = 0;
 	u16 csr = 0;
-	u32 burst;
 
 	/*
 	 * eDMA hardware SGs require the TCDs to be stored in little
@@ -496,16 +496,30 @@ void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan,
 
 	fsl_edma_set_tcd_to_le(fsl_chan, tcd, soff, soff);
 
-	if (fsl_chan->is_multi_fifo) {
-		/* set mloff to support multiple fifo */
-		burst = cfg->direction == DMA_DEV_TO_MEM ?
-				cfg->src_maxburst : cfg->dst_maxburst;
-		nbytes |= EDMA_V3_TCD_NBYTES_MLOFF(-(burst * 4));
-		/* enable DMLOE/SMLOE */
-		if (cfg->direction == DMA_MEM_TO_DEV) {
+	/* If we expect to have either multi_fifo or a port window size,
+	 * we will use minor loop offset, meaning bits 29-10 will be used for
+	 * address offset, while bits 9-0 will be used to tell DMA how much
+	 * data to read from addr.
+	 * If we don't have either of those, will use a major loop reading from addr
+	 * nbytes (29bits).
+	 */
+	if (cfg->direction == DMA_MEM_TO_DEV) {
+		if (fsl_chan->is_multi_fifo)
+			burst = cfg->dst_maxburst * 4;
+		if (cfg->dst_port_window_size)
+			burst = cfg->dst_port_window_size * cfg->dst_addr_width;
+		if (burst) {
+			nbytes |= EDMA_V3_TCD_NBYTES_MLOFF(-burst);
 			nbytes |= EDMA_V3_TCD_NBYTES_DMLOE;
 			nbytes &= ~EDMA_V3_TCD_NBYTES_SMLOE;
-		} else {
+		}
+	} else {
+		if (fsl_chan->is_multi_fifo)
+			burst = cfg->src_maxburst * 4;
+		if (cfg->src_port_window_size)
+			burst = cfg->src_port_window_size * cfg->src_addr_width;
+		if (burst) {
+			nbytes |= EDMA_V3_TCD_NBYTES_MLOFF(-burst);
 			nbytes |= EDMA_V3_TCD_NBYTES_SMLOE;
 			nbytes &= ~EDMA_V3_TCD_NBYTES_DMLOE;
 		}
@@ -623,11 +637,15 @@ struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic(
 			dst_addr = fsl_chan->dma_dev_addr;
 			soff = fsl_chan->cfg.dst_addr_width;
 			doff = fsl_chan->is_multi_fifo ? 4 : 0;
+			if (fsl_chan->cfg.dst_port_window_size)
+				doff = fsl_chan->cfg.dst_addr_width;
 		} else if (direction == DMA_DEV_TO_MEM) {
 			src_addr = fsl_chan->dma_dev_addr;
 			dst_addr = dma_buf_next;
 			soff = fsl_chan->is_multi_fifo ? 4 : 0;
 			doff = fsl_chan->cfg.src_addr_width;
+			if (fsl_chan->cfg.src_port_window_size)
+				soff = fsl_chan->cfg.src_addr_width;
 		} else {
 			/* DMA_DEV_TO_DEV */
 			src_addr = fsl_chan->cfg.src_addr;
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/5] dt-bindings: dma: fsl-edma: add nxp,s32g2-edma compatible string
  2024-12-19 10:24 ` [PATCH v3 3/5] dt-bindings: dma: fsl-edma: add nxp,s32g2-edma compatible string Larisa Grigore
@ 2024-12-19 19:46   ` Conor Dooley
  0 siblings, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2024-12-19 19:46 UTC (permalink / raw)
  To: Larisa Grigore
  Cc: Frank Li, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Peng Fan, imx, dmaengine, devicetree, linux-kernel,
	s32, Christophe Lizzi, Alberto Ruiz, Enric Balletbo

[-- Attachment #1: Type: text/plain, Size: 2592 bytes --]

On Thu, Dec 19, 2024 at 12:24:12PM +0200, Larisa Grigore wrote:
> Introduce the compatible strings 'nxp,s32g2-edma' and 'nxp,s32g3-edma' to
> enable the support for the eDMAv3 present on S32G2/S32G3 platforms.
> 
> The S32G2/S32G3 eDMA architecture features 32 DMA channels. Each of the
> two eDMA instances is integrated with two DMAMUX blocks.
> 
> Another particularity of these SoCs is that the interrupts are shared
> between channels in the following way:
> - DMA Channels 0-15 share the 'tx-0-15' interrupt
> - DMA Channels 16-31 share the 'tx-16-31' interrupt
> - all channels share the 'err' interrupt
> 
> Signed-off-by: Larisa Grigore <larisa.grigore@oss.nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
>  .../devicetree/bindings/dma/fsl,edma.yaml     | 34 +++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> index d54140f18d34..4f925469533e 100644
> --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> @@ -26,9 +26,13 @@ properties:
>            - fsl,imx93-edma3
>            - fsl,imx93-edma4
>            - fsl,imx95-edma5
> +          - nxp,s32g2-edma
>        - items:
>            - const: fsl,ls1028a-edma
>            - const: fsl,vf610-edma
> +      - items:
> +          - const: nxp,s32g3-edma
> +          - const: nxp,s32g2-edma
>  
>    reg:
>      minItems: 1
> @@ -221,6 +225,36 @@ allOf:
>        properties:
>          power-domains: false
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,s32g2-edma

Your property ordering below is a bit odd, but it matches what exists
currently so
Acked-by: Conor Dooley <conor.dooley@microchip.com>

Cheers,
Conor.

> +    then:
> +      properties:
> +        clocks:
> +          minItems: 2
> +          maxItems: 2
> +        clock-names:
> +          items:
> +            - const: dmamux0
> +            - const: dmamux1
> +        interrupts:
> +          minItems: 3
> +          maxItems: 3
> +        interrupt-names:
> +          items:
> +            - const: tx-0-15
> +            - const: tx-16-31
> +            - const: err
> +        reg:
> +          minItems: 3
> +          maxItems: 3
> +        "#dma-cells":
> +          const: 2
> +        dma-channels:
> +          const: 32
> +
>  unevaluatedProperties: false
>  
>  examples:
> -- 
> 2.47.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs
  2024-12-19 10:24 [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Larisa Grigore
                   ` (4 preceding siblings ...)
  2024-12-19 10:24 ` [PATCH v3 5/5] dmaengine: fsl-edma: read/write multiple registers in cyclic transactions Larisa Grigore
@ 2024-12-24 10:42 ` Vinod Koul
  5 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2024-12-24 10:42 UTC (permalink / raw)
  To: Frank Li, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Peng Fan, Larisa Grigore
  Cc: imx, dmaengine, devicetree, linux-kernel, s32, Christophe Lizzi,
	Alberto Ruiz, Enric Balletbo


On Thu, 19 Dec 2024 12:24:09 +0200, Larisa Grigore wrote:
> S32G2 and S32G3 SoCs share the eDMAv3 module with i.MX SoCs, with some hardware
> integration particularities.
> 
> S32G2/S32G3 includes two system eDMA instances based on v3 version, each of
> them integrated with 2 DMAMUX blocks.
> Another particularity of these SoCs is that the interrupts are shared between
> channels as follows:
> - DMA Channels 0-15 share the 'tx-0-15' interrupt
> - DMA Channels 16-31 share the 'tx-16-31' interrupt
> - all channels share the 'err' interrupt
> 
> [...]

Applied, thanks!

[1/5] dmaengine: fsl-edma: select of_dma_xlate based on the dmamuxs presence
      commit: a4b00f54a20bba0bbfc952a8cb4c3cbe29e408b0
[2/5] dmaengine: fsl-edma: remove FSL_EDMA_DRV_SPLIT_REG check when parsing muxbase
      commit: e7732945db1d4612072e26e5b459d74e9d790b7c
[3/5] dt-bindings: dma: fsl-edma: add nxp,s32g2-edma compatible string
      commit: 57eeb0a566a82621ab731b0372a5a2894b0d572e
[4/5] dmaengine: fsl-edma: add support for S32G based platforms
      commit: 2500243e5cc2e45e6fae826cbc64e9986a9b8194
[5/5] dmaengine: fsl-edma: read/write multiple registers in cyclic transactions
      commit: 66d88e16f2044400fe6cc75cd51e1e74c4f9d96d

Best regards,
-- 
~Vinod



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-12-24 10:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19 10:24 [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Larisa Grigore
2024-12-19 10:24 ` [PATCH v3 1/5] dmaengine: fsl-edma: select of_dma_xlate based on the dmamuxs presence Larisa Grigore
2024-12-19 10:24 ` [PATCH v3 2/5] dmaengine: fsl-edma: remove FSL_EDMA_DRV_SPLIT_REG check when parsing muxbase Larisa Grigore
2024-12-19 10:24 ` [PATCH v3 3/5] dt-bindings: dma: fsl-edma: add nxp,s32g2-edma compatible string Larisa Grigore
2024-12-19 19:46   ` Conor Dooley
2024-12-19 10:24 ` [PATCH v3 4/5] dmaengine: fsl-edma: add support for S32G based platforms Larisa Grigore
2024-12-19 10:24 ` [PATCH v3 5/5] dmaengine: fsl-edma: read/write multiple registers in cyclic transactions Larisa Grigore
2024-12-24 10:42 ` [PATCH v3 0/5] Add eDMAv3 support for S32G2/S32G3 SoCs Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox