Skip to content

Commit 1b24a13

Browse files
ffainellibebarino
authored andcommitted
clk: iproc: Do not rely on node name for correct PLL setup
After commit 31fd9b7 ("ARM: dts: BCM5301X: update CRU block description") a warning from clk-iproc-pll.c was generated due to a duplicate PLL name as well as the console stopped working. Upon closer inspection it became clear that iproc_pll_clk_setup() used the Device Tree node unit name as an unique identifier as well as a parent name to parent all clocks under the PLL. BCM5301X was the first platform on which that got noticed because of the DT node unit name renaming but the same assumptions hold true for any user of the iproc_pll_clk_setup() function. The first 'clock-output-names' property is always guaranteed to be unique as well as providing the actual desired PLL clock name, so we utilize that to register the PLL and as a parent name of all children clock. Fixes: 5fe225c ("clk: iproc: add initial common clock support") Signed-off-by: Florian Fainelli <[email protected]> Acked-by: Rafał Miłecki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 4014e91 commit 1b24a13

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/clk/bcm/clk-iproc-pll.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ void iproc_pll_clk_setup(struct device_node *node,
726726
const char *parent_name;
727727
struct iproc_clk *iclk_array;
728728
struct clk_hw_onecell_data *clk_data;
729+
const char *clk_name;
729730

730731
if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl))
731732
return;
@@ -773,7 +774,12 @@ void iproc_pll_clk_setup(struct device_node *node,
773774
iclk = &iclk_array[0];
774775
iclk->pll = pll;
775776

776-
init.name = node->name;
777+
ret = of_property_read_string_index(node, "clock-output-names",
778+
0, &clk_name);
779+
if (WARN_ON(ret))
780+
goto err_pll_register;
781+
782+
init.name = clk_name;
777783
init.ops = &iproc_pll_ops;
778784
init.flags = 0;
779785
parent_name = of_clk_get_parent_name(node, 0);
@@ -793,13 +799,11 @@ void iproc_pll_clk_setup(struct device_node *node,
793799
goto err_pll_register;
794800

795801
clk_data->hws[0] = &iclk->hw;
802+
parent_name = clk_name;
796803

797804
/* now initialize and register all leaf clocks */
798805
for (i = 1; i < num_clks; i++) {
799-
const char *clk_name;
800-
801806
memset(&init, 0, sizeof(init));
802-
parent_name = node->name;
803807

804808
ret = of_property_read_string_index(node, "clock-output-names",
805809
i, &clk_name);

0 commit comments

Comments
 (0)