Skip to contentSkip to conversation

dmaengine: fsl-edma: fix edma4 channel enable failure on second attempt

PATCH Applied Frank Li 2 participants 3 messages Aug 23, 2023 – Sep 28, 2023

Subsystems (3)
lore
Share & tools
lore

Frank Li

author maintainer
#0 lore raw

PATCH 1/1 dmaengine: fsl-edma: fix edma4 channel enable failure on second attempt

When attempting to start DMA for the second time using fsl_edma3_enable_request(), channel never start.

CHn_MUX must have a unique value when selecting a peripheral slot in the channel mux configuration. The only value that may overlap is source 0. If there is an attempt to write a mux configuration value that is already consumed by another channel, a mux configuration of 0 (SRC = 0) will be written.

Check CHn_MUX before writing in fsl_edma3_enable_request().

Fixes 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support")
---
 drivers/dma/fsl-edma-common.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/dma/fsl-edma-common.c +8 -2
index a0f5741abcc4..edb92fa93315 100644
@@ -92,8 +92,14 @@ static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan)
 
 	edma_writel_chreg(fsl_chan, val, ch_sbr);
 
-	if (flags & FSL_EDMA_DRV_HAS_CHMUX)
-		edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux);
+	if (flags & FSL_EDMA_DRV_HAS_CHMUX) {
+		/*
+		 * ch_mux: With the exception of 0, attempts to write a value
+		 * already in use will be forced to 0.
+		 */
+		if (!edma_readl_chreg(fsl_chan, ch_mux))
+			edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux);
+	}
 
 	val = edma_readl_chreg(fsl_chan, ch_csr);
 	val |= EDMA_V3_CH_CSR_ERQ;
Signature · 1 line
2.34.1
author maintainer
#1 lore raw
Quoted 23 lines

-----Original Message-----
From: Frank Li <[email protected]>
Sent: Wednesday, August 23, 2023 1:27 PM
To: [email protected]
Cc: [email protected]; [email protected]; Frank Li <[email protected]>; [email protected]; Joy Zou <[email protected]>; [email protected]; [email protected]; Peng Fan <[email protected]>; [email protected]; Shenwei Wang <[email protected]>
Subject: [PATCH 1/1] dmaengine: fsl-edma: fix edma4 channel enable failure on second attempt

When attempting to start DMA for the second time using fsl_edma3_enable_request(), channel never start.

CHn_MUX must have a unique value when selecting a peripheral slot in the channel mux configuration. The only value that may overlap is source 0. If there is an attempt to write a mux configuration value that is already consumed by another channel, a mux configuration of 0 (SRC = 0) will be written.

Quoted 5 lines

Check CHn_MUX before writing in fsl_edma3_enable_request().

Fixes 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support")

---

@vinod:
ping

Quoted 29 lines
 drivers/dma/fsl-edma-common.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/dma/fsl-edma- renamed from drivers/dma/fsl-edma-common.c +0 -0

common.c
index a0f5741abcc4..edb92fa93315 100644

drivers/dma/fsl-edma-common.c +8 -2
@@ -92,8 +92,14 @@ static void fsl_edma3_enable_request(struct
 fsl_edma_chan *fsl_chan)
 
 	edma_writel_chreg(fsl_chan, val, ch_sbr);
 
-	if (flags & FSL_EDMA_DRV_HAS_CHMUX)
-		edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux);
+	if (flags & FSL_EDMA_DRV_HAS_CHMUX) {
+		/*
+		 * ch_mux: With the exception of 0, attempts to write a value
+		 * already in use will be forced to 0.
+		 */
+		if (!edma_readl_chreg(fsl_chan, ch_mux))
+			edma_writel_chreg(fsl_chan, fsl_chan->srcid,
 ch_mux);
+	}
 
drivers/dma/fsl-edma-common.c +0 -1
 	val = edma_readl_chreg(fsl_chan, ch_csr);
 	val |= EDMA_V3_CH_CSR_ERQ;
--

2.34.1

maintainer Applied
#2 lore raw
In reply to Frank Li
Quoted 10 lines · Frank Li

When attempting to start DMA for the second time using fsl_edma3_enable_request(), channel never start.

CHn_MUX must have a unique value when selecting a peripheral slot in the channel mux configuration. The only value that may overlap is source 0. If there is an attempt to write a mux configuration value that is already consumed by another channel, a mux configuration of 0 (SRC = 0) will be written.

[...]

Applied, thanks!

[1/1] dmaengine: fsl-edma: fix edma4 channel enable failure on second attempt

      commit: 3f4b82167a3b1f4ddb33d890f758a042ef4ceef1

Best regards,

Signature · 1 line
~Vinod