Skip to content

Commit 73f806c

Browse files
author
Dinh Nguyen
committed
FogBugz #183175: Fix clock driver to support multiple parents for PLLs
The clock driver was incorrectly setting the num_parents=1 for all the PLL clocks. The sdram_pll and periph_pll can have 1 of 3 different parents. Signed-off-by: Dinh Nguyen <dinguyen@altera.com> Tested-by: Matthew Gerlach <mgerlach@altera.com>
1 parent 2c1e213 commit 73f806c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/clk/socfpga/clk.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ static __init struct clk *socfpga_clk_init(struct device_node *node,
145145
struct clk *clk;
146146
struct socfpga_clk *socfpga_clk;
147147
const char *clk_name = node->name;
148-
const char *parent_name;
148+
const char *parent_name[SOCFGPA_MAX_PARENTS];
149149
struct clk_init_data init;
150150
int rc;
151151
u32 fixed_div;
152+
int i = 0;
152153

153154
of_property_read_u32(node, "reg", &reg);
154155

@@ -170,10 +171,12 @@ static __init struct clk *socfpga_clk_init(struct device_node *node,
170171
init.name = clk_name;
171172
init.ops = ops;
172173
init.flags = 0;
173-
parent_name = of_clk_get_parent_name(node, 0);
174-
init.parent_names = &parent_name;
175-
init.num_parents = 1;
176174

175+
while (i < SOCFGPA_MAX_PARENTS && (parent_name[i] =
176+
of_clk_get_parent_name(node, i)) != NULL)
177+
i++;
178+
init.num_parents = i;
179+
init.parent_names = parent_name;
177180
socfpga_clk->hw.hw.init = &init;
178181

179182
if (streq(clk_name, "main_pll") ||

0 commit comments

Comments
 (0)