Skip to contentSkip to conversation

clk: sunxi-ng: a523: Mark MBUS clock as critical

PATCH In review Chen-Yu Tsai 3 participants 3 messages Jun 7, 2025 – Jun 14, 2025

Subsystems (2)
lore
Share & tools
lore

Chen-Yu Tsai

author maintainer
#0 lore raw

PATCH 1/1 clk: sunxi-ng: a523: Mark MBUS clock as critical

From: Chen-Yu Tsai <[email protected]>

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")
---
 drivers/clk/sunxi-ng/ccu-sun55i-a523.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun55i-a523.c +2 -1
index 9efb9fd24b42..1a9a1cb869e2 100644
@@ -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 };
 
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw

Hi Chen-Yu,

thanks for your research on this!

Quoted 10 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

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:

Quoted 2 lines
Fixes 74b0443a0d0a ("clk: sunxi-ng: a523: add system mod clocks")

Cheers,
Andre

Quoted 18 lines
---
  drivers/clk/sunxi-ng/ccu-sun55i-a523.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun55i-a523.c +2 -1
index 9efb9fd24b42..1a9a1cb869e2 100644
@@ -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 lore raw
In reply to Chen-Yu Tsai
Quoted 8 lines · Chen-Yu Tsai

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,

Signature · 1 line
Chen-Yu Tsai <[email protected]>