summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorMartin Fuzzey2012-11-22 20:15:05 +0100
committerMike Turquette2012-11-26 20:14:45 +0100
commit1f61e5f143b578606389887887af549bc5554353 (patch)
treeb49a23716e8896eac027f2730a4cf0d94983ec4f /drivers/clk/clk.c
parentclk: ux500: Initial support for abx500 clock driver (diff)
downloadkernel-qcow2-linux-1f61e5f143b578606389887887af549bc5554353.tar.gz
kernel-qcow2-linux-1f61e5f143b578606389887887af549bc5554353.tar.xz
kernel-qcow2-linux-1f61e5f143b578606389887887af549bc5554353.zip
clk: clock multiplexers may register out of order
When a clock, C is initialised any orphan clocks listing C as a possible parent are reparented to it regardless of the parent requested by the orphan's get_parent() operation. This means that multiplexers registered before their parents are reparented to the first parent subsequently declared, regardless of the selection made by the hardware registers. For example: static const char *sel[] = { "srcA", "srcB", "dummy", "srcC" }; child = clk_register_mux(NULL, "child", sel, ARRAY_SIZE(sel), ...); clk_register_fixed(NULL, "dummy", ...); clk_register_fixed(NULL, "srcA", ...); clk_register_fixed(NULL, "srcB", ...); clk_register_fixed(NULL, "srcC", ...); Causes child's parent to always be "dummy". To fix this, when an orphanned clock has a get_parent() operation, only reparent to the clock indicated by get_parent(). Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Mike Turquette <mturquette@linaro.org> [mturquette@linaro.org: improve $SUBJECT]
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2fd28ddd06c9..9955ad7e786e 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1298,12 +1298,20 @@ int __clk_init(struct device *dev, struct clk *clk)
* walk the list of orphan clocks and reparent any that are children of
* this clock
*/
- hlist_for_each_entry_safe(orphan, tmp, tmp2, &clk_orphan_list, child_node)
+ hlist_for_each_entry_safe(orphan, tmp, tmp2, &clk_orphan_list, child_node) {
+ if (orphan->ops->get_parent) {
+ i = orphan->ops->get_parent(orphan->hw);
+ if (!strcmp(clk->name, orphan->parent_names[i]))
+ __clk_reparent(orphan, clk);
+ continue;
+ }
+
for (i = 0; i < orphan->num_parents; i++)
if (!strcmp(clk->name, orphan->parent_names[i])) {
__clk_reparent(orphan, clk);
break;
}
+ }
/*
* optional platform-specific magic