diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-01 12:10:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-01 12:10:16 -0400 |
commit | e10b87d2b5b4574cdf3a5a19b22ca88b91ba7151 (patch) | |
tree | 21c0714515e1fb1722b918b5e43ecbd7349e2202 /drivers/sh | |
parent | 3da3f872aa175f59e20766ed30aaea67fd4fa7d1 (diff) | |
parent | 536628d0983f1c6a7ccece28ded635661aa30319 (diff) |
Merge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x
* 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x: (39 commits)
SH: static should be at beginning of declaration
sh: move CLKDEV_xxx_ID macro to sh_clk.h
sh: clock-shx3: add CLKDEV_ICK_ID for cleanup
sh: clock-sh7786: add CLKDEV_ICK_ID for cleanup
sh: clock-sh7785: add CLKDEV_ICK_ID for cleanup
sh: clock-sh7757: add CLKDEV_ICK_ID for cleanup
sh: clock-sh7366: add CLKDEV_ICK_ID for cleanup
sh: clock-sh7343: add CLKDEV_ICK_ID for cleanup
sh: clock-sh7722: add CLKDEV_ICK_ID for cleanup
sh: clock-sh7724: add CLKDEV_ICK_ID for cleanup
sh: clock-sh7366: modify I2C clock settings
sh: clock-sh7343: modify I2C clock settings
sh: clock-sh7723: modify I2C clock settings
sh: clock-sh7722: modify I2C clock settings
sh: clock-sh7724: modify I2C clock settings
serial: sh-sci: Fix up pretty name printing for port IRQs.
serial: sh-sci: Kill off per-port enable/disable callbacks.
serial: sh-sci: Add missing module description/author bits.
serial: sh-sci: Regtype probing doesn't need to be fatal.
sh: Tidy up pre-clkdev clk_get() error handling.
...
Diffstat (limited to 'drivers/sh')
-rw-r--r-- | drivers/sh/clk/core.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index d6702e57d428..dc8d022c07a1 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c | |||
@@ -34,6 +34,9 @@ static LIST_HEAD(clock_list); | |||
34 | static DEFINE_SPINLOCK(clock_lock); | 34 | static DEFINE_SPINLOCK(clock_lock); |
35 | static DEFINE_MUTEX(clock_list_sem); | 35 | static DEFINE_MUTEX(clock_list_sem); |
36 | 36 | ||
37 | /* clock disable operations are not passed on to hardware during boot */ | ||
38 | static int allow_disable; | ||
39 | |||
37 | void clk_rate_table_build(struct clk *clk, | 40 | void clk_rate_table_build(struct clk *clk, |
38 | struct cpufreq_frequency_table *freq_table, | 41 | struct cpufreq_frequency_table *freq_table, |
39 | int nr_freqs, | 42 | int nr_freqs, |
@@ -228,7 +231,7 @@ static void __clk_disable(struct clk *clk) | |||
228 | return; | 231 | return; |
229 | 232 | ||
230 | if (!(--clk->usecount)) { | 233 | if (!(--clk->usecount)) { |
231 | if (likely(clk->ops && clk->ops->disable)) | 234 | if (likely(allow_disable && clk->ops && clk->ops->disable)) |
232 | clk->ops->disable(clk); | 235 | clk->ops->disable(clk); |
233 | if (likely(clk->parent)) | 236 | if (likely(clk->parent)) |
234 | __clk_disable(clk->parent); | 237 | __clk_disable(clk->parent); |
@@ -393,7 +396,7 @@ int clk_register(struct clk *clk) | |||
393 | { | 396 | { |
394 | int ret; | 397 | int ret; |
395 | 398 | ||
396 | if (clk == NULL || IS_ERR(clk)) | 399 | if (IS_ERR_OR_NULL(clk)) |
397 | return -EINVAL; | 400 | return -EINVAL; |
398 | 401 | ||
399 | /* | 402 | /* |
@@ -744,3 +747,25 @@ err_out: | |||
744 | return err; | 747 | return err; |
745 | } | 748 | } |
746 | late_initcall(clk_debugfs_init); | 749 | late_initcall(clk_debugfs_init); |
750 | |||
751 | static int __init clk_late_init(void) | ||
752 | { | ||
753 | unsigned long flags; | ||
754 | struct clk *clk; | ||
755 | |||
756 | /* disable all clocks with zero use count */ | ||
757 | mutex_lock(&clock_list_sem); | ||
758 | spin_lock_irqsave(&clock_lock, flags); | ||
759 | |||
760 | list_for_each_entry(clk, &clock_list, node) | ||
761 | if (!clk->usecount && clk->ops && clk->ops->disable) | ||
762 | clk->ops->disable(clk); | ||
763 | |||
764 | /* from now on allow clock disable operations */ | ||
765 | allow_disable = 1; | ||
766 | |||
767 | spin_unlock_irqrestore(&clock_lock, flags); | ||
768 | mutex_unlock(&clock_list_sem); | ||
769 | return 0; | ||
770 | } | ||
771 | late_initcall(clk_late_init); | ||