Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146820
b: refs/heads/master
c: aa87aa3
h: refs/heads/master
v: v3
  • Loading branch information
Paul Mundt committed May 11, 2009
1 parent e0a10b5 commit ab59db3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae891a4264c91246c0b4c22be68b9838747ae48d
refs/heads/master: aa87aa343f2cd236b5eccd643abd4df918ed5c4f
1 change: 1 addition & 0 deletions trunk/arch/sh/include/asm/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ int clk_init(void);
unsigned long followparent_recalc(struct clk *);
void recalculate_root_clocks(void);
void propagate_rate(struct clk *);
int clk_reparent(struct clk *child, struct clk *parent);
void clk_recalc_rate(struct clk *);
int clk_register(struct clk *);
void clk_unregister(struct clk *);
Expand Down
20 changes: 20 additions & 0 deletions trunk/arch/sh/kernel/cpu/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ unsigned long followparent_recalc(struct clk *clk)
return clk->parent->rate;
}

int clk_reparent(struct clk *child, struct clk *parent)
{
list_del_init(&child->sibling);
if (parent)
list_add(&child->sibling, &parent->children);
child->parent = parent;

/* now do the debugfs renaming to reattach the child
to the proper parent */

return 0;
}

/* Propagate rate to children */
void propagate_rate(struct clk *tclk)
{
Expand Down Expand Up @@ -288,12 +301,19 @@ int clk_set_parent(struct clk *clk, struct clk *parent)

if (!parent || !clk)
return ret;
if (clk->parent == parent)
return 0;

spin_lock_irqsave(&clock_lock, flags);
if (clk->usecount == 0) {
if (clk->ops->set_parent)
ret = clk->ops->set_parent(clk, parent);
else
ret = clk_reparent(clk, parent);

if (ret == 0) {
pr_debug("clock: set parent of %s to %s (new rate %ld)\n",
clk->name, clk->parent->name, clk->rate);
if (clk->ops->recalc)
clk->rate = clk->ops->recalc(clk);
propagate_rate(clk);
Expand Down

0 comments on commit ab59db3

Please sign in to comment.