diff options
author | Francesco VIRLINZI <francesco.virlinzi@st.com> | 2009-03-11 07:40:54 +0000 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-03-11 17:18:46 +0900 |
commit | d680c76eccd9222031ee30dcee5fdedba2467610 (patch) | |
tree | cfde726fe9c9193c07c768cb2144cb1eb4f1f1f8 /arch/sh/kernel/cpu/clock.c | |
parent | 47a72688fae7298e1ad5fdc9bff7e04b6a549620 (diff) | |
download | blackbird-op-linux-d680c76eccd9222031ee30dcee5fdedba2467610.tar.gz blackbird-op-linux-d680c76eccd9222031ee30dcee5fdedba2467610.zip |
sh: clkfwk: add clk_set_parent/clk_get_parent
This patch adds the clk_set_parent/clk_get_parent routines to the sh
clock framework.
Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/clock.c')
-rw-r--r-- | arch/sh/kernel/cpu/clock.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c index 7b17137536d6..332a1798547c 100644 --- a/arch/sh/kernel/cpu/clock.c +++ b/arch/sh/kernel/cpu/clock.c @@ -239,6 +239,35 @@ void clk_recalc_rate(struct clk *clk) } EXPORT_SYMBOL_GPL(clk_recalc_rate); +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + int ret = -EINVAL; + struct clk *old; + + if (!parent || !clk) + return ret; + + old = clk->parent; + if (likely(clk->ops && clk->ops->set_parent)) { + unsigned long flags; + spin_lock_irqsave(&clock_lock, flags); + ret = clk->ops->set_parent(clk, parent); + spin_unlock_irqrestore(&clock_lock, flags); + clk->parent = (ret ? old : parent); + } + + if (unlikely(clk->flags & CLK_RATE_PROPAGATES)) + propagate_rate(clk); + return ret; +} +EXPORT_SYMBOL_GPL(clk_set_parent); + +struct clk *clk_get_parent(struct clk *clk) +{ + return clk->parent; +} +EXPORT_SYMBOL_GPL(clk_get_parent); + long clk_round_rate(struct clk *clk, unsigned long rate) { if (likely(clk->ops && clk->ops->round_rate)) { |