Skip to contentSkip to conversation

rockchip: Miscellaneous RK3588 clock fixes

PATCH Superseded Jonas Karlman 3 participants 17 messages Nov 11 – Nov 16

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover rockchip: Miscellaneous RK3588 clock fixes

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

Jonas Karlman (8):
clk: rockchip: rk3588: Use GPLL rate for CLK_TSADC
clk: rockchip: rk3588: Use correct PLL rate for SCLK_UARTx divider
clk: rockchip: rk3588: Fix ACLK_BUS_ROOT divider encoding
clk: rockchip: rk3588: Set ACLK_BUS_ROOT to 375 MHz
clk: rockchip: rk3588: Remove redundant PLL register macros
clk: rockchip: rk3588: Rename PPLL register macro
clk: rockchip: rk3588: Align BxPLL entries in PLL table
clk: rockchip: rk3588: Use SPLL_HZ constant

 .../include/asm/arch-rockchip/cru_rk3588.h    |  5 +---
 drivers/clk/rockchip/clk_rk3588.c             | 28 +++++++++----------
 2 files changed, 14 insertions(+), 19 deletions(-)
Signature · 1 line
2.56.1
#1 lore raw

PATCH v3 1/8 clk: rockchip: rk3588: Use GPLL rate for CLK_TSADC

Use the GPLL rate instead of using a hardcoded 100 MHz parent rate when GPLL is parent of the CLK_TSADC clock.

Fixes 7a474df74023 ("clk: rockchip: Add rk3588 clk support")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix trivial clock configuration errors"
- Add fixes tag

---
 drivers/clk/rockchip/clk_rk3588.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3588.c +1 -1
index 5c3b0988e6a7..58d407a12e20 100644
@@ -655,7 +655,7 @@ static ulong rk3588_adc_get_clk(struct rk3588_clk_priv *priv, ulong clk_id)
 		if (sel == CLK_TSADC_SEL_24M)
 			prate = OSC_HZ;
 		else
-			prate = 100 * MHz;
+			prate = priv->gpll_hz;
 		return DIV_TO_RATE(prate, div);
 	default:
 		return -ENOENT;
Signature · 1 line
2.56.1
Reviewed-by on v3 1/8
#2 lore raw

Re: [PATCH v3 1/8] clk: rockchip: rk3588: Use GPLL rate for CLK_TSADC

Hi Jonas,

Quoted 5 lines · Jonas Karlman

Use the GPLL rate instead of using a hardcoded 100 MHz parent rate when GPLL is parent of the CLK_TSADC clock.

Fixes 7a474df74023 ("clk: rockchip: Add rk3588 clk support")

Thanks!
Quentin

#3 lore raw

PATCH v3 2/8 clk: rockchip: rk3588: Use correct PLL rate for SCLK_UARTx divider

In reply to Jonas Karlman

Calculate the divider from the CPLL rate instead of the GPLL rate when CPLL is selected as the SCLK_UARTx parent.

Fixes 7a474df74023 ("clk: rockchip: Add rk3588 clk support")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix trivial clock configuration errors"
- Add fixes tag

---
 drivers/clk/rockchip/clk_rk3588.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3588.c +1 -1
index 58d407a12e20..73bc92027649 100644
@@ -1343,7 +1343,7 @@ static ulong rk3588_uart_set_rate(struct rk3588_clk_priv *priv,
 	} else if (priv->cpll_hz % rate == 0) {
 		clk_src = CLK_UART_SRC_SEL_CPLL;
 		uart_src = CLK_UART_SEL_SRC;
-		div = DIV_ROUND_UP(priv->gpll_hz, rate);
+		div = DIV_ROUND_UP(priv->cpll_hz, rate);
 	} else if (rate == OSC_HZ) {
 		clk_src = CLK_UART_SRC_SEL_GPLL;
 		uart_src = CLK_UART_SEL_XIN24M;
Signature · 1 line
2.56.1
Reviewed-by on v3 2/8
#4 lore raw

Re: [PATCH v3 2/8] clk: rockchip: rk3588: Use correct PLL rate for SCLK_UARTx divider

Hi Jonas,

Quoted 5 lines · Jonas Karlman

Calculate the divider from the CPLL rate instead of the GPLL rate when CPLL is selected as the SCLK_UARTx parent.

Fixes 7a474df74023 ("clk: rockchip: Add rk3588 clk support")

Thanks!
Quentin

#5 lore raw

PATCH v3 3/8 clk: rockchip: rk3588: Fix ACLK_BUS_ROOT divider encoding

In reply to Jonas Karlman

The ACLK_BUS_ROOT divider field stores the divisor minus one. Subtract one when writing the field so the clock uses the intended divisor.

Fixes 7a474df74023 ("clk: rockchip: Add rk3588 clk support")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix ACLK_BUS_ROOT rate set during probe"
- Add fixes tag
- Collect r-b tag

---
 drivers/clk/rockchip/clk_rk3588.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3588.c +1 -1
index 73bc92027649..5e9b6a1e62e1 100644
@@ -1927,7 +1927,7 @@ static void rk3588_clk_init(struct rk3588_clk_priv *priv)
 	rk_clrsetreg(&priv->cru->clksel_con[38],
 		     ACLK_BUS_ROOT_SEL_MASK |
 		     ACLK_BUS_ROOT_DIV_MASK,
-		     div << ACLK_BUS_ROOT_DIV_SHIFT);
+		     (div - 1) << ACLK_BUS_ROOT_DIV_SHIFT);
 
 	if (priv->cpll_hz != CPLL_HZ) {
 		ret = rockchip_pll_set_rate(&rk3588_pll_clks[CPLL], priv->cru,
Signature · 1 line
2.56.1
#6 lore raw

PATCH v3 4/8 clk: rockchip: rk3588: Set ACLK_BUS_ROOT to 375 MHz

In reply to Jonas Karlman

The clock driver always reports ACLK_BUS_ROOT rate as 375 MHz. However, the clock is initialized to use GPLL as parent and a target rate of 300 MHz, with GPLLs typical 1.188 GHz rate the clock ends up at 297 MHz.

Change to use CPLL as parent and request a 375 MHz rate, the same rate that is already being reported by the driver and what the SoC DT uses in assigned-clock-rates. With CPLLs typical 1.5 GHz rate, this matches the parent and rate Linux typically ends up using for this clock.

Fixes 716ed2a8c0bb ("clk: rockchip: rk3588: add hardcoded assigned clocks values")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix ACLK_BUS_ROOT rate set during probe"
- Add fixes tag
- Collect r-b tag

---
 drivers/clk/rockchip/clk_rk3588.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/rockchip/clk_rk3588.c +3 -3
index 5e9b6a1e62e1..de435f7d0ec0 100644
@@ -1923,10 +1923,10 @@ static void rk3588_clk_init(struct rk3588_clk_priv *priv)
 {
 	int ret, div;
 
-	div = DIV_ROUND_UP(GPLL_HZ, 300 * MHz);
+	div = DIV_ROUND_UP(CPLL_HZ, 375 * MHz);
 	rk_clrsetreg(&priv->cru->clksel_con[38],
-		     ACLK_BUS_ROOT_SEL_MASK |
-		     ACLK_BUS_ROOT_DIV_MASK,
+		     ACLK_BUS_ROOT_SEL_MASK | ACLK_BUS_ROOT_DIV_MASK,
+		     (ACLK_BUS_ROOT_SEL_CPLL << ACLK_BUS_ROOT_SEL_SHIFT) |
 		     (div - 1) << ACLK_BUS_ROOT_DIV_SHIFT);
 
 	if (priv->cpll_hz != CPLL_HZ) {
Signature · 1 line
2.56.1
#7 lore raw

PATCH v3 5/8 clk: rockchip: rk3588: Remove redundant PLL register macros

In reply to Jonas Karlman

Remove the duplicate RK3588_PLL_CON definition and the unused RK3588_MODE_CON definition. RK3588_MODE_CON0 is used by the driver.

Fixes 165d258386a7 ("arm: rockchip: Add cru header for rk3588")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix trivial clock configuration errors"
- Add fixes tag

---
 arch/arm/include/asm/arch-rockchip/cru_rk3588.h | 3 ---
 1 file changed, 3 deletions(-)
arch/arm/include/asm/arch-rockchip/cru_rk3588.h +0 -3
index afce8a44af3b..c83010e518ee 100644
@@ -105,9 +105,6 @@ struct pll_rate_table {
 	unsigned int k;
 };
 
-#define RK3588_PLL_CON(x)		((x) * 0x4)
-#define RK3588_MODE_CON			0x280
-
 #define RK3588_PHP_CRU_BASE		0x8000
 #define RK3588_PMU_CRU_BASE		0x30000
 #define RK3588_BIGCORE0_CRU_BASE	0x50000
Signature · 1 line
2.56.1
Reviewed-by on v3 5/8
#8 lore raw

Re: [PATCH v3 5/8] clk: rockchip: rk3588: Remove redundant PLL register macros

Hi Jonas,

Quoted 5 lines · Jonas Karlman

Remove the duplicate RK3588_PLL_CON definition and the unused RK3588_MODE_CON definition. RK3588_MODE_CON0 is used by the driver.

Fixes 165d258386a7 ("arm: rockchip: Add cru header for rk3588")

Thanks!
Quentin

#9 lore raw

PATCH v3 6/8 clk: rockchip: rk3588: Rename PPLL register macro

In reply to Jonas Karlman

The PPLL registers belong to the PHP CRU, rather than the PMU CRU. Rename the register macro and update the PPLL entry to reflect this.

Fixes 165d258386a7 ("arm: rockchip: Add cru header for rk3588")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix trivial clock configuration errors"
- Add fixes tag

---
 arch/arm/include/asm/arch-rockchip/cru_rk3588.h | 2 +-
 drivers/clk/rockchip/clk_rk3588.c               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-rockchip/cru_rk3588.h +1 -1
index c83010e518ee..39295adeb38a 100644
@@ -126,10 +126,10 @@ struct pll_rate_table {
 #define RK3588_SDMMC_CON0		0xC30
 #define RK3588_SDMMC_CON1		0xC34
 
+#define RK3588_PHP_PLL_CON(x)		((x) * 0x4 + RK3588_PHP_CRU_BASE)
 #define RK3588_PHP_CLKGATE_CON(x)	((x) * 0x4 + RK3588_PHP_CRU_BASE + 0x800)
 #define RK3588_PHP_SOFTRST_CON(x)	((x) * 0x4 + RK3588_PHP_CRU_BASE + 0xa00)
 
-#define RK3588_PMU_PLL_CON(x)		((x) * 0x4 + RK3588_PHP_CRU_BASE)
 #define RK3588_PMU_CLKSEL_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0x300)
 #define RK3588_PMU_CLKGATE_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0x800)
 #define RK3588_PMU_SOFTRST_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0xa00)
drivers/clk/rockchip/clk_rk3588.c +1 -1
index de435f7d0ec0..fb218ff995cd 100644
@@ -61,7 +61,7 @@ static struct rockchip_pll_clock rk3588_pll_clks[] = {
 		     RK3588_MODE_CON0, 2, 15, 0, rk3588_pll_rates),
 	[NPLL] = PLL(pll_rk3588, PLL_NPLL, RK3588_PLL_CON(120),
 		     RK3588_MODE_CON0, 0, 15, 0, rk3588_pll_rates),
-	[PPLL] = PLL(pll_rk3588, PLL_PPLL, RK3588_PMU_PLL_CON(128),
+	[PPLL] = PLL(pll_rk3588, PLL_PPLL, RK3588_PHP_PLL_CON(128),
 		     RK3588_MODE_CON0, 10, 15, ROCKCHIP_PLL_FIXED_MODE,
 		     rk3588_pll_rates),
 #ifdef CONFIG_XPL_BUILD
Signature · 1 line
2.56.1
Reviewed-by on v3 6/8
#10 lore raw

Re: [PATCH v3 6/8] clk: rockchip: rk3588: Rename PPLL register macro

Hi Jonas,

Quoted 5 lines · Jonas Karlman

The PPLL registers belong to the PHP CRU, rather than the PMU CRU. Rename the register macro and update the PPLL entry to reflect this.

Fixes 165d258386a7 ("arm: rockchip: Add cru header for rk3588")

I had a few other things I would have liked in this series as said in v1[1]. I'll do a follow-up with those.

Thanks!
Quentin

[1] https://lore.kernel.org/u-boot/[email protected]/

Quoted 40 lines

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix trivial clock configuration errors"
- Add fixes tag

---
  arch/arm/include/asm/arch-rockchip/cru_rk3588.h | 2 +-
  drivers/clk/rockchip/clk_rk3588.c               | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-rockchip/cru_rk3588.h +1 -1
index c83010e518ee..39295adeb38a 100644
@@ -126,10 +126,10 @@ struct pll_rate_table {
  #define RK3588_SDMMC_CON0		0xC30
  #define RK3588_SDMMC_CON1		0xC34
 
+#define RK3588_PHP_PLL_CON(x)		((x) * 0x4 + RK3588_PHP_CRU_BASE)
  #define RK3588_PHP_CLKGATE_CON(x)	((x) * 0x4 + RK3588_PHP_CRU_BASE + 0x800)
  #define RK3588_PHP_SOFTRST_CON(x)	((x) * 0x4 + RK3588_PHP_CRU_BASE + 0xa00)
 
-#define RK3588_PMU_PLL_CON(x)		((x) * 0x4 + RK3588_PHP_CRU_BASE)
  #define RK3588_PMU_CLKSEL_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0x300)
  #define RK3588_PMU_CLKGATE_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0x800)
  #define RK3588_PMU_SOFTRST_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0xa00)
drivers/clk/rockchip/clk_rk3588.c +1 -1
index de435f7d0ec0..fb218ff995cd 100644
@@ -61,7 +61,7 @@ static struct rockchip_pll_clock rk3588_pll_clks[] = {
  		     RK3588_MODE_CON0, 2, 15, 0, rk3588_pll_rates),
  	[NPLL] = PLL(pll_rk3588, PLL_NPLL, RK3588_PLL_CON(120),
  		     RK3588_MODE_CON0, 0, 15, 0, rk3588_pll_rates),
-	[PPLL] = PLL(pll_rk3588, PLL_PPLL, RK3588_PMU_PLL_CON(128),
+	[PPLL] = PLL(pll_rk3588, PLL_PPLL, RK3588_PHP_PLL_CON(128),
  		     RK3588_MODE_CON0, 10, 15, ROCKCHIP_PLL_FIXED_MODE,
  		     rk3588_pll_rates),
  #ifdef CONFIG_XPL_BUILD
#11 lore raw

Re: [PATCH v3 6/8] clk: rockchip: rk3588: Rename PPLL register macro

Hi Quentin,

Quoted 11 lines · Quentin Schulz

Hi Jonas,

Quoted 5 lines · Jonas Karlman

The PPLL registers belong to the PHP CRU, rather than the PMU CRU. Rename the register macro and update the PPLL entry to reflect this.

Fixes 165d258386a7 ("arm: rockchip: Add cru header for rk3588")

I had a few other things I would have liked in this series as said in v1[1]. I'll do a follow-up with those.

I should probably have been more precise in the cover letter, this series was primarily about fixing simple copy/paste issues ahead of a future refactoring series. And your requests in v1[1] sounded more like refactoring changes I had already changed in the intended follow-up refactoring series.

Regards,
Jonas

Quoted 50 lines

Thanks!
Quentin

[1]
https://lore.kernel.org/u-boot/[email protected]/

Quoted 40 lines

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix trivial clock configuration errors"
- Add fixes tag

---
  arch/arm/include/asm/arch-rockchip/cru_rk3588.h | 2 +-
  drivers/clk/rockchip/clk_rk3588.c               | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-rockchip/cru_rk3588.h +1 -1
index c83010e518ee..39295adeb38a 100644
@@ -126,10 +126,10 @@ struct pll_rate_table {
  #define RK3588_SDMMC_CON0		0xC30
  #define RK3588_SDMMC_CON1		0xC34
 
+#define RK3588_PHP_PLL_CON(x)		((x) * 0x4 + RK3588_PHP_CRU_BASE)
  #define RK3588_PHP_CLKGATE_CON(x)	((x) * 0x4 + RK3588_PHP_CRU_BASE + 0x800)
  #define RK3588_PHP_SOFTRST_CON(x)	((x) * 0x4 + RK3588_PHP_CRU_BASE + 0xa00)
 
-#define RK3588_PMU_PLL_CON(x)		((x) * 0x4 + RK3588_PHP_CRU_BASE)
  #define RK3588_PMU_CLKSEL_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0x300)
  #define RK3588_PMU_CLKGATE_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0x800)
  #define RK3588_PMU_SOFTRST_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0xa00)
drivers/clk/rockchip/clk_rk3588.c +1 -1
index de435f7d0ec0..fb218ff995cd 100644
@@ -61,7 +61,7 @@ static struct rockchip_pll_clock rk3588_pll_clks[] = {
  		     RK3588_MODE_CON0, 2, 15, 0, rk3588_pll_rates),
  	[NPLL] = PLL(pll_rk3588, PLL_NPLL, RK3588_PLL_CON(120),
  		     RK3588_MODE_CON0, 0, 15, 0, rk3588_pll_rates),
-	[PPLL] = PLL(pll_rk3588, PLL_PPLL, RK3588_PMU_PLL_CON(128),
+	[PPLL] = PLL(pll_rk3588, PLL_PPLL, RK3588_PHP_PLL_CON(128),
  		     RK3588_MODE_CON0, 10, 15, ROCKCHIP_PLL_FIXED_MODE,
  		     rk3588_pll_rates),
  #ifdef CONFIG_XPL_BUILD
#12 lore raw

Re: [PATCH v3 6/8] clk: rockchip: rk3588: Rename PPLL register macro

In reply to Jonas Karlman

Hi Jonas,

Quoted 37 lines · Jonas Karlman

The PPLL registers belong to the PHP CRU, rather than the PMU CRU. Rename the register macro and update the PPLL entry to reflect this.

Fixes 165d258386a7 ("arm: rockchip: Add cru header for rk3588")

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix trivial clock configuration errors"
- Add fixes tag

---
  arch/arm/include/asm/arch-rockchip/cru_rk3588.h | 2 +-
  drivers/clk/rockchip/clk_rk3588.c               | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-rockchip/cru_rk3588.h +1 -1
index c83010e518ee..39295adeb38a 100644
@@ -126,10 +126,10 @@ struct pll_rate_table {
  #define RK3588_SDMMC_CON0		0xC30
  #define RK3588_SDMMC_CON1		0xC34
 
+#define RK3588_PHP_PLL_CON(x)		((x) * 0x4 + RK3588_PHP_CRU_BASE)
  #define RK3588_PHP_CLKGATE_CON(x)	((x) * 0x4 + RK3588_PHP_CRU_BASE + 0x800)
  #define RK3588_PHP_SOFTRST_CON(x)	((x) * 0x4 + RK3588_PHP_CRU_BASE + 0xa00)
 
-#define RK3588_PMU_PLL_CON(x)		((x) * 0x4 + RK3588_PHP_CRU_BASE)
  #define RK3588_PMU_CLKSEL_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0x300)
  #define RK3588_PMU_CLKGATE_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0x800)
  #define RK3588_PMU_SOFTRST_CON(x)	((x) * 0x4 + RK3588_PMU_CRU_BASE + 0xa00)
drivers/clk/rockchip/clk_rk3588.c +0 -0
index de435f7d0ec0..fb218ff995cd 100644

drivers/clk/rockchip/clk_rk3588.c static struct rockchip_pll_clock rk3588_pll_clks[] = { · line 65

Quoted 6 lines
drivers/clk/rockchip/clk_rk3588.c +1 -1
@@ -61,7 +61,7 @@ static struct rockchip_pll_clock rk3588_pll_clks[] = {
  		     RK3588_MODE_CON0, 2, 15, 0, rk3588_pll_rates),
  	[NPLL] = PLL(pll_rk3588, PLL_NPLL, RK3588_PLL_CON(120),
  		     RK3588_MODE_CON0, 0, 15, 0, rk3588_pll_rates),
-	[PPLL] = PLL(pll_rk3588, PLL_PPLL, RK3588_PMU_PLL_CON(128),
+	[PPLL] = PLL(pll_rk3588, PLL_PPLL, RK3588_PHP_PLL_CON(128),
  		     RK3588_MODE_CON0, 10, 15, ROCKCHIP_PLL_FIXED_MODE,

This didn't apply cleanly because you based this off https://git.u-boot-project.org/u-boot/contributors/kwiboo/u-boot/-/commit/989305aa79a2791da67497fe67ce2cefec61d6ac and not main/next.

I fixed this while applying.

Cheers,
Quentin

#13 lore raw

PATCH v3 7/8 clk: rockchip: rk3588: Align BxPLL entries in PLL table

In reply to Jonas Karlman

Keep the B0PLL and B1PLL entries formatted in a similar way matching the other PLL entries for consistency.

---
Changes in v3:
- No change
Changes in v2:
- Split from "rk3588: Fix trivial clock configuration errors"

---
 drivers/clk/rockchip/clk_rk3588.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clk/rockchip/clk_rk3588.c +2 -4
index fb218ff995cd..eb589732e0ff 100644
@@ -44,11 +44,9 @@ static struct rockchip_pll_rate_table rk3588_pll_rates[] = {
 
 static struct rockchip_pll_clock rk3588_pll_clks[] = {
 	[B0PLL] = PLL(pll_rk3588, PLL_B0PLL, RK3588_B0_PLL_CON(0),
-		      RK3588_B0_PLL_MODE_CON, 0, 15, 0,
-		      rk3588_pll_rates),
+		      RK3588_B0_PLL_MODE_CON, 0, 15, 0, rk3588_pll_rates),
 	[B1PLL] = PLL(pll_rk3588, PLL_B1PLL, RK3588_B1_PLL_CON(8),
-		      RK3588_B1_PLL_MODE_CON, 0, 15, 0,
-		      rk3588_pll_rates),
+		      RK3588_B1_PLL_MODE_CON, 0, 15, 0, rk3588_pll_rates),
 	[LPLL] = PLL(pll_rk3588, PLL_LPLL, RK3588_LPLL_CON(16),
 		     RK3588_LPLL_MODE_CON, 0, 15, 0, rk3588_pll_rates),
 	[V0PLL] = PLL(pll_rk3588, PLL_V0PLL, RK3588_PLL_CON(88),
Signature · 1 line
2.56.1
Reviewed-by on v3 7/8
#14 lore raw

Re: [PATCH v3 7/8] clk: rockchip: rk3588: Align BxPLL entries in PLL table

Hi Jonas,

Quoted 3 lines · Jonas Karlman

Keep the B0PLL and B1PLL entries formatted in a similar way matching the other PLL entries for consistency.

Thanks!
Quentin

#15 lore raw

PATCH v3 8/8 clk: rockchip: rk3588: Use SPLL_HZ constant

In reply to Jonas Karlman

The SPLL rate is set to SPLL_HZ (702 MHz) in SPL phase.

Replace '702 * MHz' with use of the SPLL_HZ constant for consistency.

---
Changes in v3:
- No change
Changes in v2:
- Update commit message
- Collect r-b tag

---
 drivers/clk/rockchip/clk_rk3588.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/rockchip/clk_rk3588.c +4 -4
index eb589732e0ff..9d67bf20fd95 100644
@@ -777,7 +777,7 @@ static ulong rk3588_mmc_get_clk(struct rk3588_clk_priv *priv, ulong clk_id)
 		sel = (con & DCLK_DECOM_SEL_MASK) >>
 		      DCLK_DECOM_SEL_SHIFT;
 		if (sel == DCLK_DECOM_SEL_SPLL)
-			prate = 702 * MHz;
+			prate = SPLL_HZ;
 		else
 			prate = priv->gpll_hz;
 		return DIV_TO_RATE(prate, div);
@@ -817,9 +817,9 @@ static ulong rk3588_mmc_set_clk(struct rk3588_clk_priv *priv,
 		}
 		break;
 	case DCLK_DECOM:
-		if (!(702 * MHz % rate)) {
+		if (!(SPLL_HZ % rate)) {
 			src_clk = DCLK_DECOM_SEL_SPLL;
-			div = DIV_ROUND_UP(702 * MHz, rate);
+			div = DIV_ROUND_UP(SPLL_HZ, rate);
 		} else {
 			src_clk = DCLK_DECOM_SEL_GPLL;
 			div = DIV_ROUND_UP(priv->gpll_hz, rate);
@@ -942,7 +942,7 @@ static ulong rk3588_aclk_vop_get_clk(struct rk3588_clk_priv *priv, ulong clk_id)
 		else if (sel == ACLK_VOP_ROOT_SEL_NPLL)
 			parent = priv->npll_hz;
 		else
-			parent = 702 * MHz;
+			parent = SPLL_HZ;
 		return DIV_TO_RATE(parent, div);
 	case ACLK_VOP_LOW_ROOT:
 		con = readl(&cru->clksel_con[110]);
Signature · 1 line
2.56.1
#16 lore raw
In reply to Jonas Karlman
Quoted 24 lines · Jonas Karlman

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

Jonas Karlman (8):
clk: rockchip: rk3588: Use GPLL rate for CLK_TSADC
clk: rockchip: rk3588: Use correct PLL rate for SCLK_UARTx divider
clk: rockchip: rk3588: Fix ACLK_BUS_ROOT divider encoding
clk: rockchip: rk3588: Set ACLK_BUS_ROOT to 375 MHz
clk: rockchip: rk3588: Remove redundant PLL register macros
clk: rockchip: rk3588: Rename PPLL register macro
clk: rockchip: rk3588: Align BxPLL entries in PLL table
clk: rockchip: rk3588: Use SPLL_HZ constant

Quoted 4 lines
  .../include/asm/arch-rockchip/cru_rk3588.h    |  5 +---
  drivers/clk/rockchip/clk_rk3588.c             | 28 +++++++++----------
  2 files changed, 14 insertions(+), 19 deletions(-)

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

[1/8] clk: rockchip: rk3588: Use GPLL rate for CLK_TSADC

https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/3d65de11dc776409756fce5579c06a9cefb3ce58
[2/8] clk: rockchip: rk3588: Use correct PLL rate for SCLK_UARTx divider

https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/4de7270740e042d7c27aacb9f12b3d16280574bb
[3/8] clk: rockchip: rk3588: Fix ACLK_BUS_ROOT divider encoding

https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/4139c4e2950dc2f3c5269f2d604f2420999f9ba8
[4/8] clk: rockchip: rk3588: Set ACLK_BUS_ROOT to 375 MHz

https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/264835487a0c2dc21b61404b0bd1b0f89514927f
[5/8] clk: rockchip: rk3588: Remove redundant PLL register macros

https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/dbd9ed3b8a328348d07df9a31c5e68ae32ef3faf
[6/8] clk: rockchip: rk3588: Rename PPLL register macro

https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/3dfc400ab7d91bf05a30d72db0974431a781290e
[7/8] clk: rockchip: rk3588: Align BxPLL entries in PLL table

https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/0f8b254f8197987b774120ea244ed36f047c5799
[8/8] clk: rockchip: rk3588: Use SPLL_HZ constant

https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/aa2b49798946f97dff8b5bb989ed50314deb18fc

Best regards,

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