diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-06-24 16:28:31 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-06-24 16:28:31 +0900 |
commit | facbdce9a2a68098eabb06671c3b9d9b992bad60 (patch) | |
tree | 75355e429fc01c8bf246b1f44a081054293d7e37 /drivers/sh/clk | |
parent | f448e9c9dad6fb919ec74cd1b2c189efe952886f (diff) | |
parent | 794d78fea51504bad3880d14f354a9847f318f25 (diff) | |
download | linux-facbdce9a2a68098eabb06671c3b9d9b992bad60.tar.bz2 |
Merge branch 'sh/clkfwk' into sh-latest
Diffstat (limited to 'drivers/sh/clk')
-rw-r--r-- | drivers/sh/clk/core.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index 7e9c39951ecb..ebeaa9e9f068 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c @@ -34,6 +34,9 @@ static LIST_HEAD(clock_list); static DEFINE_SPINLOCK(clock_lock); static DEFINE_MUTEX(clock_list_sem); +/* clock disable operations are not passed on to hardware during boot */ +static int allow_disable; + void clk_rate_table_build(struct clk *clk, struct cpufreq_frequency_table *freq_table, int nr_freqs, @@ -228,7 +231,7 @@ static void __clk_disable(struct clk *clk) return; if (!(--clk->usecount)) { - if (likely(clk->ops && clk->ops->disable)) + if (likely(allow_disable && clk->ops && clk->ops->disable)) clk->ops->disable(clk); if (likely(clk->parent)) __clk_disable(clk->parent); @@ -747,3 +750,25 @@ err_out: return err; } late_initcall(clk_debugfs_init); + +static int __init clk_late_init(void) +{ + unsigned long flags; + struct clk *clk; + + /* disable all clocks with zero use count */ + mutex_lock(&clock_list_sem); + spin_lock_irqsave(&clock_lock, flags); + + list_for_each_entry(clk, &clock_list, node) + if (!clk->usecount && clk->ops && clk->ops->disable) + clk->ops->disable(clk); + + /* from now on allow clock disable operations */ + allow_disable = 1; + + spin_unlock_irqrestore(&clock_lock, flags); + mutex_unlock(&clock_list_sem); + return 0; +} +late_initcall(clk_late_init); |