Skip to contentSkip to conversation

dmaengine: fsl-edma: add error irq to help debug problem

PATCH Applied Frank Li 4 participants 7 messages Apr 7, 2025 – Apr 24, 2025

Subsystems (4)
lore
Share & tools
lore

Frank Li

author maintainer
#0 lore raw

v2 cover dmaengine: fsl-edma: add error irq to help debug problem

Change binding to support optional error irq.
Add error irq handle for fsl-edma drivers.
imx93 dts add dma error irq interupt.

---
Changes in v2:
- Rebase to v6.15-rc1, fix conflict at fsl-edma-main.c
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Joy Zou (3):
dt-bindings: dma: fsl-edma: increase maxItems of interrupts and interrupt-names
dmaegnine: fsl-edma: add edma error interrupt handler
arm64: dtsi: imx93: add edma error interrupt support

 .../devicetree/bindings/dma/fsl,edma.yaml          |   4 +-
 arch/arm64/boot/dts/freescale/imx93.dtsi           |   6 +-
 drivers/dma/fsl-edma-common.c                      |  30 ++++--
 drivers/dma/fsl-edma-common.h                      |  18 ++++
 drivers/dma/fsl-edma-main.c                        | 114 ++++++++++++++++++++-
 5 files changed, 155 insertions(+), 17 deletions(-)

---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250225-edma_err-5a7385e45800

Best regards,
---
Frank Li <[email protected]>

author maintainer
#1 lore raw

PATCH v2 1/3 dt-bindings: dma: fsl-edma: increase maxItems of interrupts and interrupt-names

From: Joy Zou <[email protected]>

The edma controller support optional error interrupt, so update interrupts and interrupt-names's maxItems.

---
 Documentation/devicetree/bindings/dma/fsl,edma.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/dma/fsl,edma.yaml +2 -2
index 950e8fa4f4ab4..fa4248e2f1b9c 100644
@@ -48,11 +48,11 @@ properties:
 
   interrupts:
     minItems: 1
-    maxItems: 64
+    maxItems: 65
 
   interrupt-names:
     minItems: 1
-    maxItems: 64
+    maxItems: 65
 
   "#dma-cells":
     description: |
Signature · 1 line
2.34.1
maintainer Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: dma: fsl-edma: increase maxItems of interrupts and interrupt-names

Quoted 11 lines · Frank Li

From: Joy Zou <[email protected]>

The edma controller support optional error interrupt, so update interrupts and interrupt-names's maxItems.

---
 Documentation/devicetree/bindings/dma/fsl,edma.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Please add Acked-by/Reviewed-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.

If a tag was not added on purpose, please state why and what changed.

Missing tags:

author maintainer
#3 lore raw

PATCH v2 2/3 dmaegnine: fsl-edma: add edma error interrupt handler

In reply to Frank Li

From: Joy Zou <[email protected]>

Add the edma error interrupt handler because it's useful to debug issue.

i.MX8ULP edma has per channel error interrupt.

i.MX91/93/95 and i.MX8QM/QXP/DXL edma share one error interrupt.

---
 drivers/dma/fsl-edma-common.c |  30 ++++++++---
 drivers/dma/fsl-edma-common.h |  18 +++++++
 drivers/dma/fsl-edma-main.c   | 114 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 149 insertions(+), 13 deletions(-)
drivers/dma/fsl-edma-common.c +22 -8
index 443b2430466cb..4976d7dde0809 100644
@@ -95,7 +95,7 @@ static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan)
 	}
 
 	val = edma_readl_chreg(fsl_chan, ch_csr);
-	val |= EDMA_V3_CH_CSR_ERQ;
+	val |= EDMA_V3_CH_CSR_ERQ | EDMA_V3_CH_CSR_EEI;
 	edma_writel_chreg(fsl_chan, val, ch_csr);
 }
 
@@ -821,7 +821,7 @@ void fsl_edma_issue_pending(struct dma_chan *chan)
 int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
 {
 	struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan);
-	int ret;
+	int ret = 0;
 
 	if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK)
 		clk_prepare_enable(fsl_chan->clk);
@@ -831,17 +831,29 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
 				sizeof(struct fsl_edma_hw_tcd64) : sizeof(struct fsl_edma_hw_tcd),
 				32, 0);
 
-	if (fsl_chan->txirq) {
+	if (fsl_chan->txirq)
 		ret = request_irq(fsl_chan->txirq, fsl_chan->irq_handler, IRQF_SHARED,
 				 fsl_chan->chan_name, fsl_chan);
 
-		if (ret) {
-			dma_pool_destroy(fsl_chan->tcd_pool);
-			return ret;
-		}
-	}
+	if (ret)
+		goto err_txirq;
+
+	if (fsl_chan->errirq > 0)
+		ret = request_irq(fsl_chan->errirq, fsl_chan->errirq_handler, IRQF_SHARED,
+				  fsl_chan->errirq_name, fsl_chan);
+
+	if (ret)
+		goto err_errirq;
 
 	return 0;
+
+err_errirq:
+	if (fsl_chan->txirq)
+		free_irq(fsl_chan->txirq, fsl_chan);
+err_txirq:
+	dma_pool_destroy(fsl_chan->tcd_pool);
+
+	return ret;
 }
 
 void fsl_edma_free_chan_resources(struct dma_chan *chan)
@@ -862,6 +874,8 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan)
 
 	if (fsl_chan->txirq)
 		free_irq(fsl_chan->txirq, fsl_chan);
+	if (fsl_chan->errirq)
+		free_irq(fsl_chan->errirq, fsl_chan);
 
 	vchan_dma_desc_free_list(&fsl_chan->vchan, &head);
 	dma_pool_destroy(fsl_chan->tcd_pool);
drivers/dma/fsl-edma-common.h +18 -0
index 10a5565ddfd76..205a964890948 100644
@@ -71,6 +71,18 @@
 #define EDMA_V3_CH_ES_ERR          BIT(31)
 #define EDMA_V3_MP_ES_VLD          BIT(31)
 
+#define EDMA_V3_CH_ERR_DBE	BIT(0)
+#define EDMA_V3_CH_ERR_SBE	BIT(1)
+#define EDMA_V3_CH_ERR_SGE	BIT(2)
+#define EDMA_V3_CH_ERR_NCE	BIT(3)
+#define EDMA_V3_CH_ERR_DOE	BIT(4)
+#define EDMA_V3_CH_ERR_DAE	BIT(5)
+#define EDMA_V3_CH_ERR_SOE	BIT(6)
+#define EDMA_V3_CH_ERR_SAE	BIT(7)
+#define EDMA_V3_CH_ERR_ECX	BIT(8)
+#define EDMA_V3_CH_ERR_UCE	BIT(9)
+#define EDMA_V3_CH_ERR		BIT(31)
+
 enum fsl_edma_pm_state {
 	RUNNING = 0,
 	SUSPENDED,
@@ -162,6 +174,7 @@ struct fsl_edma_chan {
 	u32				dma_dev_size;
 	enum dma_data_direction		dma_dir;
 	char				chan_name[32];
+	char				errirq_name[36];
 	void __iomem			*tcd;
 	void __iomem			*mux_addr;
 	u32				real_count;
@@ -174,7 +187,9 @@ struct fsl_edma_chan {
 	int                             priority;
 	int				hw_chanid;
 	int				txirq;
+	int				errirq;
 	irqreturn_t			(*irq_handler)(int irq, void *dev_id);
+	irqreturn_t			(*errirq_handler)(int irq, void *dev_id);
 	bool				is_rxchan;
 	bool				is_remote;
 	bool				is_multi_fifo;
@@ -208,6 +223,9 @@ struct fsl_edma_desc {
 /* Need clean CHn_CSR DONE before enable TCD's MAJORELINK */
 #define FSL_EDMA_DRV_CLEAR_DONE_E_LINK	BIT(14)
 #define FSL_EDMA_DRV_TCD64		BIT(15)
+/* All channel ERR IRQ share one IRQ line */
+#define FSL_EDMA_DRV_ERRIRQ_SHARE       BIT(16)
+
 
 #define FSL_EDMA_DRV_EDMA3	(FSL_EDMA_DRV_SPLIT_REG |	\
 				 FSL_EDMA_DRV_BUS_8BYTE |	\
drivers/dma/fsl-edma-main.c +109 -5

162 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#4 lore raw

PATCH v2 3/3 arm64: dtsi: imx93: add edma error interrupt support

In reply to Frank Li

From: Joy Zou <[email protected]>

Add edma error irq for imx93.

---
 arch/arm64/boot/dts/freescale/imx93.dtsi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx93.dtsi +4 -2
index 64cd0776b43d3..9f6ac3c8f9455 100644
@@ -297,7 +297,8 @@ edma1: dma-controller@44000000 {
 					     <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, // 27: TMP2 CH1/CH3
 					     <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, // 28: TMP2 Overflow
 					     <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>, // 29: PDM
-					     <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>; // 30: ADC1
+					     <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>, // 30: ADC1
+					     <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;  // err
 				clocks = <&clk IMX93_CLK_EDMA1_GATE>;
 				clock-names = "dma";
 			};
@@ -667,7 +668,8 @@ edma2: dma-controller@42000000 {
 					     <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>,
 					     <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>,
 					     <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>,
-					     <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>;
+					     <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clk IMX93_CLK_EDMA2_GATE>;
 				clock-names = "dma";
 			};
Signature · 1 line
2.34.1
Reviewed-by Tested-by on v2 3/3
#5 lore raw

Re: [PATCH v2 3/3] arm64: dtsi: imx93: add edma error interrupt support

Quoted 39 lines · Frank Li

From: Joy Zou <[email protected]>

Add edma error irq for imx93.

---
 arch/arm64/boot/dts/freescale/imx93.dtsi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx93.dtsi +4 -2
index 64cd0776b43d3..9f6ac3c8f9455 100644
@@ -297,7 +297,8 @@ edma1: dma-controller@44000000 {
 					     <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, // 27: TMP2 CH1/CH3
 					     <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, // 28: TMP2 Overflow
 					     <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>, // 29: PDM
-					     <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>; // 30: ADC1
+					     <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>, // 30: ADC1
+					     <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;  // err
 				clocks = <&clk IMX93_CLK_EDMA1_GATE>;
 				clock-names = "dma";
 			};
@@ -667,7 +668,8 @@ edma2: dma-controller@42000000 {
 					     <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>,
 					     <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>,
 					     <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>,
-					     <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>;
+					     <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clk IMX93_CLK_EDMA2_GATE>;
 				clock-names = "dma";
 			};
Signature · 2 lines
-- 
2.34.1
maintainer Applied
#6 lore raw

Re: (subset) [PATCH v2 0/3] dmaengine: fsl-edma: add error irq to help debug problem

In reply to Frank Li
Quoted 5 lines · Frank Li

Change binding to support optional error irq.
Add error irq handle for fsl-edma drivers.
imx93 dts add dma error irq interupt.

Applied, thanks!

[1/3] dt-bindings: dma: fsl-edma: increase maxItems of interrupts and interrupt-names

      commit: a9ea01f28408169431dd3e6464ed2e48539f4280
[2/3] dmaegnine: fsl-edma: add edma error interrupt handler
      commit: d175222f5e90b7e1f23713378823c338fabb3258

Best regards,

Signature · 1 line
~Vinod