Commit 23fb8ba3 authored by Rajendra Nayak's avatar Rajendra Nayak Committed by Paul Walmsley

ARM: OMAP: clock: list all clk_hw_omap clks to enable/disable autoidle

Platforms can call omap2_init_clk_hw_omap_clocks() to register a clock
using clk_hw_omap. omap2_clk_enable_autoidle_all() and
omap2_clk_disable_autoidle_all() can then be used to run through
all the clocks which support autoidle to enable/disable them.
Signed-off-by: default avatarRajendra Nayak <rnayak@ti.com>
Signed-off-by: default avatarMike Turquette <mturquette@ti.com>
[paul@pwsan.com: added kerneldoc on non-trivial new functions]
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
parent 7a2bd1cc
...@@ -66,6 +66,7 @@ static DEFINE_SPINLOCK(clockfw_lock); ...@@ -66,6 +66,7 @@ static DEFINE_SPINLOCK(clockfw_lock);
#endif #endif
#ifdef CONFIG_COMMON_CLK #ifdef CONFIG_COMMON_CLK
static LIST_HEAD(clk_hw_omap_clocks);
/* /*
* Used for clocks that have the same value as the parent clock, * Used for clocks that have the same value as the parent clock,
...@@ -521,6 +522,64 @@ static int __init omap_clk_setup(char *str) ...@@ -521,6 +522,64 @@ static int __init omap_clk_setup(char *str)
} }
__setup("mpurate=", omap_clk_setup); __setup("mpurate=", omap_clk_setup);
/**
* omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
* @clk: struct clk * to initialize
*
* Add an OMAP clock @clk to the internal list of OMAP clocks. Used
* temporarily for autoidle handling, until this support can be
* integrated into the common clock framework code in some way. No
* return value.
*/
void omap2_init_clk_hw_omap_clocks(struct clk *clk)
{
struct clk_hw_omap *c;
if (__clk_get_flags(clk) & CLK_IS_BASIC)
return;
c = to_clk_hw_omap(__clk_get_hw(clk));
list_add(&c->node, &clk_hw_omap_clocks);
}
/**
* omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that
* support it
*
* Enable clock autoidle on all OMAP clocks that have allow_idle
* function pointers associated with them. This function is intended
* to be temporary until support for this is added to the common clock
* code. Returns 0.
*/
int omap2_clk_enable_autoidle_all(void)
{
struct clk_hw_omap *c;
list_for_each_entry(c, &clk_hw_omap_clocks, node)
if (c->ops && c->ops->allow_idle)
c->ops->allow_idle(c);
return 0;
}
/**
* omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that
* support it
*
* Disable clock autoidle on all OMAP clocks that have allow_idle
* function pointers associated with them. This function is intended
* to be temporary until support for this is added to the common clock
* code. Returns 0.
*/
int omap2_clk_disable_autoidle_all(void)
{
struct clk_hw_omap *c;
list_for_each_entry(c, &clk_hw_omap_clocks, node)
if (c->ops && c->ops->deny_idle)
c->ops->deny_idle(c);
return 0;
}
const struct clk_hw_omap_ops clkhwops_wait = { const struct clk_hw_omap_ops clkhwops_wait = {
.find_idlest = omap2_clk_dflt_find_idlest, .find_idlest = omap2_clk_dflt_find_idlest,
.find_companion = omap2_clk_dflt_find_companion, .find_companion = omap2_clk_dflt_find_companion,
......
...@@ -535,6 +535,9 @@ void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk, ...@@ -535,6 +535,9 @@ void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk, void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg, void __iomem **idlest_reg,
u8 *idlest_bit, u8 *idlest_val); u8 *idlest_bit, u8 *idlest_val);
void omap2_init_clk_hw_omap_clocks(struct clk *clk);
int omap2_clk_enable_autoidle_all(void);
int omap2_clk_disable_autoidle_all(void);
#else #else
int omap2_dflt_clk_enable(struct clk *clk); int omap2_dflt_clk_enable(struct clk *clk);
void omap2_dflt_clk_disable(struct clk *clk); void omap2_dflt_clk_disable(struct clk *clk);
......
...@@ -407,6 +407,9 @@ void __init omap2420_init_late(void) ...@@ -407,6 +407,9 @@ void __init omap2420_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap2_pm_init(); omap2_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
#endif #endif
...@@ -436,6 +439,9 @@ void __init omap2430_init_late(void) ...@@ -436,6 +439,9 @@ void __init omap2430_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap2_pm_init(); omap2_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
#endif #endif
...@@ -509,6 +515,9 @@ void __init omap3_init_late(void) ...@@ -509,6 +515,9 @@ void __init omap3_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
void __init omap3430_init_late(void) void __init omap3430_init_late(void)
...@@ -516,6 +525,9 @@ void __init omap3430_init_late(void) ...@@ -516,6 +525,9 @@ void __init omap3430_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
void __init omap35xx_init_late(void) void __init omap35xx_init_late(void)
...@@ -523,6 +535,9 @@ void __init omap35xx_init_late(void) ...@@ -523,6 +535,9 @@ void __init omap35xx_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
void __init omap3630_init_late(void) void __init omap3630_init_late(void)
...@@ -530,6 +545,9 @@ void __init omap3630_init_late(void) ...@@ -530,6 +545,9 @@ void __init omap3630_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
void __init am35xx_init_late(void) void __init am35xx_init_late(void)
...@@ -537,6 +555,9 @@ void __init am35xx_init_late(void) ...@@ -537,6 +555,9 @@ void __init am35xx_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
void __init ti81xx_init_late(void) void __init ti81xx_init_late(void)
...@@ -544,6 +565,9 @@ void __init ti81xx_init_late(void) ...@@ -544,6 +565,9 @@ void __init ti81xx_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
#endif #endif
...@@ -597,6 +621,9 @@ void __init omap4430_init_late(void) ...@@ -597,6 +621,9 @@ void __init omap4430_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap4_pm_init(); omap4_pm_init();
#ifdef CONFIG_COMMON_CLK
omap2_clk_enable_autoidle_all();
#endif
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment