On 4/17/25 1:35 AM, Adam Ford wrote:

[...]

         if (!parent)
@@ -113,6 +114,9 @@ int clk_mux_fetch_parent_index(struct clk *clk,
struct clk *parent)
         for (i = 0; i < mux->num_parents; i++) {
                 if (!strcmp(parent->dev->name, mux->parent_names[i]))
                         return i;
+               dev_read_string_index(parent->dev,
"clock-output-names", i, &name);

You are not supposed to use "clock-output-names" for clock look up.
You are supposed to use "clocks"/"clock-names" DT properties and then resolve the remote clock from information in those.

+               if (!strcmp(name, mux->parent_names[i]))
+                       return i;
                 if (!strcmp(parent->dev->name,
                             clk_resolve_parent_clk(clk->dev,
                                                    mux->parent_names[i])))
clk_resolve_parent_clk() is meant to look up the clocks in local DT node "clock-names" property by name, and based on that, figure out which phandle to use in local DT node "clocks" property to access those clock:

For example, in dts/upstream/src/arm64/freescale/imx8mp.dtsi

 745 clk: clock-controller@30380000 {
 746         compatible = "fsl,imx8mp-ccm";
 747         reg = <0x30380000 0x10000>;
 748         interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>,
 749                      <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
 750         #clock-cells = <1>;
 751         clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>, <&clk_ext2>,
                                   ^^^^^^^^
 752                  <&clk_ext3>, <&clk_ext4>;
 753         clock-names = "osc_32k", "osc_24m", "clk_ext1", "clk_ext2",
                                       ^^^^^^^
                This "osc_24m" is also the same osc_24m referenced in
                drivers/clk/imx/clk-imx8mp.c imx8mp_a53_sels[] and co.

Is then resolved to these clock:

 188         osc_24m: clock-osc-24m {
 189                 compatible = "fixed-clock";
 190                 #clock-cells = <0>;
 191                 clock-frequency = <24000000>;
 192                 clock-output-names = "osc_24m";
                                           ^^^^^^^ Ignore this
 193         };

Reply via email to