aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorRajendra Nayak <rnayak@ti.com>2011-02-25 17:49:00 -0500
committerPaul Walmsley <paul@pwsan.com>2011-02-25 18:10:16 -0500
commit58e846fe7870d0ba22f8eeb1d522fbae37e80cbf (patch)
tree2f319fd0f791ba0d067ef71817f8b0cb10541a01 /arch/arm/plat-omap
parent5a2926b8805bc697d47a243dbf2f20de68abe14c (diff)
OMAP: clock: Add allow_idle/deny_idle support in clkops
On OMAP various clock nodes (dpll's, mx post dividers, interface clocks) support hardware level autogating which can be controlled from software. Support such functionality by adding two new function pointer allow_idle and deny_idle in the clkops structure. These function pointers can be populated for any clock node which supports hardware level autogating. Also add 2 new functions (omap_clk_enable_autoidle_all and omap_clk_disable_autoidle_all) which can be called from architecture specific PM core code, if hardware level autogating (for all supported clock nodes) is to be enabled or disabled. Signed-off-by: Rajendra Nayak <rnayak@ti.com> [paul@pwsan.com: use spinlock rather than mutex due to race; renamed functions; functions now return ints] Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/clock.c32
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h6
2 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index fc62fb5fc20b..0ae0eae01fd1 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -335,6 +335,38 @@ struct clk *omap_clk_get_by_name(const char *name)
335 return ret; 335 return ret;
336} 336}
337 337
338int omap_clk_enable_autoidle_all(void)
339{
340 struct clk *c;
341 unsigned long flags;
342
343 spin_lock_irqsave(&clockfw_lock, flags);
344
345 list_for_each_entry(c, &clocks, node)
346 if (c->ops->allow_idle)
347 c->ops->allow_idle(c);
348
349 spin_unlock_irqrestore(&clockfw_lock, flags);
350
351 return 0;
352}
353
354int omap_clk_disable_autoidle_all(void)
355{
356 struct clk *c;
357 unsigned long flags;
358
359 spin_lock_irqsave(&clockfw_lock, flags);
360
361 list_for_each_entry(c, &clocks, node)
362 if (c->ops->deny_idle)
363 c->ops->deny_idle(c);
364
365 spin_unlock_irqrestore(&clockfw_lock, flags);
366
367 return 0;
368}
369
338/* 370/*
339 * Low level helpers 371 * Low level helpers
340 */ 372 */
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index d43e6234dbbb..be69f5cac32d 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -25,6 +25,8 @@ struct clockdomain;
25 * @disable: fn ptr that enables the current clock in hardware 25 * @disable: fn ptr that enables the current clock in hardware
26 * @find_idlest: function returning the IDLEST register for the clock's IP blk 26 * @find_idlest: function returning the IDLEST register for the clock's IP blk
27 * @find_companion: function returning the "companion" clk reg for the clock 27 * @find_companion: function returning the "companion" clk reg for the clock
28 * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
29 * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
28 * 30 *
29 * A "companion" clk is an accompanying clock to the one being queried 31 * A "companion" clk is an accompanying clock to the one being queried
30 * that must be enabled for the IP module connected to the clock to 32 * that must be enabled for the IP module connected to the clock to
@@ -42,6 +44,8 @@ struct clkops {
42 u8 *, u8 *); 44 u8 *, u8 *);
43 void (*find_companion)(struct clk *, void __iomem **, 45 void (*find_companion)(struct clk *, void __iomem **,
44 u8 *); 46 u8 *);
47 void (*allow_idle)(struct clk *);
48 void (*deny_idle)(struct clk *);
45}; 49};
46 50
47#ifdef CONFIG_ARCH_OMAP2PLUS 51#ifdef CONFIG_ARCH_OMAP2PLUS
@@ -293,6 +297,8 @@ extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
293extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table); 297extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
294#endif 298#endif
295extern struct clk *omap_clk_get_by_name(const char *name); 299extern struct clk *omap_clk_get_by_name(const char *name);
300extern int omap_clk_enable_autoidle_all(void);
301extern int omap_clk_disable_autoidle_all(void);
296 302
297extern const struct clkops clkops_null; 303extern const struct clkops clkops_null;
298 304