mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: fsl-edma: avoid double-disable of channel clocks
@ 2026-11-29 12:27 Jiawen Liu
  2026-11-30  2:54 ` Peng Fan (OSS)
  2026-11-30 20:40 ` Frank Li
  0 siblings, 2 replies; 3+ messages in thread
From: Jiawen Liu @ 2026-11-29 12:27 UTC (permalink / raw)
  To: Frank Li, Vinod Koul; +Cc: imx, dmaengine, linux-kernel

devm_clk_get_enabled() registers automatic clock cleanup for each
i.MX8ULP eDMA channel. The probe also manually disables the clock after
channel initialization, so devres teardown executes disable and
unprepare for the same enable a second time.

Obtain the clock with devm_clk_get(), enable it explicitly for channel
initialization, and retain the existing manual disable. Propagate an
enable failure before touching the channel registers.

Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
 drivers/dma/fsl-edma-main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index da51399114884..ecbd5b597d8d9 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -815,11 +815,15 @@ static int fsl_edma_probe(struct platform_device *pdev)
 
 		if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) {
 			snprintf(clk_name, sizeof(clk_name), "ch%02d", i);
-			fsl_chan->clk = devm_clk_get_enabled(&pdev->dev,
-							     (const char *)clk_name);
+			fsl_chan->clk = devm_clk_get(&pdev->dev, clk_name);
 
 			if (IS_ERR(fsl_chan->clk))
 				return PTR_ERR(fsl_chan->clk);
+
+			ret = clk_prepare_enable(fsl_chan->clk);
+			if (ret)
+				return dev_err_probe(&pdev->dev, ret,
+						     "Failed to enable channel clock\n");
 		}
 		fsl_chan->pdev = pdev;
 		vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev);
-- 
2.34.1


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

* Re: [PATCH] dmaengine: fsl-edma: avoid double-disable of channel clocks
  2026-11-29 12:27 [PATCH] dmaengine: fsl-edma: avoid double-disable of channel clocks Jiawen Liu
@ 2026-11-30  2:54 ` Peng Fan (OSS)
  2026-11-30 20:40 ` Frank Li
  1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan (OSS) @ 2026-11-30  2:54 UTC (permalink / raw)
  To: Jiawen Liu
  Cc: Peng Fan, Frank Li, Vinod Koul, imx, dmaengine, linux-kernel, Peng Fan

On Sun, 29 Nov 2026 16:27:15 +0400 Jiawen Liu <1298662399@qq.com> wrote:

> devm_clk_get_enabled() registers automatic clock cleanup for each
> i.MX8ULP eDMA channel. The probe also manually disables the clock after
> channel initialization, so devres teardown executes disable and
> unprepare for the same enable a second time.
> 
> Obtain the clock with devm_clk_get(), enable it explicitly for channel
> initialization, and retain the existing manual disable. Propagate an
> enable failure before touching the channel registers.
> 
> Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support")
> Signed-off-by: Jiawen Liu <1298662399@qq.com>
> ---
>  drivers/dma/fsl-edma-main.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index da51399114884..ecbd5b597d8d9 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -815,11 +815,15 @@ static int fsl_edma_probe(struct platform_device *pdev)
>  
>  		if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) {
>  			snprintf(clk_name, sizeof(clk_name), "ch%02d", i);
> -			fsl_chan->clk = devm_clk_get_enabled(&pdev->dev,
> -							     (const char *)clk_name);
> +			fsl_chan->clk = devm_clk_get(&pdev->dev, clk_name);
>  
>  			if (IS_ERR(fsl_chan->clk))
>  				return PTR_ERR(fsl_chan->clk);
> +
> +			ret = clk_prepare_enable(fsl_chan->clk);
> +			if (ret)
> +				return dev_err_probe(&pdev->dev, ret,
> +						     "Failed to enable channel clock\n");


Reviewed-by: Peng Fan <peng.fan@nxp.com>

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

* Re: [PATCH] dmaengine: fsl-edma: avoid double-disable of channel clocks
  2026-11-29 12:27 [PATCH] dmaengine: fsl-edma: avoid double-disable of channel clocks Jiawen Liu
  2026-11-30  2:54 ` Peng Fan (OSS)
@ 2026-11-30 20:40 ` Frank Li
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-11-30 20:40 UTC (permalink / raw)
  To: Jiawen Liu; +Cc: Frank Li, Vinod Koul, imx, dmaengine, linux-kernel

On Sun, Nov 29, 2026 at 04:27:15PM +0400, Jiawen Liu wrote:
> devm_clk_get_enabled() registers automatic clock cleanup for each
> i.MX8ULP eDMA channel. The probe also manually disables the clock after
> channel initialization, so devres teardown executes disable and
> unprepare for the same enable a second time.
>
> Obtain the clock with devm_clk_get(), enable it explicitly for channel
> initialization, and retain the existing manual disable. Propagate an
> enable failure before touching the channel registers.
>
> Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support")
> Signed-off-by: Jiawen Liu <1298662399@qq.com>
> ---

I hope use Joy's patch
https://patchwork.kernel.org/project/linux-dmaengine/patch/20261125-b4-edma-runtime-opt-mo-v8-1-81345a3bfb52@oss.nxp.com/
to fix these propblem

Frank

>  drivers/dma/fsl-edma-main.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index da51399114884..ecbd5b597d8d9 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -815,11 +815,15 @@ static int fsl_edma_probe(struct platform_device *pdev)
>
>  		if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) {
>  			snprintf(clk_name, sizeof(clk_name), "ch%02d", i);
> -			fsl_chan->clk = devm_clk_get_enabled(&pdev->dev,
> -							     (const char *)clk_name);
> +			fsl_chan->clk = devm_clk_get(&pdev->dev, clk_name);
>
>  			if (IS_ERR(fsl_chan->clk))
>  				return PTR_ERR(fsl_chan->clk);
> +
> +			ret = clk_prepare_enable(fsl_chan->clk);
> +			if (ret)
> +				return dev_err_probe(&pdev->dev, ret,
> +						     "Failed to enable channel clock\n");
>  		}
>  		fsl_chan->pdev = pdev;
>  		vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev);
> --
> 2.34.1
>
>

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

end of thread, other threads:[~2026-11-30 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 12:27 [PATCH] dmaengine: fsl-edma: avoid double-disable of channel clocks Jiawen Liu
2026-11-30  2:54 ` Peng Fan (OSS)
2026-11-30 20:40 ` Frank Li

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®