aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/clock.c
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2009-08-31 06:18:04 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 13:21:21 -0500
commitb82a51e8ce560fece675b8e3ca652eee26a47789 (patch)
tree876329e082954426fce0d63619816e573fd4a3ea /arch/arm/mach-davinci/clock.c
parentd6a61563f9e934ef20a1338780082f63802c8908 (diff)
davinci: support re-parenting a clock in the clock framework
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>
Diffstat (limited to 'arch/arm/mach-davinci/clock.c')
-rw-r--r--arch/arm/mach-davinci/clock.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 09e0e1c00a59..e7696fcf05d8 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -141,6 +141,33 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
141} 141}
142EXPORT_SYMBOL(clk_set_rate); 142EXPORT_SYMBOL(clk_set_rate);
143 143
144int clk_set_parent(struct clk *clk, struct clk *parent)
145{
146 unsigned long flags;
147
148 if (clk == NULL || IS_ERR(clk))
149 return -EINVAL;
150
151 /* Cannot change parent on enabled clock */
152 if (WARN_ON(clk->usecount))
153 return -EINVAL;
154
155 mutex_lock(&clocks_mutex);
156 clk->parent = parent;
157 list_del_init(&clk->childnode);
158 list_add(&clk->childnode, &clk->parent->children);
159 mutex_unlock(&clocks_mutex);
160
161 spin_lock_irqsave(&clockfw_lock, flags);
162 if (clk->recalc)
163 clk->rate = clk->recalc(clk);
164 propagate_rate(clk);
165 spin_unlock_irqrestore(&clockfw_lock, flags);
166
167 return 0;
168}
169EXPORT_SYMBOL(clk_set_parent);
170
144int clk_register(struct clk *clk) 171int clk_register(struct clk *clk)
145{ 172{
146 if (clk == NULL || IS_ERR(clk)) 173 if (clk == NULL || IS_ERR(clk))