During clock's registration, clock's name are used to establish parent -
child relation. On STM32MP13, most of SCMI clocks are parent
clocks.

Since commit fdb1bffe2827 ("clk: scmi: Postpone clock name resolution"),
all scmi clocks are named by default "scmi-%zu" until they are enabled,
it breaks clocks registration and boot process for STM32MP13 platforms.

By resolving SCMI clocks before clocks registration, it solves the issue.

Fixes: fdb1bffe2827 ("clk: scmi: Postpone clock name resolution")
Signed-off-by: Patrice Chotard <[email protected]>
---
 drivers/clk/stm32/clk-stm32mp13.c | 47 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/clk/stm32/clk-stm32mp13.c 
b/drivers/clk/stm32/clk-stm32mp13.c
index 18e9ab364b4..a2696177de2 100644
--- a/drivers/clk/stm32/clk-stm32mp13.c
+++ b/drivers/clk/stm32/clk-stm32mp13.c
@@ -18,6 +18,7 @@
 #include <asm/io.h>
 #include <asm/global_data.h>
 #include <asm/arch/sys_proto.h>
+#include <clk/scmi.h>
 #include <dm/device_compat.h>
 #include <dt-bindings/clock/stm32mp13-clks.h>
 #include <dt-bindings/clock/stm32mp13-clksrc.h>
@@ -31,6 +32,40 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_TFABOOT
+const int stm32mp13_scmi_clks[] = {
+       CK_SCMI_HSE,
+       CK_SCMI_HSI,
+       CK_SCMI_CSI,
+       CK_SCMI_LSE,
+       CK_SCMI_LSI,
+       CK_SCMI_HSE_DIV2,
+       CK_SCMI_PLL2_Q,
+       CK_SCMI_PLL2_R,
+       CK_SCMI_PLL3_P,
+       CK_SCMI_PLL3_Q,
+       CK_SCMI_PLL3_R,
+       CK_SCMI_PLL4_P,
+       CK_SCMI_PLL4_Q,
+       CK_SCMI_PLL4_R,
+       CK_SCMI_MPU,
+       CK_SCMI_AXI,
+       CK_SCMI_MLAHB,
+       CK_SCMI_CKPER,
+       CK_SCMI_PCLK1,
+       CK_SCMI_PCLK2,
+       CK_SCMI_PCLK3,
+       CK_SCMI_PCLK4,
+       CK_SCMI_PCLK5,
+       CK_SCMI_PCLK6,
+       CK_SCMI_CKTIMG1,
+       CK_SCMI_CKTIMG2,
+       CK_SCMI_CKTIMG3,
+       CK_SCMI_RTC,
+       CK_SCMI_RTCAPB,
+};
+#endif
+
 static const char * const adc12_src[] = {
        "pll4_r", "ck_per", "pll3_q"
 };
@@ -1983,9 +2018,21 @@ static int stm32mp1_clk_probe(struct udevice *dev)
 
 #ifdef CONFIG_TFABOOT
        struct udevice *scmi;
+       ulong id;
+       int i;
 
        /* force SCMI probe to register all SCMI clocks */
        uclass_get_device_by_driver(UCLASS_CLK, DM_DRIVER_GET(scmi_clock), 
&scmi);
+
+       /* resolve attribute for all SCMI clocks */
+       for (i = 0; i < ARRAY_SIZE(stm32mp13_scmi_clks); i++) {
+               id = CLK_ID(scmi, stm32mp13_scmi_clks[i]);
+               err = scmi_clk_resolve_attr(id, NULL);
+               if (err) {
+                       dev_err(dev, "Failed to resolve SCMI clk %d\n",
+                               stm32mp13_scmi_clks[i]);
+               }
+       }
 #else
        err = stm32mp1_osc_init(dev);
        if (err)

-- 
2.43.0

Reply via email to