aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/clock.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-02-12 05:12:59 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-14 04:59:21 -0500
commit8b9dbc16d4f5786c6c930ab028722e3ed7e4285b (patch)
treed6bd11034d7d31a42275577840f5eb16b432378d /arch/arm/plat-omap/clock.c
parent883992bd8f6924c9aa849f2dac381075e2e55a9d (diff)
[ARM] omap: arrange for clock recalc methods to return the rate
linux-omap source commit 33d000c99ee393fe2042f93e8422f94976d276ce introduces a way to "dry run" clock changes before they're committed. However, this involves putting logic to handle this into each and every recalc function, and unfortunately due to the caching, led to some bugs. Solve both of issues by making the recalc methods always return the clock rate for the clock, which the caller decides what to do with. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-omap/clock.c')
-rw-r--r--arch/arm/plat-omap/clock.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 9833d73511a1..08baa18497b2 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -126,7 +126,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
126 ret = arch_clock->clk_set_rate(clk, rate); 126 ret = arch_clock->clk_set_rate(clk, rate);
127 if (ret == 0) { 127 if (ret == 0) {
128 if (clk->recalc) 128 if (clk->recalc)
129 clk->recalc(clk); 129 clk->rate = clk->recalc(clk);
130 propagate_rate(clk); 130 propagate_rate(clk);
131 } 131 }
132 spin_unlock_irqrestore(&clockfw_lock, flags); 132 spin_unlock_irqrestore(&clockfw_lock, flags);
@@ -148,7 +148,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
148 ret = arch_clock->clk_set_parent(clk, parent); 148 ret = arch_clock->clk_set_parent(clk, parent);
149 if (ret == 0) { 149 if (ret == 0) {
150 if (clk->recalc) 150 if (clk->recalc)
151 clk->recalc(clk); 151 clk->rate = clk->recalc(clk);
152 propagate_rate(clk); 152 propagate_rate(clk);
153 } 153 }
154 spin_unlock_irqrestore(&clockfw_lock, flags); 154 spin_unlock_irqrestore(&clockfw_lock, flags);
@@ -188,12 +188,9 @@ static int __init omap_clk_setup(char *str)
188__setup("mpurate=", omap_clk_setup); 188__setup("mpurate=", omap_clk_setup);
189 189
190/* Used for clocks that always have same value as the parent clock */ 190/* Used for clocks that always have same value as the parent clock */
191void followparent_recalc(struct clk *clk) 191unsigned long followparent_recalc(struct clk *clk)
192{ 192{
193 if (clk == NULL || IS_ERR(clk)) 193 return clk->parent->rate;
194 return;
195
196 clk->rate = clk->parent->rate;
197} 194}
198 195
199void clk_reparent(struct clk *child, struct clk *parent) 196void clk_reparent(struct clk *child, struct clk *parent)
@@ -214,7 +211,7 @@ void propagate_rate(struct clk * tclk)
214 211
215 list_for_each_entry(clkp, &tclk->children, sibling) { 212 list_for_each_entry(clkp, &tclk->children, sibling) {
216 if (clkp->recalc) 213 if (clkp->recalc)
217 clkp->recalc(clkp); 214 clkp->rate = clkp->recalc(clkp);
218 propagate_rate(clkp); 215 propagate_rate(clkp);
219 } 216 }
220} 217}
@@ -234,7 +231,7 @@ void recalculate_root_clocks(void)
234 231
235 list_for_each_entry(clkp, &root_clks, sibling) { 232 list_for_each_entry(clkp, &root_clks, sibling) {
236 if (clkp->recalc) 233 if (clkp->recalc)
237 clkp->recalc(clkp); 234 clkp->rate = clkp->recalc(clkp);
238 propagate_rate(clkp); 235 propagate_rate(clkp);
239 } 236 }
240} 237}