Skip to contentSkip to conversation

clk: rockchip: Fix CPLL setup issue

RFC In review Alexander Shiyan 2 participants 4 messages Sep 26, 2025 – Sep 29, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 clk: rockchip: Fix CPLL setup issue

This is a dirty patch to solve the RK3588 CPLL clock setup issue. It's taken from the Rockchip U-Boot repository [1].
Any ideas on how to improve it?

[1] https://github.com/rockchip-linux/u-boot/commit/bd11beba4f997b62809d24eba30a8713c8bbeb81

---
 drivers/clk/rockchip/clk-pll.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/clk/rockchip/clk-pll.c +14 -0
index 904d70d5d4..4b92639e1b 100644
@@ -940,6 +940,13 @@ static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll,
 		}
 	}
 
+	/* Barebox addition */
+	if (pll->reg_base - pll->ctx->reg_base == 0x1a0) {
+		/* Determine CPLL clock and patch clk_bisrintf_pllsrc_en */
+		writel(HIWORD_UPDATE(BIT(1), BIT(1), 0),
+		       pll->ctx->reg_base + 0x84c);
+	}
+
 	/* set pll power down */
 	writel(HIWORD_UPDATE(RK3588_PLLCON1_PWRDOWN,
 			     RK3588_PLLCON1_PWRDOWN, 0),
@@ -971,6 +978,13 @@ static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll,
 	if ((pll->type == pll_rk3588) && rate_change_remuxed)
 		pll_mux_ops->set_parent(&pll_mux->hw, PLL_MODE_NORM);
 
+	/* Barebox addition */
+	if (pll->reg_base - pll->ctx->reg_base == 0x1a0) {
+		/* Determine CPLL clock and patch clk_bisrintf_pllsrc_en back */
+		writel(HIWORD_UPDATE(0, BIT(1), 0),
+		       pll->ctx->reg_base + 0x84c);
+	}
+
 	return ret;
 }
 
Signature · 1 line
2.38.2
#1 lore raw
Quoted 30 lines · Alexander Shiyan

This is a dirty patch to solve the RK3588 CPLL clock setup issue. It's taken from the Rockchip U-Boot repository [1].
Any ideas on how to improve it?

[1] https://github.com/rockchip-linux/u-boot/commit/bd11beba4f997b62809d24eba30a8713c8bbeb81

---
 drivers/clk/rockchip/clk-pll.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/clk/rockchip/clk-pll.c +7 -0
index 904d70d5d4..4b92639e1b 100644
@@ -940,6 +940,13 @@ static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll,
 		}
 	}
 
+	/* Barebox addition */
+	if (pll->reg_base - pll->ctx->reg_base == 0x1a0) {
+		/* Determine CPLL clock and patch clk_bisrintf_pllsrc_en */
+		writel(HIWORD_UPDATE(BIT(1), BIT(1), 0),
+		       pll->ctx->reg_base + 0x84c);
+	}
+
 	/* set pll power down */
 	writel(HIWORD_UPDATE(RK3588_PLLCON1_PWRDOWN,
 			     RK3588_PLLCON1_PWRDOWN, 0),

drivers/clk/rockchip/clk-pll.c static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll, · line 986

Quoted 9 lines
drivers/clk/rockchip/clk-pll.c +6 -0
@@ -971,6 +978,13 @@ static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll,
 	if ((pll->type == pll_rk3588) && rate_change_remuxed)
 		pll_mux_ops->set_parent(&pll_mux->hw, PLL_MODE_NORM);
 
+	/* Barebox addition */
+	if (pll->reg_base - pll->ctx->reg_base == 0x1a0) {
+		/* Determine CPLL clock and patch clk_bisrintf_pllsrc_en back */
+		writel(HIWORD_UPDATE(0, BIT(1), 0),
+		       pll->ctx->reg_base + 0x84c);
+	}

Resetting this bit is not in the U-Boot patch you reference. Do we need this?

If yes, please add a variable insted of duplicating this test, like for example

	bool need_pll3_fix = pll->reg_base == pll->ctx->reg_base + 0x1a0;

Other than that the itself looks ok. Polish the commit message a bit and we are good to go.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw

Hello.

Quoted 6 lines · Alexander Shiyan
Quoted 5 lines

This is a dirty patch to solve the RK3588 CPLL clock setup issue. It's taken from the Rockchip U-Boot repository [1].
Any ideas on how to improve it?

[1] https://github.com/rockchip-linux/u-boot/commit/bd11beba4f997b62809d24eba30a8713c8bbeb81

...

Quoted 9 lines

drivers/clk/rockchip/clk-pll.c static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll, · line 986

Quoted 6 lines
drivers/clk/rockchip/clk-pll.c +6 -0
+     /* Barebox addition */
+     if (pll->reg_base - pll->ctx->reg_base == 0x1a0) {
+             /* Determine CPLL clock and patch clk_bisrintf_pllsrc_en back */
+             writel(HIWORD_UPDATE(0, BIT(1), 0),
+                    pll->ctx->reg_base + 0x84c);
+     }

Resetting this bit is not in the U-Boot patch you reference. Do we need this?

Yes.
https://github.com/rockchip-linux/u-boot/commit/7560cacdd3a68bb475f23b4249a98025c89064d4

#3 lore raw
Quoted 16 lines · Alexander Shiyan

Hello.

Quoted 6 lines · Alexander Shiyan
Quoted 5 lines

This is a dirty patch to solve the RK3588 CPLL clock setup issue. It's taken from the Rockchip U-Boot repository [1].
Any ideas on how to improve it?

[1] https://github.com/rockchip-linux/u-boot/commit/bd11beba4f997b62809d24eba30a8713c8bbeb81

...

Quoted 7 lines
Quoted 6 lines
drivers/clk/rockchip/clk-pll.c +6 -0
+     /* Barebox addition */
+     if (pll->reg_base - pll->ctx->reg_base == 0x1a0) {
+             /* Determine CPLL clock and patch clk_bisrintf_pllsrc_en back */
+             writel(HIWORD_UPDATE(0, BIT(1), 0),
+                    pll->ctx->reg_base + 0x84c);
+     }
Quoted 5 lines
Quoted 2 lines

Resetting this bit is not in the U-Boot patch you reference. Do we need this?

Yes.
https://github.com/rockchip-linux/u-boot/commit/7560cacdd3a68bb475f23b4249a98025c89064d4

Ah, alright, they fixed it in a later commit. I only looked at the commit you referenced. So please reference both in the commit message.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |