clk: iproc: Do not rely on node name for correct PLL setup

After commit 31fd9b79dc58 ("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: 5fe225c105fd ("clk: iproc: add initial common clock support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Rafał Miłecki <rafal@milecki.pl>
Link: https://lore.kernel.org/r/20220905161504.1526-1-f.fainelli@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by Florian Fainelli and committed by Stephen Boyd 1b24a132 4014e916

Changed files
+8 -4
drivers
clk
+8 -4
drivers/clk/bcm/clk-iproc-pll.c
··· 726 726 const char *parent_name; 727 727 struct iproc_clk *iclk_array; 728 728 struct clk_hw_onecell_data *clk_data; 729 + const char *clk_name; 729 730 730 731 if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) 731 732 return; ··· 774 773 iclk = &iclk_array[0]; 775 774 iclk->pll = pll; 776 775 777 - init.name = node->name; 776 + ret = of_property_read_string_index(node, "clock-output-names", 777 + 0, &clk_name); 778 + if (WARN_ON(ret)) 779 + goto err_pll_register; 780 + 781 + init.name = clk_name; 778 782 init.ops = &iproc_pll_ops; 779 783 init.flags = 0; 780 784 parent_name = of_clk_get_parent_name(node, 0); ··· 799 793 goto err_pll_register; 800 794 801 795 clk_data->hws[0] = &iclk->hw; 796 + parent_name = clk_name; 802 797 803 798 /* now initialize and register all leaf clocks */ 804 799 for (i = 1; i < num_clks; i++) { 805 - const char *clk_name; 806 - 807 800 memset(&init, 0, sizeof(init)); 808 - parent_name = node->name; 809 801 810 802 ret = of_property_read_string_index(node, "clock-output-names", 811 803 i, &clk_name);