@@ -57,6 +57,7 @@ static DEFINE_MUTEX(clocks_mutex);
static DEFINE_SPINLOCK(clockfw_lock);
#ifdef CONFIG_COMMON_CLK
+LIST_HEAD(clk_hw_omap_clocks);
/*
* Used for clocks that have the same value as the parent clock,
@@ -426,6 +427,37 @@ static int __init omap_clk_setup(char *str)
}
__setup("mpurate=", omap_clk_setup);
+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);
+}
+
+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;
+}
+
+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 = {
.find_idlest = omap2_clk_dflt_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
@@ -562,6 +562,9 @@ void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg,
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
int omap2_dflt_clk_enable(struct clk *clk);
void omap2_dflt_clk_disable(struct clk *clk);
@@ -393,6 +393,9 @@ void __init omap2420_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap2_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
#endif
@@ -415,6 +418,9 @@ void __init omap2430_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap2_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
#endif
@@ -476,6 +482,9 @@ void __init omap3_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap3_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
void __init omap3430_init_late(void)
@@ -483,6 +492,9 @@ void __init omap3430_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap3_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
void __init omap35xx_init_late(void)
@@ -490,6 +502,9 @@ void __init omap35xx_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap3_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
void __init omap3630_init_late(void)
@@ -497,6 +512,9 @@ void __init omap3630_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap3_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
void __init am35xx_init_late(void)
@@ -504,6 +522,9 @@ void __init am35xx_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap3_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
void __init ti81xx_init_late(void)
@@ -511,6 +532,9 @@ void __init ti81xx_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap3_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
#endif
@@ -550,6 +574,9 @@ void __init omap4430_init_late(void)
omap_mux_late_init();
omap2_common_pm_late_init();
omap4_pm_init();
+#ifdef CONFIG_COMMON_CLK
+ omap2_clk_enable_autoidle_all();
+#endif
}
#endif
@@ -623,12 +623,12 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
{
- struct clk_hw_omap *clk;
-
if (oh->clkdm) {
return oh->clkdm;
} else if (oh->_clk) {
#ifdef CONFIG_COMMON_CLK
+ struct clk_hw_omap *clk;
+
clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
return clk->clkdm;
#else