Skip to content

Commit

Permalink
[ARM] omap: fix clock reparenting in omap2_clk_set_parent()
Browse files Browse the repository at this point in the history
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: Russell King <[email protected]>
  • Loading branch information
Russell King authored and Russell King committed Feb 19, 2009
1 parent 22eb36f commit 41f3103
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/arm/mach-omap2/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
return -EINVAL;

if (clk->usecount > 0)
_omap2_clk_disable(clk);
omap2_clk_disable(clk);

/* Set new source value (previous dividers if any in effect) */
reg_val = __raw_readl(src_addr) & ~field_mask;
Expand All @@ -759,11 +759,11 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
wmb();
}

if (clk->usecount > 0)
_omap2_clk_enable(clk);

clk->parent = new_parent;

if (clk->usecount > 0)
omap2_clk_enable(clk);

/* CLKSEL clocks follow their parents' rates, divided by a divisor */
clk->rate = new_parent->rate;

Expand Down

0 comments on commit 41f3103

Please sign in to comment.