Skip to content

Commit

Permalink
davinci: support re-parenting a clock in the clock framework
Browse files Browse the repository at this point in the history
The clk_set_parent() API is implemented to enable re-parenting
clocks in the clock tree.

This is useful in DVFS and helps by shifting clocks to an asynchronous
domain where supported by hardware

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
  • Loading branch information
Sekhar Nori authored and Kevin Hilman committed Nov 25, 2009
1 parent d6a6156 commit b82a51e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions arch/arm/mach-davinci/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,33 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
}
EXPORT_SYMBOL(clk_set_rate);

int clk_set_parent(struct clk *clk, struct clk *parent)
{
unsigned long flags;

if (clk == NULL || IS_ERR(clk))
return -EINVAL;

/* Cannot change parent on enabled clock */
if (WARN_ON(clk->usecount))
return -EINVAL;

mutex_lock(&clocks_mutex);
clk->parent = parent;
list_del_init(&clk->childnode);
list_add(&clk->childnode, &clk->parent->children);
mutex_unlock(&clocks_mutex);

spin_lock_irqsave(&clockfw_lock, flags);
if (clk->recalc)
clk->rate = clk->recalc(clk);
propagate_rate(clk);
spin_unlock_irqrestore(&clockfw_lock, flags);

return 0;
}
EXPORT_SYMBOL(clk_set_parent);

int clk_register(struct clk *clk)
{
if (clk == NULL || IS_ERR(clk))
Expand Down

0 comments on commit b82a51e

Please sign in to comment.