Skip to contentSkip to conversation

rockchip: Miscellaneous RK3568 clock fixes

PATCH Superseded Jonas Karlman 2 participants 6 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 RK3568 clock fixes

This series fixes a few issues found in Rockchip RK3568 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 "rk3568: Fix trivial clock configuration errors"
- Add fixes tag
- Collect r-b tags

Jonas Karlman (4):
clk: rockchip: rk3568: Use correct clock id for GPLL
clk: rockchip: rk3568: Fix PWM0 parent selection mask
clk: rockchip: rk3568: Use PWM0 divider shift
clk: rockchip: rk3568: Use correct PLL rate for CLK_MAC0_2TOP

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

PATCH v3 1/4 clk: rockchip: rk3568: Use correct clock id for GPLL

The GPLL entry incorrectly uses PLL_HPLL. Use PLL_GPLL to match the PLL represented by this entry.

Fixes 4a262feba3a5 ("rockchip: rk3568: add clock driver")

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

---
 drivers/clk/rockchip/clk_rk3568.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3568.c +1 -1
index 181917cf92a9..38c5d62493bc 100644
@@ -77,7 +77,7 @@ static struct rockchip_pll_clock rk3568_pll_clks[] = {
 		     RK3568_MODE_CON, 2, 10, 0, NULL),
 	[CPLL] = PLL(pll_rk3328, PLL_CPLL, RK3568_PLL_CON(24),
 		     RK3568_MODE_CON, 4, 10, 0, rk3568_pll_rates),
-	[GPLL] = PLL(pll_rk3328, PLL_HPLL, RK3568_PLL_CON(16),
+	[GPLL] = PLL(pll_rk3328, PLL_GPLL, RK3568_PLL_CON(16),
 		     RK3568_MODE_CON, 6, 10, 0, rk3568_pll_rates),
 	[NPLL] = PLL(pll_rk3328, PLL_NPLL, RK3568_PLL_CON(32),
 		     RK3568_MODE_CON, 10, 10, 0, rk3568_pll_rates),
Signature · 1 line
2.56.1
#2 lore raw

PATCH v3 2/4 clk: rockchip: rk3568: Fix PWM0 parent selection mask

In reply to Jonas Karlman

The CLK_PWM0 divider mask is used twice, leaving the parent selection unchanged. Change to use the intended CLK_PWM0 parent selection mask.

Fixes 4a262feba3a5 ("rockchip: rk3568: add clock driver")

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

---
 drivers/clk/rockchip/clk_rk3568.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3568.c +1 -1
index 38c5d62493bc..3651aac0ad33 100644
@@ -299,7 +299,7 @@ static ulong rk3568_pwm_set_pmuclk(struct rk3568_pmuclk_priv *priv,
 			src_clk_div = DIV_ROUND_UP(priv->ppll_hz, rate);
 			assert(src_clk_div - 1 <= 127);
 			rk_clrsetreg(&pmucru->pmu_clksel_con[6],
-				     CLK_PWM0_DIV_MASK | CLK_PWM0_DIV_MASK,
+				     CLK_PWM0_SEL_MASK | CLK_PWM0_DIV_MASK,
 				     (CLK_PWM0_SEL_PPLL << CLK_PWM0_SEL_SHIFT) |
 				     (src_clk_div - 1) << CLK_PWM0_DIV_SHIFT);
 		}
Signature · 1 line
2.56.1
#3 lore raw

PATCH v3 3/4 clk: rockchip: rk3568: Use PWM0 divider shift

In reply to Jonas Karlman

Use CLK_PWM0_DIV_SHIFT rather than CLK_PWM0_SEL_SHIFT when writing the PWM0 divider and the oscillator was selected as parent.

This has no behavior change, shifting zero by either constant still result in same zero value.

Fixes 4a262feba3a5 ("rockchip: rk3568: add clock driver")

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

---
 drivers/clk/rockchip/clk_rk3568.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3568.c +1 -1
index 3651aac0ad33..a52b6a890292 100644
@@ -294,7 +294,7 @@ static ulong rk3568_pwm_set_pmuclk(struct rk3568_pmuclk_priv *priv,
 				     CLK_PWM0_SEL_MASK | CLK_PWM0_DIV_MASK,
 				     (CLK_PWM0_SEL_XIN24M <<
 				      CLK_PWM0_SEL_SHIFT) |
-				     0 << CLK_PWM0_SEL_SHIFT);
+				     0 << CLK_PWM0_DIV_SHIFT);
 		} else {
 			src_clk_div = DIV_ROUND_UP(priv->ppll_hz, rate);
 			assert(src_clk_div - 1 <= 127);
Signature · 1 line
2.56.1
#4 lore raw

PATCH v3 4/4 clk: rockchip: rk3568: Use correct PLL rate for CLK_MAC0_2TOP

In reply to Jonas Karlman

Use the PPLL rate instead of HPLL rate when the PPLL is parent of the CLK_MAC0_2TOP clock.

Fixes 4a262feba3a5 ("rockchip: rk3568: add clock driver")

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

---
 drivers/clk/rockchip/clk_rk3568.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3568.c +1 -1
index a52b6a890292..4a8a65efc345 100644
@@ -1889,7 +1889,7 @@ static ulong rk3568_gmac_src_get_clk(struct rk3568_clk_priv *priv,
 	case CLK_MAC0_2TOP_SEL_25M:
 		return 25 * MHz;
 	case CLK_MAC0_2TOP_SEL_PPLL:
-		return rk3568_pmu_pll_get_rate(priv, HPLL);
+		return rk3568_pmu_pll_get_rate(priv, PPLL);
 	default:
 		return -ENOENT;
 	}
Signature · 1 line
2.56.1
#5 lore raw
In reply to Jonas Karlman
Quoted 9 lines · Jonas Karlman

This series fixes a few issues found in Rockchip RK3568 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/4] clk: rockchip: rk3568: Use correct clock id for GPLL

      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/165874f2f3685ac6d58543c2319b7824172a7666
[2/4] clk: rockchip: rk3568: Fix PWM0 parent selection mask
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/7e8692406c1e626935f0f188a4b1e8fe4ab3f2ac
[3/4] clk: rockchip: rk3568: Use PWM0 divider shift
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/c9a36709ded881b2eab9215a4311fd84fd736795
[4/4] clk: rockchip: rk3568: Use correct PLL rate for CLK_MAC0_2TOP
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/4c6371adb24252d16c779933e20213ca615dfefc

Best regards,

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