aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2011-07-10 07:57:06 -0400
committerPaul Walmsley <paul@pwsan.com>2011-07-10 07:57:06 -0400
commit12706c542574ea0127a13815efe59ca9ba6d88d7 (patch)
treeb4e134ac206e146dcfe33020919525b5060219bc /arch
parent555e74ea08bfc04a0136f976cbaa200addf1ba87 (diff)
OMAP2+: clock: allow per-SoC clock init code to prevent clockdomain calls from clock code
The OMAP2/3 clock code was written to notify the clockdomain code when the first clock in a clockdomain is enabled and when the last enabled clock in a clockdomain is disabled. OMAP4 requires a different approach: the hwmod code needs to signal the clockdomain code when to force-enable and auto-idle a clockdomain during the IP block enable process. The current conjecture is that once that hwmod sequence is implemented, it will no longer be necessary for the clock code to call into the clockdomain code for "optional clocks" on OMAP4. Add a static flag to the OMAP2+ clock code, clkdm_control, that by default preserves the OMAP2/3 behavior. Also add a function, omap2_clk_disable_clkdm_control(), intended to be called from OMAP4 and beyond clock initcalls, that disables the old behavior. Part of this patch was originally based on a patch by Rajendra Nayak <rnayak@ti.com>. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: BenoƮt Cousson <b-cousson@ti.com> Cc: Rajendra Nayak <rnayak@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/clock.c27
-rw-r--r--arch/arm/mach-omap2/clock.h3
2 files changed, 27 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 180299e4a838..fc845767e8d4 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -38,6 +38,14 @@
38u8 cpu_mask; 38u8 cpu_mask;
39 39
40/* 40/*
41 * clkdm_control: if true, then when a clock is enabled in the
42 * hardware, its clockdomain will first be enabled; and when a clock
43 * is disabled in the hardware, its clockdomain will be disabled
44 * afterwards.
45 */
46static bool clkdm_control = true;
47
48/*
41 * OMAP2+ specific clock functions 49 * OMAP2+ specific clock functions
42 */ 50 */
43 51
@@ -100,6 +108,19 @@ void omap2_init_clk_clkdm(struct clk *clk)
100} 108}
101 109
102/** 110/**
111 * omap2_clk_disable_clkdm_control - disable clkdm control on clk enable/disable
112 *
113 * Prevent the OMAP clock code from calling into the clockdomain code
114 * when a hardware clock in that clockdomain is enabled or disabled.
115 * Intended to be called at init time from omap*_clk_init(). No
116 * return value.
117 */
118void __init omap2_clk_disable_clkdm_control(void)
119{
120 clkdm_control = false;
121}
122
123/**
103 * omap2_clk_dflt_find_companion - find companion clock to @clk 124 * omap2_clk_dflt_find_companion - find companion clock to @clk
104 * @clk: struct clk * to find the companion clock of 125 * @clk: struct clk * to find the companion clock of
105 * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in 126 * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in
@@ -268,7 +289,7 @@ void omap2_clk_disable(struct clk *clk)
268 clk->ops->disable(clk); 289 clk->ops->disable(clk);
269 } 290 }
270 291
271 if (clk->clkdm) 292 if (clkdm_control && clk->clkdm)
272 clkdm_clk_disable(clk->clkdm, clk); 293 clkdm_clk_disable(clk->clkdm, clk);
273 294
274 if (clk->parent) 295 if (clk->parent)
@@ -308,7 +329,7 @@ int omap2_clk_enable(struct clk *clk)
308 } 329 }
309 } 330 }
310 331
311 if (clk->clkdm) { 332 if (clkdm_control && clk->clkdm) {
312 ret = clkdm_clk_enable(clk->clkdm, clk); 333 ret = clkdm_clk_enable(clk->clkdm, clk);
313 if (ret) { 334 if (ret) {
314 WARN(1, "clock: %s: could not enable clockdomain %s: " 335 WARN(1, "clock: %s: could not enable clockdomain %s: "
@@ -330,7 +351,7 @@ int omap2_clk_enable(struct clk *clk)
330 return 0; 351 return 0;
331 352
332oce_err3: 353oce_err3:
333 if (clk->clkdm) 354 if (clkdm_control && clk->clkdm)
334 clkdm_clk_disable(clk->clkdm, clk); 355 clkdm_clk_disable(clk->clkdm, clk);
335oce_err2: 356oce_err2:
336 if (clk->parent) 357 if (clk->parent)
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index e10ff2b54844..48ac568881bd 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -16,6 +16,8 @@
16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H 16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H
17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H 17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H
18 18
19#include <linux/kernel.h>
20
19#include <plat/clock.h> 21#include <plat/clock.h>
20 22
21/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 23/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
@@ -72,6 +74,7 @@ void omap2_clk_disable_unused(struct clk *clk);
72#endif 74#endif
73 75
74void omap2_init_clk_clkdm(struct clk *clk); 76void omap2_init_clk_clkdm(struct clk *clk);
77void __init omap2_clk_disable_clkdm_control(void);
75 78
76/* clkt_clksel.c public functions */ 79/* clkt_clksel.c public functions */
77u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, 80u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,