Commit 56713da3 authored by Dinh Nguyen's avatar Dinh Nguyen Committed by Stephen Boyd

clk: socfpga: allow for multiple parents on Arria10 periph clocks

There are some Arria10 clocks of type "altr,socfpga-a10-perip-clk" that can
have multiple parents. Fix up the __socfpga_periph_init() to call
of_clk_parent_fill() that will return the appropriate number of parents.

Also, update __socfpga_gate_init() to call of_clk_parent_fill() helper
function.
Signed-off-by: default avatarDinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent b6f51284
...@@ -115,7 +115,6 @@ static void __init __socfpga_gate_init(struct device_node *node, ...@@ -115,7 +115,6 @@ static void __init __socfpga_gate_init(struct device_node *node,
const char *parent_name[SOCFPGA_MAX_PARENTS]; const char *parent_name[SOCFPGA_MAX_PARENTS];
struct clk_init_data init; struct clk_init_data init;
int rc; int rc;
int i = 0;
socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL); socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL);
if (WARN_ON(!socfpga_clk)) if (WARN_ON(!socfpga_clk))
...@@ -167,12 +166,9 @@ static void __init __socfpga_gate_init(struct device_node *node, ...@@ -167,12 +166,9 @@ static void __init __socfpga_gate_init(struct device_node *node,
init.name = clk_name; init.name = clk_name;
init.ops = ops; init.ops = ops;
init.flags = 0; init.flags = 0;
while (i < SOCFPGA_MAX_PARENTS && (parent_name[i] =
of_clk_get_parent_name(node, i)) != NULL)
i++;
init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS);
init.parent_names = parent_name; init.parent_names = parent_name;
init.num_parents = i;
socfpga_clk->hw.hw.init = &init; socfpga_clk->hw.hw.init = &init;
clk = clk_register(NULL, &socfpga_clk->hw.hw); clk = clk_register(NULL, &socfpga_clk->hw.hw);
......
...@@ -74,7 +74,7 @@ static __init void __socfpga_periph_init(struct device_node *node, ...@@ -74,7 +74,7 @@ static __init void __socfpga_periph_init(struct device_node *node,
struct clk *clk; struct clk *clk;
struct socfpga_periph_clk *periph_clk; struct socfpga_periph_clk *periph_clk;
const char *clk_name = node->name; const char *clk_name = node->name;
const char *parent_name; const char *parent_name[SOCFPGA_MAX_PARENTS];
struct clk_init_data init; struct clk_init_data init;
int rc; int rc;
u32 fixed_div; u32 fixed_div;
...@@ -109,9 +109,8 @@ static __init void __socfpga_periph_init(struct device_node *node, ...@@ -109,9 +109,8 @@ static __init void __socfpga_periph_init(struct device_node *node,
init.ops = ops; init.ops = ops;
init.flags = 0; init.flags = 0;
parent_name = of_clk_get_parent_name(node, 0); init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS);
init.num_parents = 1; init.parent_names = parent_name;
init.parent_names = &parent_name;
periph_clk->hw.hw.init = &init; periph_clk->hw.hw.init = &init;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment