[PATCH 2/6] clk: scmi: Force call of scmi_clk_get_attribute() during probe

Patrice Chotard patrice.chotard at foss.st.com
Fri Nov 14 16:41:50 CET 2025


Since commit fdb1bffe2827 ("clk: scmi: Postpone clock name resolution"),
all clocks which are parent clocks are name "scmi-%zu" which
leads to error during their children clocks registration.

In order to not cancel boot time optimization done in
commit 3547e315c188 ("clk: scmi: Defer issue of SCMI_CLOCK_ATTRIBUTES"),
choice has been done to re-introduce scmi_clk_get_attribute() call
during scmi_clk_probe() under new CLK_SCMI_FORCE_ATTRIBUTE flag.

This restores boot on stm32mp13 and stm32mp2 family boards.

Fixes: fdb1bffe2827 ("clk: scmi: Postpone clock name resolution")

Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>

Cc: Alice Guo <alice.guo at nxp.com>
Cc: Marek Vasut <marek.vasut+renesas at mailbox.org>
Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Sean Anderson <seanga2 at gmail.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: Valentin Caron <valentin.caron at foss.st.com>
Cc: Vinh Nguyen <vinh.nguyen.xz at renesas.com>
Cc: u-boot at lists.denx.de
---

 drivers/clk/Kconfig    |  8 ++++++++
 drivers/clk/clk_scmi.c | 10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index b884a02bdeb..848f8635836 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -198,6 +198,14 @@ config CLK_SCMI
 	  by a SCMI agent based on SCMI clock protocol communication
 	  with a SCMI server.
 
+config CLK_SCMI_FORCE_ATTRIBUTE
+	bool "Force usage scmi_clk_get_attribute during probe"
+	depends on CLK_SCMI
+	help
+	  Force call of scmi_clk_get_attribute() during scmi_clk_probe()
+	  to allow clock registering using their name instead of default
+	  "scmi-%zu" name.
+
 config SPL_CLK_SCMI
 	bool "Enable SCMI clock driver in SPL"
 	depends on SCMI_FIRMWARE && SPL_FIRMWARE
diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index f6132178205..7315c1e03aa 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -358,8 +358,16 @@ static int scmi_clk_probe(struct udevice *dev)
 	for (i = 0; i < num_clocks; i++) {
 		clk_scmi = clk_scmi_bulk + i;
 		char *clock_name = clk_scmi->name;
+		u32 attributes;
 
-		snprintf(clock_name, SCMI_CLOCK_NAME_LENGTH_MAX, "scmi-%zu", i);
+		if (CONFIG_IS_ENABLED(CLK_SCMI_FORCE_ATTRIBUTE)) {
+			ret = scmi_clk_get_attribute(dev, i, clock_name, &attributes);
+			if (ret)
+				return ret;
+
+		} else {
+			snprintf(clock_name, SCMI_CLOCK_NAME_LENGTH_MAX, "scmi-%zu", i);
+		}
 
 		ret = clk_register(&clk_scmi->clk, dev->driver->name,
 				   clock_name, dev->name);
-- 
2.43.0



More information about the U-Boot mailing list