Commit 41f3103f authored by Russell King's avatar Russell King Committed by Russell King

[ARM] omap: fix clock reparenting in omap2_clk_set_parent()

When changing the parent of a clock, it is necessary to keep the
clock use counts balanced otherwise things the parent state will
get corrupted.  Since we already disable and re-enable the clock,
we might as well use the recursive versions instead.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 22eb36f4
...@@ -746,7 +746,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) ...@@ -746,7 +746,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
return -EINVAL; return -EINVAL;
if (clk->usecount > 0) if (clk->usecount > 0)
_omap2_clk_disable(clk); omap2_clk_disable(clk);
/* Set new source value (previous dividers if any in effect) */ /* Set new source value (previous dividers if any in effect) */
reg_val = __raw_readl(src_addr) & ~field_mask; reg_val = __raw_readl(src_addr) & ~field_mask;
...@@ -759,11 +759,11 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) ...@@ -759,11 +759,11 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
wmb(); wmb();
} }
if (clk->usecount > 0)
_omap2_clk_enable(clk);
clk->parent = new_parent; clk->parent = new_parent;
if (clk->usecount > 0)
omap2_clk_enable(clk);
/* CLKSEL clocks follow their parents' rates, divided by a divisor */ /* CLKSEL clocks follow their parents' rates, divided by a divisor */
clk->rate = new_parent->rate; clk->rate = new_parent->rate;
......
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