Skip to contentSkip to conversation

clk: ti: mux: resolve parent clocks by DT index, not by name

PATCH Applied Mathieu Dubois-Briand 5 participants 22 messages Jul 27 – Sep 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover clk: ti: mux: resolve parent clocks by DT index, not by name

This commit aims to solve an issue I've been describing a few months ago on AM335x SoC [1]. I believe using the parent_data field of clk_init_data structure is now the preferred way to convey that data, and it should be more reliable than string comparisons.

[1]: https://lore.kernel.org/all/[email protected]/

---
Changes in v2:
- Also use clk_parent_data structure in composite.c.
- Rebase on v7.2-rc5.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Mathieu Dubois-Briand (2):
clk: ti: mux: resolve parent clocks by DT index, not by name
clk: ti: composite: resolve parent clocks by DT index, not by name

 drivers/clk/ti/composite.c | 26 ++++++++++++++------------
 drivers/clk/ti/mux.c       | 20 +++++++++++---------
 2 files changed, 25 insertions(+), 21 deletions(-)

---
base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
change-id: 20260713-mathieu-wdt-clock-theo-f0c5ba58e258

Best regards,

Signature · 1 line
Mathieu Dubois-Briand <[email protected]>
#1 lore raw

PATCH v2 1/2 clk: ti: mux: resolve parent clocks by DT index, not by name

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")
---
 drivers/clk/ti/mux.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/clk/ti/mux.c +11 -9
index d6a0ccfd81db..ded4432f7528 100644
@@ -119,7 +119,7 @@ const struct clk_ops ti_clk_mux_ops = {
 };
 
 static struct clk *_register_mux(struct device_node *node, const char *name,
-				 const char * const *parent_names,
+				 const struct clk_parent_data *parent_data,
 				 u8 num_parents, unsigned long flags,
 				 struct clk_omap_reg *reg, u8 shift, u32 mask,
 				 s8 latch, u8 clk_mux_flags, u32 *table)
@@ -136,7 +136,7 @@ static struct clk *_register_mux(struct device_node *node, const char *name,
 	init.name = name;
 	init.ops = &ti_clk_mux_ops;
 	init.flags = flags;
-	init.parent_names = parent_names;
+	init.parent_data = parent_data;
 	init.num_parents = num_parents;
 
 	/* struct clk_mux assignments */
@@ -167,24 +167,26 @@ static void of_mux_clk_setup(struct device_node *node)
 	struct clk *clk;
 	struct clk_omap_reg reg;
 	unsigned int num_parents;
-	const char **parent_names;
+	struct clk_parent_data *parent_data;
 	const char *name;
 	u8 clk_mux_flags = 0;
 	u32 mask = 0;
 	u32 shift = 0;
 	s32 latch = -EINVAL;
 	u32 flags = CLK_SET_RATE_NO_REPARENT;
+	int i;
 
 	num_parents = of_clk_get_parent_count(node);
 	if (num_parents < 2) {
 		pr_err("mux-clock %pOFn must have parents\n", node);
 		return;
 	}
-	parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
-	if (!parent_names)
-		goto cleanup;
+	parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);
+	if (!parent_data)
+		return;
 
-	of_clk_parent_fill(node, parent_names, num_parents);
+	for (i = 0; i < num_parents; i++)
+		parent_data[i].index = i;
 
 	if (ti_clk_get_reg_addr(node, 0, &reg))
 		goto cleanup;
@@ -207,7 +209,7 @@ static void of_mux_clk_setup(struct device_node *node)
 	mask = (1 << fls(mask)) - 1;
 
 	name = ti_dt_clk_name(node);
-	clk = _register_mux(node, name, parent_names, num_parents,
+	clk = _register_mux(node, name, parent_data, num_parents,
 			    flags, &reg, shift, mask, latch, clk_mux_flags,
 			    NULL);
 
@@ -215,7 +217,7 @@ static void of_mux_clk_setup(struct device_node *node)
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 
 cleanup:
-	kfree(parent_names);
+	kfree(parent_data);
 }
 CLK_OF_DECLARE(mux_clk, "ti,mux-clock", of_mux_clk_setup);
 
Signature · 1 line
2.47.3
Reviewed-by on v2 1/2
#2 lore raw
Quoted 6 lines · Mathieu Dubois-Briand

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

Quoted 8 lines

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")
maintainer Applied
#3 lore raw
In reply to Mathieu Dubois-Briand

Quoting Mathieu Dubois-Briand (2026-07-27 00:41:40)

Quoted 9 lines

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Quoted 6 lines

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")

---

Applied to clk-next

#4 lore raw
In reply to Mathieu Dubois-Briand

Hi Mathieu,

Quoted 6 lines · Mathieu Dubois-Briand

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

Quoted 8 lines

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")

Thanks for your patch, which is now commit 667f420c09f1417c ("clk: ti:
mux: resolve parent clocks by DT index, not by name") in clk/clk-next.

This breaks booting BeagleBone Black for me: I don't get any output on the serial console, even with "earlycon keep_bootcon". When the watchdog kicks in (or on kernel panic?), the system reboots.

Reverting this commit fixes the issue.
After reverting, I added debug code to print all parents, and compared them to the DTB, but didn't see any discrepancies.

Your similar change to drivers/clk/ti/composite.c does not cause any issues for me.

Do you have a clue?
Thanks!

Quoted 62 lines
drivers/clk/ti/mux.c +10 -8
@@ -119,7 +119,7 @@ const struct clk_ops ti_clk_mux_ops = {
 };
 
 static struct clk *_register_mux(struct device_node *node, const char *name,
-                                const char * const *parent_names,
+                                const struct clk_parent_data *parent_data,
                                 u8 num_parents, unsigned long flags,
                                 struct clk_omap_reg *reg, u8 shift, u32 mask,
                                 s8 latch, u8 clk_mux_flags, u32 *table)
@@ -136,7 +136,7 @@ static struct clk *_register_mux(struct device_node *node, const char *name,
        init.name = name;
        init.ops = &ti_clk_mux_ops;
        init.flags = flags;
-       init.parent_names = parent_names;
+       init.parent_data = parent_data;
        init.num_parents = num_parents;
 
        /* struct clk_mux assignments */
@@ -167,24 +167,26 @@ static void of_mux_clk_setup(struct device_node *node)
        struct clk *clk;
        struct clk_omap_reg reg;
        unsigned int num_parents;
-       const char **parent_names;
+       struct clk_parent_data *parent_data;
        const char *name;
        u8 clk_mux_flags = 0;
        u32 mask = 0;
        u32 shift = 0;
        s32 latch = -EINVAL;
        u32 flags = CLK_SET_RATE_NO_REPARENT;
+       int i;
 
        num_parents = of_clk_get_parent_count(node);
        if (num_parents < 2) {
                pr_err("mux-clock %pOFn must have parents\n", node);
                return;
        }
-       parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
-       if (!parent_names)
-               goto cleanup;
+       parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);
+       if (!parent_data)
+               return;
 
-       of_clk_parent_fill(node, parent_names, num_parents);
+       for (i = 0; i < num_parents; i++)
+               parent_data[i].index = i;
 
        if (ti_clk_get_reg_addr(node, 0, &reg))
                goto cleanup;
@@ -207,7 +209,7 @@ static void of_mux_clk_setup(struct device_node *node)
        mask = (1 << fls(mask)) - 1;
 
        name = ti_dt_clk_name(node);
-       clk = _register_mux(node, name, parent_names, num_parents,
+       clk = _register_mux(node, name, parent_data, num_parents,
                            flags, &reg, shift, mask, latch, clk_mux_flags,
                            NULL);
 

drivers/clk/ti/mux.c static void of_mux_clk_setup(struct device_node *node) · line 222

Quoted 7 lines
drivers/clk/ti/mux.c +1 -1
@@ -215,7 +217,7 @@ static void of_mux_clk_setup(struct device_node *node)
                of_clk_add_provider(node, of_clk_src_simple_get, clk);
 
 cleanup:
-       kfree(parent_names);
+       kfree(parent_data);
 }
 CLK_OF_DECLARE(mux_clk, "ti,mux-clock", of_mux_clk_setup);

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#5 lore raw

Hi Stephen / Geert,

Quoted 24 lines · Geert Uytterhoeven
Quoted 6 lines · Mathieu Dubois-Briand

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

Quoted 8 lines

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")

Thanks for your patch, which is now commit 667f420c09f1417c ("clk: ti:
mux: resolve parent clocks by DT index, not by name") in clk/clk-next.

This breaks booting BeagleBone Black for me: I don't get any output on the serial console, even with "earlycon keep_bootcon". When the watchdog kicks in (or on kernel panic?), the system reboots.

Quoted 8 lines

Reverting this commit fixes the issue.
After reverting, I added debug code to print all parents, and compared them to the DTB, but didn't see any discrepancies.

Your similar change to drivers/clk/ti/composite.c does not cause any issues for me.

Do you have a clue?

Stephen: I think the safest thing is to just drop / revert the two patches in this series in the pull to Linus next week. I'd do it now, however I'm still waiting for my kernel.org account to get created, and don't have write access to the clk tree yet.

Mathieu: Feel free to post an updated version, and we can get it merged earlier in the development cycle so it'll get more testing in next. Hopefully Geert will have time to test an updated version.

Brian

#6 lore raw
In reply to Geert Uytterhoeven

Hi Geert,

Quoted 19 lines · Geert Uytterhoeven

Hi Mathieu,

Quoted 6 lines · Mathieu Dubois-Briand

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

Quoted 8 lines

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")
Quoted 7 lines

Thanks for your patch, which is now commit 667f420c09f1417c ("clk: ti:
mux: resolve parent clocks by DT index, not by name") in clk/clk-next.

This breaks booting BeagleBone Black for me: I don't get any output on the serial console, even with "earlycon keep_bootcon". When the watchdog kicks in (or on kernel panic?), the system reboots.

Sorry for that!

It's a bit unexpected, as the beaglebone black was one of my test platforms and I didn't see any issue.

Quoted 9 lines

Reverting this commit fixes the issue.
After reverting, I added debug code to print all parents, and compared them to the DTB, but didn't see any discrepancies.

Your similar change to drivers/clk/ti/composite.c does not cause any issues for me.

Do you have a clue?
Thanks!

Can you describe what bootloader and device tree you are using for your tests? Any specific configuration?

On my side, I have:
- BeagleBone Black Wireless A5
- am335x-boneblack-wireless.dtb
- U-boot 2025.10-ti-g6825d60bea17. Maybe I should try with u-boot master branch.

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

Hi Mathieu,

Quoted 40 lines · Mathieu Dubois-Briand
Quoted 17 lines · Geert Uytterhoeven
Quoted 6 lines · Mathieu Dubois-Briand

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

Quoted 8 lines

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")
Quoted 6 lines

Thanks for your patch, which is now commit 667f420c09f1417c ("clk: ti:
mux: resolve parent clocks by DT index, not by name") in clk/clk-next.

This breaks booting BeagleBone Black for me: I don't get any output on the serial console, even with "earlycon keep_bootcon". When the watchdog kicks in (or on kernel panic?), the system reboots.

Sorry for that!

It's a bit unexpected, as the beaglebone black was one of my test platforms and I didn't see any issue.

Quoted 9 lines

Reverting this commit fixes the issue.
After reverting, I added debug code to print all parents, and compared them to the DTB, but didn't see any discrepancies.

Your similar change to drivers/clk/ti/composite.c does not cause any issues for me.

Do you have a clue?
Thanks!

Quoted 8 lines

Can you describe what bootloader and device tree you are using for your tests? Any specific configuration?

On my side, I have:
- BeagleBone Black Wireless A5
- am335x-boneblack-wireless.dtb
- U-boot 2025.10-ti-g6825d60bea17. Maybe I should try with u-boot master branch.

BeagleBone Black Rev C3 (by Seeed Studio) am335x-boneblack.dtb
Stock U-Boot SPL 2019.04-00002-g31a8ae0206 (May 13 2020 - 09:26:17 -0500)

I am using my own config.

With omap2plus_defconfig and multi_v7_defconfig, it does boot. However, this commit does have an impact on /sys/kernel/debug/clk/clk_summary:

--- summary-7.2.0-rc2-00106-g0d4d262c1664 2026-08-19
10:56:51.622275674 +0200
+++ summary-7.2.0-rc2-00107-g667f420c09f1 2026-08-19
10:58:13.929823890 +0200
@@ -77,10 +77,14 @@
clk_summary:

deviceless no_connection_id
clk_summary: clkdiv32k_ck 0 1 0

     32786       0          0     50000      Y

deviceless of_clk_get_from_provider
clk_summary:

deviceless no_connection_id
-clk_summary: clk-24mhz-clkctrl:0000:0 0 4
0 32786 0 0 50000 N
deviceless clkdiv32k_ick
+clk_summary: clk-24mhz-clkctrl:0000:0 0 5
0 32786 0 0 50000 N
deviceless clkdiv32k_ick
clk_summary:

deviceless of_clk_get_from_provider
clk_summary:

deviceless of_clk_get_from_provider
clk_summary:

deviceless no_connection_id
+clk_summary: wdt1_fck 0 1 0

     32786       0          0     50000      Y

deviceless wdt1_fck
+clk_summary:

deviceless no_connection_id
+clk_summary: l4-wkup-clkctrl:00d4:0 0 1

       0        32786       0          0     50000      N
             44e35000.target-module          fck

+clk_summary:

deviceless no_connection_id
clk_summary: l4-rtc-clkctrl:0000:0 0 1
0 32786 0 0 50000 N
44e3e074.target-module fck
clk_summary:

deviceless no_connection_id
clk_summary: l4ls-clkctrl:0074:18 0 2
0 32786 0 0 50000 N
4804c000.gpio dbclk
@@ -297,17 +301,13 @@
clk_summary: l4-cefuse-clkctrl:0020:0 0 0 0
24000000 0 0 50000 N deviceless
no_connection_id
clk_summary: virt_19200000_ck 0 0 0

     19200000    0          0     50000      Y   deviceless
          of_clk_get_from_provider

clk_summary:
deviceless
no_connection_id
-clk_summary: clk_rc32k_ck 0 2 0
32000 0 0 50000 Y deviceless
of_clk_get_from_provider
+clk_summary: clk_rc32k_ck 0 1 0
32000 0 0 50000 Y deviceless
of_clk_get_from_provider
clk_summary:
deviceless
no_connection_id
clk_summary: gpio0_dbclk_mux_ck 0 1 0
32000 0 0 50000 Y deviceless
no_connection_id
clk_summary: l4-wkup-clkctrl:0008:18 0 2 0

     32000       0          0     50000      N         44e07000.gpio
                dbclk

clk_summary:

44e07000.target-module dbclk
clk_summary:
deviceless
of_clk_get_from_provider
clk_summary:
deviceless
no_connection_id
-clk_summary: wdt1_fck 0 1 0
32000 0 0 50000 Y deviceless
wdt1_fck
-clk_summary:
deviceless
no_connection_id
-clk_summary: l4-wkup-clkctrl:00d4:0 0 1 0

     32000       0          0     50000      N

44e35000.target-module fck
-clk_summary:
deviceless
no_connection_id
clk_summary: clk_32768_ck 1 1 0
32768 0 0 50000 Y deviceless
of_clk_get_from_provider
clk_summary:
deviceless
no_connection_id
clk_summary: sysclkout_pre_ck 1 1 0
32768 0 0 50000 Y deviceless
no_connection_id

I.e. wdt1_fck changed its parent from clk_rc32k_ck to clk-24mhz-clkctrl:0000:0, which is probably not intended?

However, that is not the cause of the crash. My .config has CONFIG_INIT_STACK_ALL_PATTERN enabled, so any uninitialized local variables contain garbage.

drivers/clk/ti/mux.c static struct clk *_register_mux(struct device_node *node, const char *name, · line 142

Quoted 9 lines
drivers/clk/ti/mux.c +1 -1
@@ -136,7 +136,7 @@ static struct clk *_register_mux(struct device_node *node, const char *name,
        init.name = name;
        init.ops = &ti_clk_mux_ops;
        init.flags = flags;
-       init.parent_names = parent_names;
+       init.parent_data = parent_data;
        init.num_parents = num_parents;
 
        /* struct clk_mux assignments

Init is not fully initialized, hence init.parent_names contains garbage (before, .parent_data contained garbage).
As clk_core_populate_parent_map() prioritizes .parent_names over .parent_data, the uninitialized .parent_data didn't cause any harm before.

I will send a patch to fix this. This seems to be a recurring issue:
lots of clk_init_data structures are not fully initialized...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#8 lore raw

Hi Geert,

Quoted 62 lines · Geert Uytterhoeven

Hi Mathieu,

Quoted 40 lines · Mathieu Dubois-Briand
Quoted 17 lines · Geert Uytterhoeven
Quoted 6 lines · Mathieu Dubois-Briand

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

Quoted 8 lines

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")
Quoted 6 lines

Thanks for your patch, which is now commit 667f420c09f1417c ("clk: ti:
mux: resolve parent clocks by DT index, not by name") in clk/clk-next.

This breaks booting BeagleBone Black for me: I don't get any output on the serial console, even with "earlycon keep_bootcon". When the watchdog kicks in (or on kernel panic?), the system reboots.

Sorry for that!

It's a bit unexpected, as the beaglebone black was one of my test platforms and I didn't see any issue.

Quoted 9 lines

Reverting this commit fixes the issue.
After reverting, I added debug code to print all parents, and compared them to the DTB, but didn't see any discrepancies.

Your similar change to drivers/clk/ti/composite.c does not cause any issues for me.

Do you have a clue?
Thanks!

Quoted 8 lines

Can you describe what bootloader and device tree you are using for your tests? Any specific configuration?

On my side, I have:
- BeagleBone Black Wireless A5
- am335x-boneblack-wireless.dtb
- U-boot 2025.10-ti-g6825d60bea17. Maybe I should try with u-boot master branch.

BeagleBone Black Rev C3 (by Seeed Studio) am335x-boneblack.dtb
Stock U-Boot SPL 2019.04-00002-g31a8ae0206 (May 13 2020 - 09:26:17 -0500)

I am using my own config.

With omap2plus_defconfig and multi_v7_defconfig, it does boot. However, this commit does have an impact on /sys/kernel/debug/clk/clk_summary:

Quoted 9 lines

--- summary-7.2.0-rc2-00106-g0d4d262c1664 2026-08-19
10:56:51.622275674 +0200
+++ summary-7.2.0-rc2-00107-g667f420c09f1 2026-08-19
10:58:13.929823890 +0200
...

I.e. wdt1_fck changed its parent from clk_rc32k_ck to clk-24mhz-clkctrl:0000:0, which is probably not intended?

This was definitely not intended, but I believe this is a valid configuration.

wdt1_fck has two potential parents. In the device tree (am33xx-clocks.dtsi), we have:

	wdt1_fck: clock-wdt1-fck@538 {
		...
		clocks = <&clk_rc32k_ck>, <&clk_24mhz_clkctrl AM3_CLK_24MHZ_CLKDIV32K_CLKCTRL 0>;
		...
	};

As I understand it, the kernel is free to select any of the parents here. Is that correct?

Previously, the link with the second parent was broken, and only the first parent was known. That was my initial issue that triggered my changes. Now, both parents can be selected. I assume the second one is seen as a better option for some reason, and so now it is selected.

But maybe my assumption are wrongs, so feel free correct me here.

Quoted 12 lines

However, that is not the cause of the crash. My .config has CONFIG_INIT_STACK_ALL_PATTERN enabled, so any uninitialized local variables contain garbage.

Quoted 8 lines
drivers/clk/ti/mux.c +1 -1
@@ -136,7 +136,7 @@ static struct clk *_register_mux(struct device_node *node, const char *name,
        init.name = name;
        init.ops = &ti_clk_mux_ops;
        init.flags = flags;
-       init.parent_names = parent_names;
+       init.parent_data = parent_data;
        init.num_parents = num_parents;
 
Quoted 7 lines

Review static struct clk *_register_mux(struct device_node *node, const char *name, · line 142

Quoted 1 line
(quoted diff) +0 -0
        /* struct clk_mux assignments

Init is not fully initialized, hence init.parent_names contains garbage (before, .parent_data contained garbage).
As clk_core_populate_parent_map() prioritizes .parent_names over .parent_data, the uninitialized .parent_data didn't cause any harm before.

Nice catch. I didn't realise that while doing my changes.

Thanks for taking the time to track this issue.

Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

Hi Mathieu,

Quoted 56 lines · Mathieu Dubois-Briand
Quoted 30 lines · Geert Uytterhoeven
Quoted 18 lines · Mathieu Dubois-Briand
Quoted 17 lines · Geert Uytterhoeven
Quoted 14 lines · Mathieu Dubois-Briand

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. Name-based matching is fragile because a clock's "clock-output-names" value in its provider node can differ from the name used to reference it in a consumer node, and because names must be globally unique across all clock providers.

On AM335x, this caused broken clock trees where some clocks failed to enable because their parents could not be found.

Replace of_clk_parent_fill() with a clk_parent_data array that sets .index to the array position.

Fixes ec7aa25fa483 ("ARM: dts: Use clock-output-names for am3")
Quoted 6 lines
Quoted 6 lines

Thanks for your patch, which is now commit 667f420c09f1417c ("clk: ti:
mux: resolve parent clocks by DT index, not by name") in clk/clk-next.

This breaks booting BeagleBone Black for me: I don't get any output on the serial console, even with "earlycon keep_bootcon". When the watchdog kicks in (or on kernel panic?), the system reboots.

With omap2plus_defconfig and multi_v7_defconfig, it does boot. However, this commit does have an impact on /sys/kernel/debug/clk/clk_summary:

Quoted 9 lines

--- summary-7.2.0-rc2-00106-g0d4d262c1664 2026-08-19
10:56:51.622275674 +0200
+++ summary-7.2.0-rc2-00107-g667f420c09f1 2026-08-19
10:58:13.929823890 +0200
...

I.e. wdt1_fck changed its parent from clk_rc32k_ck to clk-24mhz-clkctrl:0000:0, which is probably not intended?

This was definitely not intended, but I believe this is a valid configuration.

wdt1_fck has two potential parents. In the device tree (am33xx-clocks.dtsi), we have:

        wdt1_fck: clock-wdt1-fck@538 {
                ...
                clocks = <&clk_rc32k_ck>, <&clk_24mhz_clkctrl AM3_CLK_24MHZ_CLKDIV32K_CLKCTRL 0>;
                ...
        };

As I understand it, the kernel is free to select any of the parents here. Is that correct?

Quoted 6 lines

Previously, the link with the second parent was broken, and only the first parent was known. That was my initial issue that triggered my changes. Now, both parents can be selected. I assume the second one is seen as a better option for some reason, and so now it is selected.

But maybe my assumption are wrongs, so feel free correct me here.

Thanks, that sounds like a good explanation!

Quoted 19 lines
Quoted 12 lines

However, that is not the cause of the crash. My .config has CONFIG_INIT_STACK_ALL_PATTERN enabled, so any uninitialized local variables contain garbage.

Quoted 8 lines
drivers/clk/ti/mux.c +1 -1
@@ -136,7 +136,7 @@ static struct clk *_register_mux(struct device_node *node, const char *name,
        init.name = name;
        init.ops = &ti_clk_mux_ops;
        init.flags = flags;
-       init.parent_names = parent_names;
+       init.parent_data = parent_data;
        init.num_parents = num_parents;
 
Quoted 6 lines

Review static struct clk *_register_mux(struct device_node *node, const char *name, · line 142

Quoted 1 line
(quoted diff) +0 -0
        /* struct clk_mux assignments

Init is not fully initialized, hence init.parent_names contains garbage (before, .parent_data contained garbage).
As clk_core_populate_parent_map() prioritizes .parent_names over .parent_data, the uninitialized .parent_data didn't cause any harm before.

Quoted 3 lines

Nice catch. I didn't realise that while doing my changes.

Thanks for taking the time to track this issue.

You're welcome!

I submitted a first set of fixes, incl. "[PATCH treewide 1/5] clk:
ti: Make sure clk_init_data is fully initialized"
https://lore.kernel.org/e6f52b34163c8e708c1100107b437af0b3b049a6.1787165329.git.geert+renesas@glider.be/
I will submit the remainder (way too many) later...

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#10 lore raw
Quoted 4 lines · Geert Uytterhoeven

I submitted a first set of fixes, incl. "[PATCH treewide 1/5] clk:
ti: Make sure clk_init_data is fully initialized"
https://lore.kernel.org/e6f52b34163c8e708c1100107b437af0b3b049a6.1787165329.git.geert+renesas@glider.be/
I will submit the remainder (way too many) later...

Thanks Geert for posting that!

Stephen: You can ignore my message about backing out Mathieu's two patches. We should just pick up what Geert posted.

Brian

#11 lore raw

PATCH v2 2/2 clk: ti: composite: resolve parent clocks by DT index, not by name

In reply to Mathieu Dubois-Briand

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. This makes it consistent with other parts of the same driver.

---
 drivers/clk/ti/composite.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/clk/ti/composite.c +14 -12
index c379bbdae25a..01eae8995254 100644
@@ -52,7 +52,7 @@ static const struct clk_ops ti_composite_gate_ops = {
 
 struct component_clk {
 	int num_parents;
-	const char **parent_names;
+	struct clk_parent_data *parent_data;
 	struct device_node *node;
 	int type;
 	struct clk_hw *hw;
@@ -116,7 +116,7 @@ static void __init _register_composite(void *user,
 	struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw);
 	struct component_clk *comp;
 	int num_parents = 0;
-	const char **parent_names = NULL;
+	struct clk_parent_data *parent_data = NULL;
 	const char *name;
 	int i;
 	int ret;
@@ -155,7 +155,7 @@ static void __init _register_composite(void *user,
 			continue;
 		if (comp->num_parents) {
 			num_parents = comp->num_parents;
-			parent_names = comp->parent_names;
+			parent_data = comp->parent_data;
 			break;
 		}
 	}
@@ -166,8 +166,8 @@ static void __init _register_composite(void *user,
 	}
 
 	name = ti_dt_clk_name(node);
-	clk = clk_register_composite(NULL, name,
-				     parent_names, num_parents,
+	clk = clk_register_composite_pdata(NULL, name,
+				     parent_data, num_parents,
 				     _get_hw(cclk, CLK_COMPONENT_TYPE_MUX),
 				     &ti_clk_mux_ops,
 				     _get_hw(cclk, CLK_COMPONENT_TYPE_DIVIDER),
@@ -190,7 +190,7 @@ static void __init _register_composite(void *user,
 		if (!cclk->comp_clks[i])
 			continue;
 		list_del(&cclk->comp_clks[i]->link);
-		kfree(cclk->comp_clks[i]->parent_names);
+		kfree(cclk->comp_clks[i]->parent_data);
 		kfree(cclk->comp_clks[i]);
 	}
 
@@ -237,8 +237,9 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw,
 				int type)
 {
 	unsigned int num_parents;
-	const char **parent_names;
+	struct clk_parent_data *parent_data;
 	struct component_clk *clk;
+	unsigned int i;
 
 	num_parents = of_clk_get_parent_count(node);
 
@@ -247,20 +248,21 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw,
 		return -EINVAL;
 	}
 
-	parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
-	if (!parent_names)
+	parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);
+	if (!parent_data)
 		return -ENOMEM;
 
-	of_clk_parent_fill(node, parent_names, num_parents);
+	for (i = 0; i < num_parents; i++)
+		parent_data[i].index = i;
 
 	clk = kzalloc_obj(*clk);
 	if (!clk) {
-		kfree(parent_names);
+		kfree(parent_data);
 		return -ENOMEM;
 	}
 
 	clk->num_parents = num_parents;
-	clk->parent_names = parent_names;
+	clk->parent_data = parent_data;
 	clk->hw = hw;
 	clk->node = node;
 	clk->type = type;
Signature · 1 line
2.47.3
maintainer Applied
#13 lore raw

Re: [PATCH v2 2/2] clk: ti: composite: resolve parent clocks by DT index, not by name

In reply to Mathieu Dubois-Briand

Quoting Mathieu Dubois-Briand (2026-07-27 00:41:41)

Quoted 6 lines

Resolve parent clocks by their index into the device tree "clocks" property rather than matching names as strings. This makes it consistent with other parts of the same driver.

---

Applied to clk-next

#14 lore raw
In reply to Mathieu Dubois-Briand

Hi,

this seems to produce on OMAP3 (DM3730), even with the init fix.

[    0.000000] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff
, max_idle_ns: 58327039986419 ns                                                
[    0.000030] sched_clock: 32 bits at 33kHz, resolution 30517ns, wraps every 65
535999984741ns                                                                  
[    0.013488] clk: failed to reparent gpt1_fck to omap_32k_fck: -22            
[    0.019805] Failed to initialize '/ocp@68000000/target-module@48318000/timer@

0': -19

Regards,
Andreas

Quoted 27 lines · On Mon, 27 Jul 2026 09:41:39 +0200 Mathieu Dubois-Briand…

This commit aims to solve an issue I've been describing a few months ago on AM335x SoC [1]. I believe using the parent_data field of clk_init_data structure is now the preferred way to convey that data, and it should be more reliable than string comparisons.

[1]: https://lore.kernel.org/all/[email protected]/

---
Changes in v2:
- Also use clk_parent_data structure in composite.c.
- Rebase on v7.2-rc5.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Mathieu Dubois-Briand (2):
clk: ti: mux: resolve parent clocks by DT index, not by name
clk: ti: composite: resolve parent clocks by DT index, not by name

 drivers/clk/ti/composite.c | 26 ++++++++++++++------------
 drivers/clk/ti/mux.c       | 20 +++++++++++---------
 2 files changed, 25 insertions(+), 21 deletions(-)

---
base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
change-id: 20260713-mathieu-wdt-clock-theo-f0c5ba58e258

Best regards,

#15 lore raw
Quoted 10 lines · Andreas Kemnade

Hi,

this seems to produce on OMAP3 (DM3730), even with the init fix.

[    0.000000] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff
, max_idle_ns: 58327039986419 ns                                                
[    0.000030] sched_clock: 32 bits at 33kHz, resolution 30517ns, wraps every 65
535999984741ns                                                                  
[    0.013488] clk: failed to reparent gpt1_fck to omap_32k_fck: -22            
[    0.019805] Failed to initialize '/ocp@68000000/target-module@48318000/timer@
Quoted 4 lines

0': -19

Regards,
Andreas

Hi Andreas,

That one will be a bit harder for me to debug, as I'm not sure I can easily get this hardware. But looking at the device tree and the reference manual, I suspect something is wrong in the omap3 device tree.

In omap3.dtsi, we have this node [1]:

&timer1_target {
	ti,no-reset-on-init;
	ti,no-idle;
	timer@0 {
		assigned-clocks = <&gpt1_fck>;
		assigned-clock-parents = <&omap_32k_fck>;
	};
};

I suspect that's the source of the error: __set_clk_parents() in drivers/clk/clk-conf.c will try to set &omap_32k_fck as a parent of &gpt1_fck. But looking at omap3xxx-clocks.dtsi [2], &omap_32k_fck is not a valid parent:

	gpt1_fck: gpt1_fck {
		#clock-cells = <0>;
		compatible = "ti,composite-clock";
		clocks = <&gpt1_gate_fck>, <&gpt1_mux_fck>;
	};

Yet the &gpt1_mux_fck is a mux, and one of the parent is indeed &omap_32k_fck [3]. So I suspect the correct assigned clock parent in timer@0 should be &gpt1_mux_fck.

Can you try it that way?

Now, I have doubts about how this was working correctly so far. You don't see any error at all without my changes?

[1]: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/ti/omap/omap3.dtsi?h=v7.3-rc1#n1036
[2]: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/ti/omap/omap3xxx-clocks.dtsi?h=v7.3-rc1#n1183
[3]: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/ti/omap/omap3xxx-clocks.dtsi?h=v7.3-rc1#n737

Thanks,
Mathieu

Quoted 31 lines
Quoted 27 lines · On Mon, 27 Jul 2026 09:41:39 +0200 Mathieu Dubois-Briand…

This commit aims to solve an issue I've been describing a few months ago on AM335x SoC [1]. I believe using the parent_data field of clk_init_data structure is now the preferred way to convey that data, and it should be more reliable than string comparisons.

[1]: https://lore.kernel.org/all/[email protected]/

---
Changes in v2:
- Also use clk_parent_data structure in composite.c.
- Rebase on v7.2-rc5.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Mathieu Dubois-Briand (2):
clk: ti: mux: resolve parent clocks by DT index, not by name
clk: ti: composite: resolve parent clocks by DT index, not by name

 drivers/clk/ti/composite.c | 26 ++++++++++++++------------
 drivers/clk/ti/mux.c       | 20 +++++++++++---------
 2 files changed, 25 insertions(+), 21 deletions(-)

---
base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
change-id: 20260713-mathieu-wdt-clock-theo-f0c5ba58e258

Best regards,

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#16 lore raw
Quoted 38 lines · On Wed, 02 Sep 2026 10:30:02 +0200 "Mathieu Dubois-Briand"…
Quoted 10 lines · Andreas Kemnade

Hi,

this seems to produce on OMAP3 (DM3730), even with the init fix.

[    0.000000] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff
, max_idle_ns: 58327039986419 ns                                                
[    0.000030] sched_clock: 32 bits at 33kHz, resolution 30517ns, wraps every 65
535999984741ns                                                                  
[    0.013488] clk: failed to reparent gpt1_fck to omap_32k_fck: -22            
[    0.019805] Failed to initialize '/ocp@68000000/target-module@48318000/timer@
Quoted 4 lines

0': -19

Regards,
Andreas

Hi Andreas,

That one will be a bit harder for me to debug, as I'm not sure I can easily get this hardware. But looking at the device tree and the reference manual, I suspect something is wrong in the omap3 device tree.

In omap3.dtsi, we have this node [1]:

&timer1_target {
	ti,no-reset-on-init;
	ti,no-idle;
	timer@0 {
		assigned-clocks = <&gpt1_fck>;
		assigned-clock-parents = <&omap_32k_fck>;
	};
};

I suspect that's the source of the error: __set_clk_parents() in drivers/clk/clk-conf.c will try to set &omap_32k_fck as a parent of &gpt1_fck. But looking at omap3xxx-clocks.dtsi [2], &omap_32k_fck is not a valid parent:

Quoted 6 lines
	gpt1_fck: gpt1_fck {
		#clock-cells = <0>;
		compatible = "ti,composite-clock";
		clocks = <&gpt1_gate_fck>, <&gpt1_mux_fck>;
	};

the composite clock is meant to combine the two clocks into one, so you have one single clock with enable/disable functions and parents. At least that seems to be the idea.

If the system fully boots, you see:

localhost:/sys/kernel/debug/clk/gpt1_fck# cat clk_possible_parents 
omap_32k_fck sys_ck
Quoted 6 lines

Yet the &gpt1_mux_fck is a mux, and one of the parent is indeed &omap_32k_fck [3]. So I suspect the correct assigned clock parent in timer@0 should be &gpt1_mux_fck.

Can you try it that way?

[    0.000000] OMAP clocksource: 32k_counter at 32768 Hz                        
[    0.000000] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xfffffffs
[    0.000000] sched_clock: 32 bits at 33kHz, resolution 30517ns, wraps every 6s
[    0.013458] dmtimer_systimer_setup: clock source init failed: -517           

The system does not boot much further.

Quoted 3 lines

Now, I have doubts about how this was working correctly so far. You don't see any error at all without my changes?

No error at all.

Regards,
Andreas

#17 lore raw
Quoted 59 lines · On Wed, 2 Sep 2026 11:15:56 +0200 Andreas Kemnade <[email protected]> wrote:
Quoted 38 lines · On Wed, 02 Sep 2026 10:30:02 +0200 "Mathieu Dubois-Briand"…
Quoted 10 lines · Andreas Kemnade

Hi,

this seems to produce on OMAP3 (DM3730), even with the init fix.

[    0.000000] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff
, max_idle_ns: 58327039986419 ns                                                
[    0.000030] sched_clock: 32 bits at 33kHz, resolution 30517ns, wraps every 65
535999984741ns                                                                  
[    0.013488] clk: failed to reparent gpt1_fck to omap_32k_fck: -22            
[    0.019805] Failed to initialize '/ocp@68000000/target-module@48318000/timer@
Quoted 4 lines

0': -19

Regards,
Andreas

Hi Andreas,

That one will be a bit harder for me to debug, as I'm not sure I can easily get this hardware. But looking at the device tree and the reference manual, I suspect something is wrong in the omap3 device tree.

In omap3.dtsi, we have this node [1]:

&timer1_target {
	ti,no-reset-on-init;
	ti,no-idle;
	timer@0 {
		assigned-clocks = <&gpt1_fck>;
		assigned-clock-parents = <&omap_32k_fck>;
	};
};

I suspect that's the source of the error: __set_clk_parents() in drivers/clk/clk-conf.c will try to set &omap_32k_fck as a parent of &gpt1_fck. But looking at omap3xxx-clocks.dtsi [2], &omap_32k_fck is not a valid parent:

Quoted 6 lines
	gpt1_fck: gpt1_fck {
		#clock-cells = <0>;
		compatible = "ti,composite-clock";
		clocks = <&gpt1_gate_fck>, <&gpt1_mux_fck>;
	};

the composite clock is meant to combine the two clocks into one, so you have one single clock with enable/disable functions and parents. At least that seems to be the idea.

If the system fully boots, you see:

localhost:/sys/kernel/debug/clk/gpt1_fck# cat clk_possible_parents 
omap_32k_fck sys_ck
Quoted 4 lines

Yet the &gpt1_mux_fck is a mux, and one of the parent is indeed &omap_32k_fck [3]. So I suspect the correct assigned clock parent in timer@0 should be &gpt1_mux_fck.

Quoted 9 lines
Quoted 2 lines

Can you try it that way?

[    0.000000] OMAP clocksource: 32k_counter at 32768 Hz                        
[    0.000000] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xfffffffs
[    0.000000] sched_clock: 32 bits at 33kHz, resolution 30517ns, wraps every 6s
[    0.013458] dmtimer_systimer_setup: clock source init failed: -517           

The system does not boot much further.

I got this a bit further by fully replacing this composite clock. With the system having a system timer, it boots till login prompt. But:

[   32.069946] omap_dm_timer_set_source: failed to set timer_32k_ck as parent
[   32.094116] omap-dmtimer-pwm pwm-11: invalid pmtimer fclk rate
[   32.094146] pwm-backlight backlight: error -EINVAL: failed to apply initial PWM state
[   32.094177] pwm-backlight backlight: probe with driver pwm-backlight failed with error -22

This clock comes from here:
clk/ti/clk-3xxx.c: DT_CLK(NULL, "timer_32k_ck", "omap_32k_fck"),

So same pattern. A composite clock cannot get its parent because there is the expection that such behave like a combined clock made from mux + gate clock.

I have not found out if the early registration stuff in timer-ti-dm-systimer.c is part of the mess. OMAP4 devicetrees I use, use assigned-clock-parents in combination with ti,clkctrl clocks. That seems to work.

Regards,
Andreas

#18 lore raw
In reply to Andreas Kemnade
Quoted 47 lines · On Wed, 2 Sep 2026 11:15:56 +0200 Andreas Kemnade <[email protected]> wrote:
Quoted 38 lines · On Wed, 02 Sep 2026 10:30:02 +0200 "Mathieu Dubois-Briand"…
Quoted 10 lines · Andreas Kemnade

Hi,

this seems to produce on OMAP3 (DM3730), even with the init fix.

[    0.000000] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff
, max_idle_ns: 58327039986419 ns                                                
[    0.000030] sched_clock: 32 bits at 33kHz, resolution 30517ns, wraps every 65
535999984741ns                                                                  
[    0.013488] clk: failed to reparent gpt1_fck to omap_32k_fck: -22            
[    0.019805] Failed to initialize '/ocp@68000000/target-module@48318000/timer@
Quoted 4 lines

0': -19

Regards,
Andreas

Hi Andreas,

That one will be a bit harder for me to debug, as I'm not sure I can easily get this hardware. But looking at the device tree and the reference manual, I suspect something is wrong in the omap3 device tree.

In omap3.dtsi, we have this node [1]:

&timer1_target {
	ti,no-reset-on-init;
	ti,no-idle;
	timer@0 {
		assigned-clocks = <&gpt1_fck>;
		assigned-clock-parents = <&omap_32k_fck>;
	};
};

I suspect that's the source of the error: __set_clk_parents() in drivers/clk/clk-conf.c will try to set &omap_32k_fck as a parent of &gpt1_fck. But looking at omap3xxx-clocks.dtsi [2], &omap_32k_fck is not a valid parent:

Quoted 6 lines
	gpt1_fck: gpt1_fck {
		#clock-cells = <0>;
		compatible = "ti,composite-clock";
		clocks = <&gpt1_gate_fck>, <&gpt1_mux_fck>;
	};
Quoted 8 lines

the composite clock is meant to combine the two clocks into one, so you have one single clock with enable/disable functions and parents. At least that seems to be the idea.

If the system fully boots, you see:

localhost:/sys/kernel/debug/clk/gpt1_fck# cat clk_possible_parents 
omap_32k_fck sys_ck

after doing some hacks around gpt1, I could investigate a bit

We have:

localhost:/sys/kernel/debug/clk# grep '(' */clk_possible_parents 
clkout2_src_ck/clk_possible_parents:(missing) (missing) (missing) (missing)
gpt10_fck/clk_possible_parents:(missing) (missing)
gpt11_fck/clk_possible_parents:(missing) (missing)
gpt2_fck/clk_possible_parents:(missing) (missing)
gpt3_fck/clk_possible_parents:(missing) (missing)
gpt4_fck/clk_possible_parents:(missing) (missing)
gpt5_fck/clk_possible_parents:(missing) (missing)
gpt6_fck/clk_possible_parents:(missing) (missing)
gpt7_fck/clk_possible_parents:(missing) (missing)
gpt8_fck/clk_possible_parents:(missing) (missing)
gpt9_fck/clk_possible_parents:(missing) (missing)
mcbsp1_fck/clk_possible_parents:(missing) (missing)
mcbsp2_fck/clk_possible_parents:(missing) (missing)
mcbsp3_fck/clk_possible_parents:(missing) (missing)
mcbsp4_fck/clk_possible_parents:(missing) (missing)
mcbsp5_fck/clk_possible_parents:(missing) (missing)
sgx_fck/clk_possible_parents:(missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing)
usim_fck/clk_possible_parents:(missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing)
localhost:/sys/kernel/debug/clk# 

All these clocks are composite clocks.

so the early-registration of timer-ti-dm-systimer seems not to be the main issue here. Looking around what might be affected, mux clocks build into composite clocks:

:~/linux/arch/arm/boot/dts/ti/omap$ grep -l ti,composite-mux *.dts*
omap2420-clocks.dtsi
omap2430-clocks.dtsi
omap24xx-clocks.dtsi
omap36xx-am35xx-omap3430es2plus-clocks.dtsi
omap36xx-omap3430es2plus-clocks.dtsi
omap3xxx-clocks.dtsi
omap44xx-clocks.dtsi
omap54xx-clocks.dtsi

So havoc all over the place, just worst in omap3 because more critical clocks are affected.

So I think we need either a revert of these patches or a some kind of quirk in clk_hw_register_composite_pdata to pass throuch something between the mux component and the composite.

Regrads,
Andreas

#19 lore raw
Quoted 40 lines · Andreas Kemnade

We have:

localhost:/sys/kernel/debug/clk# grep '(' */clk_possible_parents 
clkout2_src_ck/clk_possible_parents:(missing) (missing) (missing) (missing)
gpt10_fck/clk_possible_parents:(missing) (missing)
gpt11_fck/clk_possible_parents:(missing) (missing)
gpt2_fck/clk_possible_parents:(missing) (missing)
gpt3_fck/clk_possible_parents:(missing) (missing)
gpt4_fck/clk_possible_parents:(missing) (missing)
gpt5_fck/clk_possible_parents:(missing) (missing)
gpt6_fck/clk_possible_parents:(missing) (missing)
gpt7_fck/clk_possible_parents:(missing) (missing)
gpt8_fck/clk_possible_parents:(missing) (missing)
gpt9_fck/clk_possible_parents:(missing) (missing)
mcbsp1_fck/clk_possible_parents:(missing) (missing)
mcbsp2_fck/clk_possible_parents:(missing) (missing)
mcbsp3_fck/clk_possible_parents:(missing) (missing)
mcbsp4_fck/clk_possible_parents:(missing) (missing)
mcbsp5_fck/clk_possible_parents:(missing) (missing)
sgx_fck/clk_possible_parents:(missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing)
usim_fck/clk_possible_parents:(missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing)
localhost:/sys/kernel/debug/clk# 

All these clocks are composite clocks.

so the early-registration of timer-ti-dm-systimer seems not to be the main issue here. Looking around what might be affected, mux clocks build into composite clocks:

:~/linux/arch/arm/boot/dts/ti/omap$ grep -l ti,composite-mux *.dts*
omap2420-clocks.dtsi
omap2430-clocks.dtsi
omap24xx-clocks.dtsi
omap36xx-am35xx-omap3430es2plus-clocks.dtsi
omap36xx-omap3430es2plus-clocks.dtsi
omap3xxx-clocks.dtsi
omap44xx-clocks.dtsi
omap54xx-clocks.dtsi

So havoc all over the place, just worst in omap3 because more critical clocks are affected.

Quoted 6 lines

So I think we need either a revert of these patches or a some kind of quirk in clk_hw_register_composite_pdata to pass throuch something between the mux component and the composite.

Regrads,
Andreas

Hi Andreas,

Thanks for taking the time to investigate this issue.

I believe I won't have much time to dive into it in the coming days, so I fear you are right and we will have to revert this patch for now. Except if someone else want to have a look at this.

I will try to get some OMAP3 board and come back to it a bit later.

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#20 lore raw
Quoted 48 lines · On Fri, 04 Sep 2026 09:50:17 +0200 "Mathieu Dubois-Briand"…
Quoted 40 lines · Andreas Kemnade

We have:

localhost:/sys/kernel/debug/clk# grep '(' */clk_possible_parents 
clkout2_src_ck/clk_possible_parents:(missing) (missing) (missing) (missing)
gpt10_fck/clk_possible_parents:(missing) (missing)
gpt11_fck/clk_possible_parents:(missing) (missing)
gpt2_fck/clk_possible_parents:(missing) (missing)
gpt3_fck/clk_possible_parents:(missing) (missing)
gpt4_fck/clk_possible_parents:(missing) (missing)
gpt5_fck/clk_possible_parents:(missing) (missing)
gpt6_fck/clk_possible_parents:(missing) (missing)
gpt7_fck/clk_possible_parents:(missing) (missing)
gpt8_fck/clk_possible_parents:(missing) (missing)
gpt9_fck/clk_possible_parents:(missing) (missing)
mcbsp1_fck/clk_possible_parents:(missing) (missing)
mcbsp2_fck/clk_possible_parents:(missing) (missing)
mcbsp3_fck/clk_possible_parents:(missing) (missing)
mcbsp4_fck/clk_possible_parents:(missing) (missing)
mcbsp5_fck/clk_possible_parents:(missing) (missing)
sgx_fck/clk_possible_parents:(missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing)
usim_fck/clk_possible_parents:(missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing) (missing)
localhost:/sys/kernel/debug/clk# 

All these clocks are composite clocks.

so the early-registration of timer-ti-dm-systimer seems not to be the main issue here. Looking around what might be affected, mux clocks build into composite clocks:

:~/linux/arch/arm/boot/dts/ti/omap$ grep -l ti,composite-mux *.dts*
omap2420-clocks.dtsi
omap2430-clocks.dtsi
omap24xx-clocks.dtsi
omap36xx-am35xx-omap3430es2plus-clocks.dtsi
omap36xx-omap3430es2plus-clocks.dtsi
omap3xxx-clocks.dtsi
omap44xx-clocks.dtsi
omap54xx-clocks.dtsi

So havoc all over the place, just worst in omap3 because more critical clocks are affected.

Quoted 6 lines

So I think we need either a revert of these patches or a some kind of quirk in clk_hw_register_composite_pdata to pass throuch something between the mux component and the composite.

Regrads,
Andreas

Quoted 8 lines

Hi Andreas,

Thanks for taking the time to investigate this issue.

I believe I won't have much time to dive into it in the coming days, so I fear you are right and we will have to revert this patch for now. Except if someone else want to have a look at this.

I looked once more: I will try with just the composite patch reverted. The composite patch looks more independent than I thought initially.

The composite one does not affect anything else than OMAP2/3/4/5, so your AM3 problem will still get solved.

Regards,
Andreas

#21 lore raw
In reply to Andreas Kemnade
Quoted 4 lines · On Wed, 2 Sep 2026 08:26:39 +0200 Andreas Kemnade <[email protected]> wrote:

Hi,

this seems to produce on OMAP3 (DM3730), even with the init fix.

Quoted 8 lines
[    0.000000] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff
, max_idle_ns: 58327039986419 ns                                                
[    0.000030] sched_clock: 32 bits at 33kHz, resolution 30517ns, wraps every 65
535999984741ns                                                                  
[    0.013488] clk: failed to reparent gpt1_fck to omap_32k_fck: -22            
[    0.019805] Failed to initialize '/ocp@68000000/target-module@48318000/timer@

0': -19

created a backrace with that -EINVAL:

[    0.030975]  clk_fetch_parent_index from clk_core_set_parent_nolock+0x7c/0x18
[    0.031005]  clk_core_set_parent_nolock from clk_set_parent+0x6c/0x18c       
[    0.031036]  clk_set_parent from of_clk_set_defaults+0x304/0x6e8             
[    0.031066]  of_clk_set_defaults from dmtimer_systimer_setup+0x5c/0x1cc      
[    0.031127]  dmtimer_systimer_setup from dmtimer_clkevt_init_common+0x78/0x10
[    0.031158]  dmtimer_clkevt_init_common from dmtimer_clockevent_init+0x80/0x8
[    0.031188]  dmtimer_clockevent_init from dmtimer_systimer_init+0x114/0x134  
[    0.031219]  dmtimer_systimer_init from timer_probe+0x68/0xf4                
[    0.031250]  timer_probe from start_kernel+0x19c/0x370                       
[    0.031280]  start_kernel from 0x0                                           

Maybe something is not ready yet for using indexes instead of names there.

Quoted 36 lines

Regards,
Andreas

Quoted 27 lines · On Mon, 27 Jul 2026 09:41:39 +0200 Mathieu Dubois-Briand…

This commit aims to solve an issue I've been describing a few months ago on AM335x SoC [1]. I believe using the parent_data field of clk_init_data structure is now the preferred way to convey that data, and it should be more reliable than string comparisons.

[1]: https://lore.kernel.org/all/[email protected]/

---
Changes in v2:
- Also use clk_parent_data structure in composite.c.
- Rebase on v7.2-rc5.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Mathieu Dubois-Briand (2):
clk: ti: mux: resolve parent clocks by DT index, not by name
clk: ti: composite: resolve parent clocks by DT index, not by name

 drivers/clk/ti/composite.c | 26 ++++++++++++++------------
 drivers/clk/ti/mux.c       | 20 +++++++++++---------
 2 files changed, 25 insertions(+), 21 deletions(-)

---
base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
change-id: 20260713-mathieu-wdt-clock-theo-f0c5ba58e258

Best regards,