aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clock.c
diff options
context:
space:
mode:
authorRanjith Lohithakshan <ranjithl@ti.com>2010-02-24 14:05:54 -0500
committerPaul Walmsley <paul@pwsan.com>2010-02-24 14:05:54 -0500
commit419cc97d3678f0fca5e60b3853dd9c1371f67805 (patch)
treea3997e3f9ad52abf927597f8e241fb6dfb02ab00 /arch/arm/mach-omap2/clock.c
parentcde08f81b1d7952ae00c4be2165da629ef985522 (diff)
OMAP2/3 clock: Extend find_idlest() to pass back idle state value
Current implementation defines clock idle state indicators based on the cpu information (cpu_is_omap24xx() or cpu_is_omap34xx()) in a system wide manner. This patch extends the find_idlest() function in clkops to pass back the idle state indicator for that clock, thus allowing idle state indicators to be defined on a per clock basis if required. This is specifically needed on AM35xx devices as the new IPSS clocks indicates the idle status (0 is idle, 1 is ready) in a way just opposite to how its handled in OMAP3 (0 is ready, 1 is idle). Signed-off-by: Ranjith Lohithakshan <ranjithl@ti.com> [paul@pwsan.com: updated to apply after commit 98c45457 et seq.] Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/clock.c')
-rw-r--r--arch/arm/mach-omap2/clock.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 999b91e023b..3bb3292ec46 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -57,7 +57,7 @@ u8 cpu_mask;
57static void _omap2_module_wait_ready(struct clk *clk) 57static void _omap2_module_wait_ready(struct clk *clk)
58{ 58{
59 void __iomem *companion_reg, *idlest_reg; 59 void __iomem *companion_reg, *idlest_reg;
60 u8 other_bit, idlest_bit; 60 u8 other_bit, idlest_bit, idlest_val;
61 61
62 /* Not all modules have multiple clocks that their IDLEST depends on */ 62 /* Not all modules have multiple clocks that their IDLEST depends on */
63 if (clk->ops->find_companion) { 63 if (clk->ops->find_companion) {
@@ -66,9 +66,10 @@ static void _omap2_module_wait_ready(struct clk *clk)
66 return; 66 return;
67 } 67 }
68 68
69 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit); 69 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val);
70 70
71 omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), clk->name); 71 omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val,
72 clk->name);
72} 73}
73 74
74/* Enables clock without considering parent dependencies or use count 75/* Enables clock without considering parent dependencies or use count
@@ -175,7 +176,8 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
175 * omap2_clk_dflt_find_idlest - find CM_IDLEST reg va, bit shift for @clk 176 * omap2_clk_dflt_find_idlest - find CM_IDLEST reg va, bit shift for @clk
176 * @clk: struct clk * to find IDLEST info for 177 * @clk: struct clk * to find IDLEST info for
177 * @idlest_reg: void __iomem ** to return the CM_IDLEST va in 178 * @idlest_reg: void __iomem ** to return the CM_IDLEST va in
178 * @idlest_bit: u8 ** to return the CM_IDLEST bit shift in 179 * @idlest_bit: u8 * to return the CM_IDLEST bit shift in
180 * @idlest_val: u8 * to return the idle status indicator
179 * 181 *
180 * Return the CM_IDLEST register address and bit shift corresponding 182 * Return the CM_IDLEST register address and bit shift corresponding
181 * to the module that "owns" this clock. This default code assumes 183 * to the module that "owns" this clock. This default code assumes
@@ -185,13 +187,26 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
185 * CM_IDLEST2). This is not true for all modules. No return value. 187 * CM_IDLEST2). This is not true for all modules. No return value.
186 */ 188 */
187void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, 189void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
188 u8 *idlest_bit) 190 u8 *idlest_bit, u8 *idlest_val)
189{ 191{
190 u32 r; 192 u32 r;
191 193
192 r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); 194 r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
193 *idlest_reg = (__force void __iomem *)r; 195 *idlest_reg = (__force void __iomem *)r;
194 *idlest_bit = clk->enable_bit; 196 *idlest_bit = clk->enable_bit;
197
198 /*
199 * 24xx uses 0 to indicate not ready, and 1 to indicate ready.
200 * 34xx reverses this, just to keep us on our toes
201 * AM35xx uses both, depending on the module.
202 */
203 if (cpu_is_omap24xx())
204 *idlest_val = OMAP24XX_CM_IDLEST_VAL;
205 else if (cpu_is_omap34xx())
206 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
207 else
208 BUG();
209
195} 210}
196 211
197int omap2_dflt_clk_enable(struct clk *clk) 212int omap2_dflt_clk_enable(struct clk *clk)