aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-01-31 06:02:37 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-08 12:50:46 -0500
commit8263e5b31eae2bbf689ff08a7da334329c9f353b (patch)
tree02422180f934dbac1ae16ef63f3825a65636b7b1
parenta7f8c599c570fc0e2396e8fdccaeeeaefc41dac8 (diff)
[ARM] omap: fix clockdomain enable/disable ordering
Based on a patch from Paul Walmsley <paul@pwsan.com>: omap2_clk_enable() should enable a clock's clockdomain before attempting to enable its parent clock's clockdomain. Similarly, in the unlikely event that the parent clock enable fails, the clockdomain should be disabled. linux-omap source commit is 6d6e285e5a7912b1ea68fadac387304c914aaba8. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-omap2/clock.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 222c2c0d4a64..1b40d757500d 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -419,20 +419,17 @@ int omap2_clk_enable(struct clk *clk)
419 int ret = 0; 419 int ret = 0;
420 420
421 if (clk->usecount++ == 0) { 421 if (clk->usecount++ == 0) {
422 if (clk->clkdm)
423 omap2_clkdm_clk_enable(clk->clkdm, clk);
424
422 if (clk->parent) { 425 if (clk->parent) {
423 ret = omap2_clk_enable(clk->parent); 426 ret = omap2_clk_enable(clk->parent);
424 if (ret) 427 if (ret)
425 goto err; 428 goto err;
426 } 429 }
427 430
428 if (clk->clkdm)
429 omap2_clkdm_clk_enable(clk->clkdm, clk);
430
431 ret = _omap2_clk_enable(clk); 431 ret = _omap2_clk_enable(clk);
432 if (ret) { 432 if (ret) {
433 if (clk->clkdm)
434 omap2_clkdm_clk_disable(clk->clkdm, clk);
435
436 if (clk->parent) 433 if (clk->parent)
437 omap2_clk_disable(clk->parent); 434 omap2_clk_disable(clk->parent);
438 435
@@ -442,6 +439,8 @@ int omap2_clk_enable(struct clk *clk)
442 return ret; 439 return ret;
443 440
444err: 441err:
442 if (clk->clkdm)
443 omap2_clkdm_clk_disable(clk->clkdm, clk);
445 clk->usecount--; 444 clk->usecount--;
446 return ret; 445 return ret;
447} 446}