Linux clock framework development
 help / color / mirror / Atom feed
* [PATCH] clk: sunxi-ng: a523: Mark MBUS clock as critical
@ 2025-06-07 13:50 Chen-Yu Tsai
  2025-06-12  8:25 ` Andre Przywara
  2025-06-14 17:14 ` Chen-Yu Tsai
  0 siblings, 2 replies; 3+ messages in thread
From: Chen-Yu Tsai @ 2025-06-07 13:50 UTC (permalink / raw)
  To: Stephen Boyd, Jernej Skrabec, Samuel Holland
  Cc: Chen-Yu Tsai, linux-clk, linux-arm-kernel, linux-sunxi,
	linux-kernel, Andre Przywara

From: Chen-Yu Tsai <wens@csie.org>

The MBUS serves as the main data bus for various DMA masters in the
system. If its clock is not enabled, the DMA operations will stall,
leading to the peripherals stalling or timing out. This has been
observed as USB or MMC hosts timing out waiting for transactions
when the clock is automatically disabled by the CCF due to it not
being used.

Mark the clock as critical so that it never gets disabled.

Fixes: 74b0443a0d0a ("clk: sunxi-ng: a523: add system mod clocks")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/clk/sunxi-ng/ccu-sun55i-a523.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c
index 9efb9fd24b42..1a9a1cb869e2 100644
--- a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c
+++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c
@@ -385,7 +385,8 @@ static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(mbus_clk, "mbus", mbus_parents,
 					    0, 0,		/* no P */
 					    24, 3,	/* mux */
 					    BIT(31),	/* gate */
-					    0, CCU_FEATURE_UPDATE_BIT);
+					    CLK_IS_CRITICAL,
+					    CCU_FEATURE_UPDATE_BIT);
 
 static const struct clk_hw *mbus_hws[] = { &mbus_clk.common.hw };
 
-- 
2.39.5


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

* Re: [PATCH] clk: sunxi-ng: a523: Mark MBUS clock as critical
  2025-06-07 13:50 [PATCH] clk: sunxi-ng: a523: Mark MBUS clock as critical Chen-Yu Tsai
@ 2025-06-12  8:25 ` Andre Przywara
  2025-06-14 17:14 ` Chen-Yu Tsai
  1 sibling, 0 replies; 3+ messages in thread
From: Andre Przywara @ 2025-06-12  8:25 UTC (permalink / raw)
  To: Chen-Yu Tsai, Stephen Boyd, Jernej Skrabec, Samuel Holland
  Cc: Chen-Yu Tsai, linux-clk, linux-arm-kernel, linux-sunxi,
	linux-kernel

Hi Chen-Yu,

thanks for your research on this!

On 07/06/2025 14:50, Chen-Yu Tsai wrote:
> From: Chen-Yu Tsai <wens@csie.org>
> 
> The MBUS serves as the main data bus for various DMA masters in the
> system. If its clock is not enabled, the DMA operations will stall,
> leading to the peripherals stalling or timing out. This has been
> observed as USB or MMC hosts timing out waiting for transactions
> when the clock is automatically disabled by the CCF due to it not
> being used.
> 
> Mark the clock as critical so that it never gets disabled.

Yes, we do this for all the other SoCs, and I somehow missed that for 
the A523.
I am still scratching my head how this worked for me, though, but the 
patch is pretty surely correct:

> Fixes: 74b0443a0d0a ("clk: sunxi-ng: a523: add system mod clocks")
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>   drivers/clk/sunxi-ng/ccu-sun55i-a523.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c
> index 9efb9fd24b42..1a9a1cb869e2 100644
> --- a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c
> +++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c
> @@ -385,7 +385,8 @@ static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(mbus_clk, "mbus", mbus_parents,
>   					    0, 0,		/* no P */
>   					    24, 3,	/* mux */
>   					    BIT(31),	/* gate */
> -					    0, CCU_FEATURE_UPDATE_BIT);
> +					    CLK_IS_CRITICAL,
> +					    CCU_FEATURE_UPDATE_BIT);
>   
>   static const struct clk_hw *mbus_hws[] = { &mbus_clk.common.hw };
>   


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

* Re: [PATCH] clk: sunxi-ng: a523: Mark MBUS clock as critical
  2025-06-07 13:50 [PATCH] clk: sunxi-ng: a523: Mark MBUS clock as critical Chen-Yu Tsai
  2025-06-12  8:25 ` Andre Przywara
@ 2025-06-14 17:14 ` Chen-Yu Tsai
  1 sibling, 0 replies; 3+ messages in thread
From: Chen-Yu Tsai @ 2025-06-14 17:14 UTC (permalink / raw)
  To: Stephen Boyd, Jernej Skrabec, Samuel Holland, Chen-Yu Tsai
  Cc: linux-clk, linux-arm-kernel, linux-sunxi, linux-kernel,
	Andre Przywara

On Sat, 07 Jun 2025 21:50:29 +0800, Chen-Yu Tsai wrote:
> The MBUS serves as the main data bus for various DMA masters in the
> system. If its clock is not enabled, the DMA operations will stall,
> leading to the peripherals stalling or timing out. This has been
> observed as USB or MMC hosts timing out waiting for transactions
> when the clock is automatically disabled by the CCF due to it not
> being used.
> 
> [...]

Applied to sunxi/clk-fixes-for-6.16 in local tree, thanks!

[1/1] clk: sunxi-ng: a523: Mark MBUS clock as critical
      commit: 713d48878e8a5e4bcca6355324f943eb72cd2c84

Best regards,
-- 
Chen-Yu Tsai <wens@csie.org>


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

end of thread, other threads:[~2025-06-14 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-07 13:50 [PATCH] clk: sunxi-ng: a523: Mark MBUS clock as critical Chen-Yu Tsai
2025-06-12  8:25 ` Andre Przywara
2025-06-14 17:14 ` Chen-Yu Tsai

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