Skip to contentSkip to conversation

rockchip: Miscellaneous RK3528 clock fixes

PATCH Superseded Jonas Karlman 2 participants 5 messages Nov 11 – Nov 16

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover rockchip: Miscellaneous RK3528 clock fixes

This series fixes a few issues found in Rockchip RK3528 clock driver while working on a cleanup and refactoring series for RK35xx clock drivers.

Any refactoring has been held back for a future follow-up series.

Changes in v3:
- Split the series into smaller series

Changes in v2:
- Split "rk3528: Fix trivial clock configuration errors"
- Add fixes tag
- Collect r-b tags

Jonas Karlman (3):
clk: rockchip: rk3528: Return correct rate for CLK_PWMx
clk: rockchip: rk3528: Fix VOP clock configuration
clk: rockchip: rk3528: Align PPLL entry in PLL table

 drivers/clk/rockchip/clk_rk3528.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.56.1
#1 lore raw

PATCH v3 1/3 clk: rockchip: rk3528: Return correct rate for CLK_PWMx

The PWM clock getter overwrites the 100 MHz rate with the oscillator rate because the 50 MHz parent test starts a separate if-else statement.

Change to use else-if so the getter returns 100 MHz when the 100 MHz parent is selected.

Fixes 5a7a856b132f ("clk: rockchip: Add support for RK3528")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3528: Fix trivial clock configuration errors"
- Add fixes tag
- Collect r-b tag

---
 drivers/clk/rockchip/clk_rk3528.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3528.c +1 -1
index fd99b8ba5ce2..0ac6fc68cd61 100644
@@ -770,7 +770,7 @@ static ulong rk3528_pwm_get_clk(struct rk3528_clk_priv *priv, ulong clk_id)
 	sel = (con & mask) >> shift;
 	if (sel == CLK_PWM0_SEL_CLK_MATRIX_100M_SRC)
 		rate = 100 * MHz;
-	if (sel == CLK_PWM0_SEL_CLK_MATRIX_50M_SRC)
+	else if (sel == CLK_PWM0_SEL_CLK_MATRIX_50M_SRC)
 		rate = 50 * MHz;
 	else
 		rate = OSC_HZ;
Signature · 1 line
2.56.1
#2 lore raw

PATCH v3 2/3 clk: rockchip: rk3528: Fix VOP clock configuration

In reply to Jonas Karlman

Setting rate of the VOP clocks never changes the clock parent and the old divisor value is OR with new divisor value due to incorrect args being passed to rk_clrsetreg() call.

Use selector and divisor masks and values correctly in rk_clrsetreg() call to ensure VOP clocks are configured as expected.

Video is not supported for this SoC, so nothing is likely going to try to change rate of VOP clocks until video support have been implemented.

Fixes 5a7a856b132f ("clk: rockchip: Add support for RK3528")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3528: Fix trivial clock configuration errors"
- Add fixes tag
- Collect r-b tag

---
 drivers/clk/rockchip/clk_rk3528.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3528.c +1 -1
index 0ac6fc68cd61..f7e85bf26731 100644
@@ -1097,7 +1097,7 @@ static ulong rk3528_dclk_vop_set_clk(struct rk3528_clk_priv *priv,
 	}
 
 	div = ((DIV_ROUND_UP(prate, rate) - 1) << div_shift) & div_mask;
-	rk_clrsetreg(&cru->clksel_con[id], sel, div);
+	rk_clrsetreg(&cru->clksel_con[id], sel_mask | div_mask, sel | div);
 
 	return rk3528_dclk_vop_get_clk(priv, clk_id);
 }
Signature · 1 line
2.56.1
#3 lore raw

PATCH v3 3/3 clk: rockchip: rk3528: Align PPLL entry in PLL table

In reply to Jonas Karlman

Keep the PPLL entry formatted in a similar way matching the other PLL entries for consistency.

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3528: Fix trivial clock configuration errors"
- Collect r-b tag

---
 drivers/clk/rockchip/clk_rk3528.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3528.c +2 -1
index f7e85bf26731..976ef0e0a919 100644
@@ -72,7 +72,8 @@ static struct rockchip_pll_clock rk3528_pll_clks[] = {
 		     RK3528_MODE_CON, 4, 10, 0, rk3528_pll_rates),
 
 	[PPLL] = PLL(pll_rk3328, PLL_PPLL, RK3528_PCIE_PLL_CON(32),
-		     RK3528_MODE_CON, 6, 10, ROCKCHIP_PLL_FIXED_MODE, rk3528_pll_rates),
+		     RK3528_MODE_CON, 6, 10, ROCKCHIP_PLL_FIXED_MODE,
+		     rk3528_pll_rates),
 
 	[DPLL] = PLL(pll_rk3328, PLL_DPLL, RK3528_DDRPHY_PLL_CON(16),
 		     RK3528_DDRPHY_MODE_CON, 0, 10, 0, rk3528_pll_rates),
Signature · 1 line
2.56.1
#4 lore raw
In reply to Jonas Karlman
Quoted 9 lines · Jonas Karlman

This series fixes a few issues found in Rockchip RK3528 clock driver while working on a cleanup and refactoring series for RK35xx clock drivers.

Any refactoring has been held back for a future follow-up series.

Changes in v3:
- Split the series into smaller series

[...]

Applied to https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip (u-boot-rockchip-2027.04), thanks!

[1/3] clk: rockchip: rk3528: Return correct rate for CLK_PWMx

      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/b1064e9347ec44ff0e6d3fccb6db5a92a540d6ec
[2/3] clk: rockchip: rk3528: Fix VOP clock configuration
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/3f926ce3a61a15e37b83b17cd83e4b693f79b22a
[3/3] clk: rockchip: rk3528: Align PPLL entry in PLL table
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/9c652b5e08d5d29c37f8310cd3f1d0a4e6962e7f

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>