Skip to contentSkip to conversation

rockchip: Always init clocks in SPL build for RK35xx

PATCH Superseded Jonas Karlman 5 participants 18 messages Aug 4 – Oct 9

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover rockchip: Always init clocks in SPL build for RK35xx

This series flag clock drivers for probe after bind in SPL builds for a few RK35xx SoCs that require core PLLs and clocks to be initialized at an early phase.

This should help e.g. ensure SPLL is initialized correctly on RK3588 and CPU core rate is initialized on RK3576 when booting from RAM/USB.

The series may possible depend on the series "rockchip: Miscellaneous RK35xx clock fixes" [1] for a clean apply.

[1] https://patchwork.ozlabs.org/cover/2278934/

Jonas Karlman (4):
clk: rockchip: rk3568: Always init clocks in SPL build
clk: rockchip: rk3588: Always init clocks in SPL build
clk: rockchip: rk3576: Always init clocks in SPL build
clk: rockchip: rk3528: Always init clocks in SPL build

 drivers/clk/rockchip/clk_rk3528.c |  4 ++++
 drivers/clk/rockchip/clk_rk3568.c |  4 ++++
 drivers/clk/rockchip/clk_rk3576.c |  4 ++++
 drivers/clk/rockchip/clk_rk3588.c | 14 ++++++++++++++
 4 files changed, 26 insertions(+)
Signature · 1 line
2.54.0
#1 lore raw

PATCH 1/4 clk: rockchip: rk3568: Always init clocks in SPL build

The ACLK_BUS clock is initialized to 150 MHz in SPL on RK3568.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

---
 drivers/clk/rockchip/clk_rk3568.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/clk/rockchip/clk_rk3568.c +4 -0
index 9f3e9322161e..5a05f1b4de00 100644
@@ -2934,6 +2934,10 @@ static int rk3568_clk_bind(struct udevice *dev)
 	struct udevice *sys_child;
 	struct sysreset_reg *priv;
 
+	/* Ensure clocks are initialized after bind in SPL build */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
 	/* The reset driver does not have a device node, so bind it here */
 	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
 				 &sys_child);
Signature · 1 line
2.54.0
#2 lore raw

Re: [PATCH 1/4] clk: rockchip: rk3568: Always init clocks in SPL build

Hi Jonas,

Quoted 7 lines · Jonas Karlman

clk: rockchip: rk3568: Always init clocks in SPL build

The ACLK_BUS clock is initialized to 150 MHz in SPL on RK3568.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

Just to check: "is initialized to 150 MHz" reads as if this already happens. My understanding is that probe() contains the ACLK_BUS setup, but nothing forces the CRU to be probed in SPL, so it is silently skipped. Please spell that out - something like "the clock driver is currently only probed on demand, so the ACLK_BUS init in probe() is skipped when no SPL consumer references it" - so the motivation matches the speedup Alexey reported on the rk3576 patch.

Quoted 11 lines

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

drivers/clk/rockchip/clk_rk3568.c | 4 ++++

 1 file changed, 4 insertions(+)

drivers/clk/rockchip/clk_rk3568.c static int rk3568_clk_bind(struct udevice *dev) · line 2944

Quoted 7 lines
drivers/clk/rockchip/clk_rk3568.c +4 -0
@@ -2938,6 +2938,10 @@ static int rk3568_clk_bind(struct udevice *dev)
      struct udevice *sys_child;
      struct sysreset_reg *priv;
 
+     /* Ensure clocks are initialized after bind in SPL build */
+     if (IS_ENABLED(CONFIG_SPL_BUILD))
+             dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+

Have you considered marking the CRU node bootph-all (or equivalent) in the DT instead? That is the more usual DM way to force a device up early, and it avoids sprinkling a phase check into every SoC driver. If PROBE_AFTER_BIND is genuinely the right hammer here, please add a note in the commit message explaining why.

Regards,
Simon

#3 lore raw

Re: [PATCH 1/4] clk: rockchip: rk3568: Always init clocks in SPL build

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Jonas,

Quoted 7 lines · Jonas Karlman

clk: rockchip: rk3568: Always init clocks in SPL build

The ACLK_BUS clock is initialized to 150 MHz in SPL on RK3568.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

Quoted 7 lines

Just to check: "is initialized to 150 MHz" reads as if this already happens. My understanding is that probe() contains the ACLK_BUS setup, but nothing forces the CRU to be probed in SPL, so it is silently skipped. Please spell that out - something like "the clock driver is currently only probed on demand, so the ACLK_BUS init in probe() is skipped when no SPL consumer references it" - so the motivation matches the speedup Alexey reported on the rk3576 patch.

Correct, I will reword the commit message.

Unless the clock driver is probed in SPL, the ACLK_BUS never gets initialized to 150 MHz.

Quoted 15 lines
Quoted 15 lines

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

drivers/clk/rockchip/clk_rk3568.c | 4 ++++

 1 file changed, 4 insertions(+)
drivers/clk/rockchip/clk_rk3568.c +0 -0
@@ -2938,6 +2938,10 @@ static int rk3568_clk_bind(struct udevice *dev)
      struct udevice *sys_child;
      struct sysreset_reg *priv;
 
Quoted 10 lines

drivers/clk/rockchip/clk_rk3568.c static int rk3568_clk_bind(struct udevice *dev) · line 2940

Quoted 4 lines
drivers/clk/rockchip/clk_rk3568.c +4 -0
+     /* Ensure clocks are initialized after bind in SPL build */
+     if (IS_ENABLED(CONFIG_SPL_BUILD))
+             dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+

Have you considered marking the CRU node bootph-all (or equivalent) in the DT instead? That is the more usual DM way to force a device up early, and it avoids sprinkling a phase check into every SoC driver. If PROBE_AFTER_BIND is genuinely the right hammer here, please add a note in the commit message explaining why.

Use of bootph-all does not automatically triggers probe of the device.

The main issue is the on demand driver probing, and depending on what boot source is used the clock driver may never be probed in SPL, e.g. when booting from RAM/USB.

We should possible move out some of these one-time clock initialization into e.g. arch_cpu_init() or similar in future to avoid having to use probe after bind.

Regards,
Jonas

Quoted 3 lines

Regards,
Simon

Reviewed-by
#4 lore raw

Re: [PATCH 1/4] clk: rockchip: rk3568: Always init clocks in SPL build

Hi Jonas,

Quoted 54 lines · Jonas Karlman

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Jonas,

Quoted 7 lines · Jonas Karlman

clk: rockchip: rk3568: Always init clocks in SPL build

The ACLK_BUS clock is initialized to 150 MHz in SPL on RK3568.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

Quoted 7 lines

Just to check: "is initialized to 150 MHz" reads as if this already happens. My understanding is that probe() contains the ACLK_BUS setup, but nothing forces the CRU to be probed in SPL, so it is silently skipped. Please spell that out - something like "the clock driver is currently only probed on demand, so the ACLK_BUS init in probe() is skipped when no SPL consumer references it" - so the motivation matches the speedup Alexey reported on the rk3576 patch.

Correct, I will reword the commit message.

Unless the clock driver is probed in SPL, the ACLK_BUS never gets initialized to 150 MHz.

Quoted 15 lines
Quoted 15 lines

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

drivers/clk/rockchip/clk_rk3568.c | 4 ++++

 1 file changed, 4 insertions(+)
drivers/clk/rockchip/clk_rk3568.c +0 -0
@@ -2938,6 +2938,10 @@ static int rk3568_clk_bind(struct udevice *dev)
      struct udevice *sys_child;
      struct sysreset_reg *priv;
 
Quoted 10 lines

drivers/clk/rockchip/clk_rk3568.c static int rk3568_clk_bind(struct udevice *dev) · line 2940

Quoted 4 lines
drivers/clk/rockchip/clk_rk3568.c +4 -0
+     /* Ensure clocks are initialized after bind in SPL build */
+     if (IS_ENABLED(CONFIG_SPL_BUILD))
+             dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+

Have you considered marking the CRU node bootph-all (or equivalent) in the DT instead? That is the more usual DM way to force a device up early, and it avoids sprinkling a phase check into every SoC driver. If PROBE_AFTER_BIND is genuinely the right hammer here, please add a note in the commit message explaining why.

Quoted 5 lines

Use of bootph-all does not automatically triggers probe of the device.

The main issue is the on demand driver probing, and depending on what boot source is used the clock driver may never be probed in SPL, e.g. when booting from RAM/USB.

Ah yes, good point. I had assumed that any boot device would request the clock.

Quoted 4 lines

We should possible move out some of these one-time clock initialization into e.g. arch_cpu_init() or similar in future to avoid having to use probe after bind.

Also if you just need it to be done before booting, I suppose it could be done later. But what you have sems fine.

So with the reword:

Regards,
Simon

#5 lore raw

Re: [PATCH 1/4] clk: rockchip: rk3568: Always init clocks in SPL build

In reply to Jonas Karlman

Hi Jonas,

Quoted 5 lines · Jonas Karlman

The ACLK_BUS clock is initialized to 150 MHz in SPL on RK3568.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

You explain what this does but not why? What are the symptoms? Why is this the proper way to fix the issue?

Based on Heiko's message, I'm guessing the issue is that we need something to setup clocks that are only accessible from the secure world and SPL happens to be running in it, but not proper (nor is the kernel). Hence why Heiko needs this in order for the "DSI panel to work again" (I'm assuming in the kernel hence why any fix in any driver/device tree to enable the clock is not gonna help with the issue).

This seems to be a bandaid patch instead of fixing the issue (that is, the kernel should enable/control this clock through some mechanisms, e.g. by interacting with TF-A through SCMI).

Heiko also said "my DSI panel work again" which implies it worked at some point and got broken since, so it'd be nice to know what broke it so we can have all the clues necessary to fix the issue in the long term. Considering we broke something, I won't resist too much on this patch even though based on the above guesses we're fixing a kernel bug in U-Boot.

Can you please confirm my guess or clarify?

Cheers,
Quentin

Quoted 20 lines
---
  drivers/clk/rockchip/clk_rk3568.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/clk/rockchip/clk_rk3568.c +4 -0
index 9f3e9322161e..5a05f1b4de00 100644
@@ -2934,6 +2934,10 @@ static int rk3568_clk_bind(struct udevice *dev)
  	struct udevice *sys_child;
  	struct sysreset_reg *priv;
 
+	/* Ensure clocks are initialized after bind in SPL build */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
  	/* The reset driver does not have a device node, so bind it here */
  	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
  				 &sys_child);
#6 lore raw

Re: [PATCH 1/4] clk: rockchip: rk3568: Always init clocks in SPL build

Hi Quentin,

Quoted 11 lines · Quentin Schulz

Hi Jonas,

Quoted 5 lines · Jonas Karlman

The ACLK_BUS clock is initialized to 150 MHz in SPL on RK3568.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3568.

You explain what this does but not why? What are the symptoms? Why is this the proper way to fix the issue?

Hum, as mentioned above and in cover letter, a few clocks/PLLs needs to be initialized at SPL phase.

"""
This series flag clock drivers for probe after bind in SPL builds for a few RK35xx SoCs that require core PLLs and clocks to be initialized at an early phase.

This should help e.g. ensure SPLL is initialized correctly on RK3588 and CPU core rate is initialized on RK3576 when booting from RAM/USB. """

The clock driver always used to probe in SPL back when these drivers where added, however changes/optimizations have with time changed this and now there are boot paths that never trigger a clock driver probe in SPL, so clocks may no longer be initialized as currently expected.

This series ensure that the expected clocks are always initialized in SPL, i.e. restores the old and tested behavior.

Quoted 7 lines

Based on Heiko's message, I'm guessing the issue is that we need something to setup clocks that are only accessible from the secure world and SPL happens to be running in it, but not proper (nor is the kernel). Hence why Heiko needs this in order for the "DSI panel to work again" (I'm assuming in the kernel hence why any fix in any driver/device tree to enable the clock is not gonna help with the issue).

If I remember correctly one of the clocks used in DSI pipeline may depend on the SPLL, possible use the SPLL in parent clock tree. I think a patch to set SPLL rate to fix something in OS was applied some time ago.

Quoted 4 lines

This seems to be a bandaid patch instead of fixing the issue (that is, the kernel should enable/control this clock through some mechanisms, e.g. by interacting with TF-A through SCMI).

A few PLLs and clocks use strange or bad reset defaults, so clock driver tries to normalize/make adjustments of these clocks to help support the remaining default clock tree and rates.

Some of these PLLs affects CPU core rate others use these clocks as parent clocks, so we want to normalize/adjust to the safe and expected defaults as early as possible (SPL phase).

For current mainline unsupported SoCs I added a brief comment for any such adjustments that are made by clock driver, e.g. for RV1126B:

	/*
	 * Change CLK_CPLL_DIV10 (100M) from using reset default 10 (9)
	 * divider to 12 (11) divider to prevent overclocking to 118.8
	 * MHz when GPLL rate is changed below, after changes: 99 MHz
	 */
	writel(FIELD_PREP_WM16(CLK_CPLL_DIV10_SEL_MASK, CLK_CPLL_DIV10_SEL_GPLL) |
	       FIELD_PREP_WM16(CLK_CPLL_DIV10_DIV_MASK, 11),
	       RV1126B_CLKSEL_CON(1));

	/*
	 * Change CLK_GPLL_DIV6 (200M) from using reset default 4 (3)
	 * divider to 6 (5) divider to prevent overclocking to 297 MHz
	 * when GPLL rate is changed below, after changes: 198 MHz
	 */
	writel(FIELD_PREP_WM16(CLK_GPLL_DIV6_DIV_MASK, 5),
	       RV1126B_CLKSEL_CON(2));

I have delayed any such analysis and change to existing clock drivers for a future clock improvement/refactor series, in this series I only intend to restore the old behavior and apply clocks before SPL boot devices are tested and not put too much weight into why we do it.

Quoted 9 lines

Heiko also said "my DSI panel work again" which implies it worked at some point and got broken since, so it'd be nice to know what broke it so we can have all the clues necessary to fix the issue in the long term. Considering we broke something, I won't resist too much on this patch even though based on the above guesses we're fixing a kernel bug in U-Boot.

Can you please confirm my guess or clarify?

See above for some details, in short: old code depends on that probe of a boot udevice has a side-effect that clock driver is probed. Here we instead ensure clocks are probed/initialized in a more controlled way.

Following commits have at least helped escalate this latent issue:
- c6bba31dbdd4 rockchip: spl-boot-order: Defer probe of boot device
- e22335a221f8 rockchip: Add support for RAM boot from maskrom mode All udevices are no longer probed before they are boot tested in SPL and RAM boot does not need any clocks.

Regards,
Jonas

Quoted 25 lines

Cheers,
Quentin

Quoted 20 lines
---
  drivers/clk/rockchip/clk_rk3568.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/clk/rockchip/clk_rk3568.c +4 -0
index 9f3e9322161e..5a05f1b4de00 100644
@@ -2934,6 +2934,10 @@ static int rk3568_clk_bind(struct udevice *dev)
  	struct udevice *sys_child;
  	struct sysreset_reg *priv;
 
+	/* Ensure clocks are initialized after bind in SPL build */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
  	/* The reset driver does not have a device node, so bind it here */
  	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
  				 &sys_child);
#7 lore raw

PATCH 2/4 clk: rockchip: rk3588: Always init clocks in SPL build

In reply to Jonas Karlman

The CPU PLLs and SPLL are only initialized in SPL on RK3588.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3588.

---
 drivers/clk/rockchip/clk_rk3588.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/clk/rockchip/clk_rk3588.c +14 -0
index 5236c3fa985e..5313457aec92 100644
@@ -2004,6 +2004,10 @@ static int rk3588_clk_bind(struct udevice *dev)
 	struct udevice *sys_child;
 	struct sysreset_reg *priv;
 
+	/* Ensure clocks are initialized after bind in SPL build */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
 	/* The reset driver does not have a device node, so bind it here */
 	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
 				 &sys_child);
@@ -2133,6 +2137,15 @@ static int rk3588_scru_clk_probe(struct udevice *dev)
 	return 0;
 }
 
+static int rk3588_scru_clk_bind(struct udevice *dev)
+{
+	/* Ensure clocks are initialized after bind in SPL build */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
+	return 0;
+}
+
 static const struct clk_ops rk3588_scru_clk_ops = {
 	.get_rate = rk3588_scru_clk_get_rate,
 	.set_rate = rk3588_scru_clk_set_rate,
@@ -2142,6 +2155,7 @@ U_BOOT_DRIVER(rockchip_rk3588_scru) = {
 	.name	= "rockchip_rk3588_scru",
 	.id	= UCLASS_CLK,
 	.ops	= &rk3588_scru_clk_ops,
+	.bind	= rk3588_scru_clk_bind,
 	.probe	= rk3588_scru_clk_probe,
 };
 
Signature · 1 line
2.54.0
#8 lore raw

Re: [PATCH 2/4] clk: rockchip: rk3588: Always init clocks in SPL build

Hi Jonas,

Quoted 15 lines · Jonas Karlman

clk: rockchip: rk3588: Always init clocks in SPL build

The CPU PLLs and SPLL are only initialized in SPL on RK3588.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3588.

drivers/clk/rockchip/clk_rk3588.c | 14 ++++++++++++++

 1 file changed, 14 insertions(+)
drivers/clk/rockchip/clk_rk3588.c +0 -0
@@ -2138,6 +2142,15 @@ static int rk3588_scru_clk_probe(struct udevice *dev)
      return 0;

drivers/clk/rockchip/clk_rk3588.c static int rk3588_scru_clk_probe(struct udevice *dev) · line 2152

Quoted 10 lines
drivers/clk/rockchip/clk_rk3588.c +8 -0
 }
 
+static int rk3588_scru_clk_bind(struct udevice *dev)
+{
+     /* Ensure clocks are initialized after bind in SPL build */
+     if (IS_ENABLED(CONFIG_SPL_BUILD))
+             dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
+     return 0;
+}

The entire SCRU section starting at line 2052 is wrapped in #ifdef CONFIG_XPL_BUILD, so this bind function only exists in an XPL build - s0 are you specifically wanting this to only happen in the SPL phase? If so, I think you should use xpl_phase() == PHASE_SPL

drivers/clk/rockchip/clk_rk3588.c static int rk3588_clk_bind(struct udevice *dev) · line 2015

Quoted 9 lines
drivers/clk/rockchip/clk_rk3588.c +4 -0
@@ -2009,6 +2009,10 @@ static int rk3588_clk_bind(struct udevice *dev)
      struct udevice *sys_child;
      struct sysreset_reg *priv;
 
+     /* Ensure clocks are initialized after bind in SPL build */
+     if (IS_ENABLED(CONFIG_SPL_BUILD))
+             dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+

Same question here.

Regards,
Simon

#9 lore raw

Re: [PATCH 2/4] clk: rockchip: rk3588: Always init clocks in SPL build

Hi Simon,

Quoted 20 lines · Simon Glass

Hi Jonas,

Quoted 17 lines · Jonas Karlman

clk: rockchip: rk3588: Always init clocks in SPL build

The CPU PLLs and SPLL are only initialized in SPL on RK3588.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3588.

drivers/clk/rockchip/clk_rk3588.c | 14 ++++++++++++++

 1 file changed, 14 insertions(+)
drivers/clk/rockchip/clk_rk3588.c +0 -0
@@ -2138,6 +2142,15 @@ static int rk3588_scru_clk_probe(struct udevice *dev)
      return 0;
 }
 
Quoted 13 lines

drivers/clk/rockchip/clk_rk3588.c static int rk3588_scru_clk_probe(struct udevice *dev) · line 2147

Quoted 8 lines
drivers/clk/rockchip/clk_rk3588.c +8 -0
+static int rk3588_scru_clk_bind(struct udevice *dev)
+{
+     /* Ensure clocks are initialized after bind in SPL build */
+     if (IS_ENABLED(CONFIG_SPL_BUILD))
+             dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
+     return 0;
+}

The entire SCRU section starting at line 2052 is wrapped in #ifdef CONFIG_XPL_BUILD, so this bind function only exists in an XPL build - s0 are you specifically wanting this to only happen in the SPL phase? If so, I think you should use xpl_phase() == PHASE_SPL

Correct, this should only happen in SPL builds, as originally intended.

The change to XPL came from "drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD" and you not wanting to address my remarks about the unintended changes for the Rockchip platform ;-)

I have future refactoring plans for all RK35xx clock drivers, e.g. change to use FIELD_PREP_WM16 and more, was hoping to defer the unintended use of XPL_BUILD until such future series.

For now we only have SPL support for RK35xx, so the mixed use of XPL and SPL have no real difference until that changes.

Regards,
Jonas

Quoted 15 lines

drivers/clk/rockchip/clk_rk3588.c static int rk3588_clk_bind(struct udevice *dev) · line 2015

Quoted 10 lines
drivers/clk/rockchip/clk_rk3588.c +4 -0
@@ -2009,6 +2009,10 @@ static int rk3588_clk_bind(struct udevice *dev)
      struct udevice *sys_child;
      struct sysreset_reg *priv;
 
+     /* Ensure clocks are initialized after bind in SPL build */
+     if (IS_ENABLED(CONFIG_SPL_BUILD))
+             dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+

Same question here.

Regards,
Simon

#10 lore raw

PATCH 3/4 clk: rockchip: rk3576: Always init clocks in SPL build

In reply to Jonas Karlman

The ore PLLs are only initialized in SPL on RK3576.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3576.

---
 drivers/clk/rockchip/clk_rk3576.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/clk/rockchip/clk_rk3576.c +4 -0
index 75b705ffba2f..1988f0472dec 100644
@@ -2526,6 +2526,10 @@ static int rk3576_clk_bind(struct udevice *dev)
 	struct udevice *sys_child;
 	struct sysreset_reg *priv;
 
+	/* Ensure clocks are initialized after bind in SPL build */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
 	/* The reset driver does not have a device node, so bind it here */
 	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
 				 &sys_child);
Signature · 1 line
2.54.0
Tested-by on v1 3/4
#11 lore raw

Re: [PATCH 3/4] clk: rockchip: rk3576: Always init clocks in SPL build

Hi Jonas,

Thanks a lot for your work on this!

Quoted 2 lines · Jonas Karlman

The ore PLLs are only initialized in SPL on RK3576.

/s/ore/core/ ?

Quoted 7 lines

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3576.

---
 drivers/clk/rockchip/clk_rk3576.c | 4 ++++
 1 file changed, 4 insertions(+)

Tested it with my 41MB Falcon Linux payload on a Flipper One (RK3576), and it gives a very noticeable improvement in loading speed: time from start of BL33 to initramfs goes down from ~20s to ~3s, which is quite welcome :)

Best regards,
Alexey

#12 lore raw

Re: [PATCH 3/4] clk: rockchip: rk3576: Always init clocks in SPL build

Hi Alexey,

Quoted 3 lines · Alexey Charkov

Hi Jonas,

Thanks a lot for your work on this!

Thanks for testing!

I think using the 'probe after bind' flag ended up being the most logical way to ensure the clocks are initialized early in SPL.

Quoted 6 lines · Jonas Karlman
Quoted 2 lines

The ore PLLs are only initialized in SPL on RK3576.

/s/ore/core/ ?

Hehe, correct, my bad, that is what happens when one tries to send out patches in the middle of the night ;-)

Will send a v2 unless Quentin wants to fixup when applying.

Regards,
Jonas

Quoted 18 lines
Quoted 8 lines

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3576.

---
 drivers/clk/rockchip/clk_rk3576.c | 4 ++++
 1 file changed, 4 insertions(+)

Tested it with my 41MB Falcon Linux payload on a Flipper One (RK3576), and it gives a very noticeable improvement in loading speed: time from start of BL33 to initramfs goes down from ~20s to ~3s, which is quite welcome :)

Best regards,
Alexey

#13 lore raw

Re: [PATCH 3/4] clk: rockchip: rk3576: Always init clocks in SPL build

In reply to Alexey Charkov

Hi Alexey, Jonas,

Quoted 18 lines · Alexey Charkov

Hi Jonas,

Thanks a lot for your work on this!

Quoted 2 lines · Jonas Karlman

The ore PLLs are only initialized in SPL on RK3576.

/s/ore/core/ ?

Quoted 7 lines

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3576.

---
  drivers/clk/rockchip/clk_rk3576.c | 4 ++++
  1 file changed, 4 insertions(+)
Quoted 5 lines

Tested it with my 41MB Falcon Linux payload on a Flipper One (RK3576), and it gives a very noticeable improvement in loading speed: time from start of BL33 to initramfs goes down from ~20s to ~3s, which is quite welcome :)

OK but why this improvement? Which clock(s) is responsible for this speed improvement? This sounds a bit like CPU OPPs without controlling the regulator and it worries me, but maybe I'm wrong here?

Please help me understand what this actually fixes/helps with and how.

Cheers,
Quentin

#14 lore raw

Re: [PATCH 3/4] clk: rockchip: rk3576: Always init clocks in SPL build

Hi Quentin,

Quoted 27 lines · Quentin Schulz

Hi Alexey, Jonas,

Quoted 18 lines · Alexey Charkov

Hi Jonas,

Thanks a lot for your work on this!

Quoted 2 lines · Jonas Karlman

The ore PLLs are only initialized in SPL on RK3576.

/s/ore/core/ ?

Quoted 7 lines

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3576.

---
  drivers/clk/rockchip/clk_rk3576.c | 4 ++++
  1 file changed, 4 insertions(+)
Quoted 5 lines

Tested it with my 41MB Falcon Linux payload on a Flipper One (RK3576), and it gives a very noticeable improvement in loading speed: time from start of BL33 to initramfs goes down from ~20s to ~3s, which is quite welcome :)

Quoted 5 lines

OK but why this improvement? Which clock(s) is responsible for this speed improvement? This sounds a bit like CPU OPPs without controlling the regulator and it worries me, but maybe I'm wrong here?

Please help me understand what this actually fixes/helps with and how.

My understanding is that the CPU core clock (or other PLL) is running very slow at default rate out of reset and this causes slow boot speeds. Vendor U-Boot seem to also set CPU/PLL rates in very early boot phase.

Alexey likely have more details for the RK3576 specific case.

Regards,
Jonas

Quoted 3 lines

Cheers,
Quentin

Reviewed-by on v1 3/4
#15 lore raw

Re: [PATCH 3/4] clk: rockchip: rk3576: Always init clocks in SPL build

In reply to Jonas Karlman

Hi Jonas,

Quoted 4 lines · Jonas Karlman

clk: rockchip: rk3576: Always init clocks in SPL build

The ore PLLs are only initialized in SPL on RK3576.

Typo — ore should be core.

Quoted 11 lines

The ore PLLs are only initialized in SPL on RK3576.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3576.

drivers/clk/rockchip/clk_rk3576.c | 4 ++++

 1 file changed, 4 insertions(+)

Regards,
Simon

#16 lore raw

PATCH 4/4 clk: rockchip: rk3528: Always init clocks in SPL build

In reply to Jonas Karlman

The core PLLs and clocks are only initialized in SPL on RK3528.

Ensure clock driver is always probed after bind for SPL builds to initialize core PLLs and clocks in SPL phase on RK3528.

---
 drivers/clk/rockchip/clk_rk3528.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/clk/rockchip/clk_rk3528.c +4 -0
index 83e302dbc3c4..976ef0e0a919 100644
@@ -1715,6 +1715,10 @@ static int rk3528_clk_bind(struct udevice *dev)
 	struct sysreset_reg *priv;
 	int ret;
 
+	/* Ensure clocks are initialized after bind in SPL build */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
 	/* The reset driver does not have a device node, so bind it here */
 	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
 				 &sys_child);
Signature · 1 line
2.54.0
maintainer Tested-by on the v1 series
#17 lore raw
In reply to Jonas Karlman

Am Dienstag, 4. August 2026, 02:26:38 Mitteleuropäische Sommerzeit schrieb Jonas Karlman:

Quoted 11 lines

This series flag clock drivers for probe after bind in SPL builds for a few RK35xx SoCs that require core PLLs and clocks to be initialized at an early phase.

This should help e.g. ensure SPLL is initialized correctly on RK3588 and CPU core rate is initialized on RK3576 when booting from RAM/USB.

The series may possible depend on the series "rockchip: Miscellaneous RK35xx clock fixes" [1] for a clean apply.

[1] https://patchwork.ozlabs.org/cover/2278934/

This and the misc fixes series together make my DSI panel work again, which seemingly broke somewhere in between.

Thanks
Heiko