diff options
author | Paul Walmsley <paul@pwsan.com> | 2012-10-29 22:56:29 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-11-08 14:33:08 -0500 |
commit | c4ceedcb18cf7a06059482a3a1828b9aad9f78cf (patch) | |
tree | e9b5e9bb75aa84ea70159fa68e103a69518a1eee /arch/arm/mach-omap2/cm2xxx.c | |
parent | b6ffa05091978c68e94d2802200f2aaa06a598d9 (diff) |
ARM: OMAP2+: CM/clock: convert _omap2_module_wait_ready() to use SoC-independent CM functions
Convert the OMAP clock code's _omap2_module_wait_ready() to use
SoC-independent CM functions that are provided by the CM code, rather
than using a deprecated function from mach-omap2/prcm.c.
This facilitates the future conversion of the CM code to a driver, and
also removes a mach-omap2/prcm.c user. mach-omap2/prcm.c will be removed
by a subsequent patch.
Some modules have IDLEST registers that aren't in the CM module, such
as the AM3517 IDLEST bits. So we also need a fallback function for
these non-CM odd cases. Create a temporary one in mach-omap2/clock.c,
intended to exist until the SCM drivers are ready.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Vaibhav Hiremath <hvaibhav@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/cm2xxx.c')
-rw-r--r-- | arch/arm/mach-omap2/cm2xxx.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c index e96cd7041b66..db650690e9d0 100644 --- a/arch/arm/mach-omap2/cm2xxx.c +++ b/arch/arm/mach-omap2/cm2xxx.c | |||
@@ -198,6 +198,43 @@ void omap2xxx_cm_apll96_disable(void) | |||
198 | _omap2xxx_apll_disable(OMAP24XX_EN_96M_PLL_SHIFT); | 198 | _omap2xxx_apll_disable(OMAP24XX_EN_96M_PLL_SHIFT); |
199 | } | 199 | } |
200 | 200 | ||
201 | /** | ||
202 | * omap2xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components | ||
203 | * @idlest_reg: CM_IDLEST* virtual address | ||
204 | * @prcm_inst: pointer to an s16 to return the PRCM instance offset | ||
205 | * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID | ||
206 | * | ||
207 | * XXX This function is only needed until absolute register addresses are | ||
208 | * removed from the OMAP struct clk records. | ||
209 | */ | ||
210 | int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, | ||
211 | u8 *idlest_reg_id) | ||
212 | { | ||
213 | unsigned long offs; | ||
214 | u8 idlest_offs; | ||
215 | int i; | ||
216 | |||
217 | if (idlest_reg < cm_base || idlest_reg > (cm_base + 0x0fff)) | ||
218 | return -EINVAL; | ||
219 | |||
220 | idlest_offs = (unsigned long)idlest_reg & 0xff; | ||
221 | for (i = 0; i < ARRAY_SIZE(omap2xxx_cm_idlest_offs); i++) { | ||
222 | if (idlest_offs == omap2xxx_cm_idlest_offs[i]) { | ||
223 | *idlest_reg_id = i + 1; | ||
224 | break; | ||
225 | } | ||
226 | } | ||
227 | |||
228 | if (i == ARRAY_SIZE(omap2xxx_cm_idlest_offs)) | ||
229 | return -EINVAL; | ||
230 | |||
231 | offs = idlest_reg - cm_base; | ||
232 | offs &= 0xff00; | ||
233 | *prcm_inst = offs; | ||
234 | |||
235 | return 0; | ||
236 | } | ||
237 | |||
201 | /* | 238 | /* |
202 | * | 239 | * |
203 | */ | 240 | */ |
@@ -314,3 +351,31 @@ struct clkdm_ops omap2_clkdm_operations = { | |||
314 | .clkdm_clk_enable = omap2xxx_clkdm_clk_enable, | 351 | .clkdm_clk_enable = omap2xxx_clkdm_clk_enable, |
315 | .clkdm_clk_disable = omap2xxx_clkdm_clk_disable, | 352 | .clkdm_clk_disable = omap2xxx_clkdm_clk_disable, |
316 | }; | 353 | }; |
354 | |||
355 | /* | ||
356 | * | ||
357 | */ | ||
358 | |||
359 | static struct cm_ll_data omap2xxx_cm_ll_data = { | ||
360 | .split_idlest_reg = &omap2xxx_cm_split_idlest_reg, | ||
361 | .wait_module_ready = &omap2xxx_cm_wait_module_ready, | ||
362 | }; | ||
363 | |||
364 | int __init omap2xxx_cm_init(void) | ||
365 | { | ||
366 | if (!cpu_is_omap24xx()) | ||
367 | return 0; | ||
368 | |||
369 | return cm_register(&omap2xxx_cm_ll_data); | ||
370 | } | ||
371 | |||
372 | static void __exit omap2xxx_cm_exit(void) | ||
373 | { | ||
374 | if (!cpu_is_omap24xx()) | ||
375 | return; | ||
376 | |||
377 | /* Should never happen */ | ||
378 | WARN(cm_unregister(&omap2xxx_cm_ll_data), | ||
379 | "%s: cm_ll_data function pointer mismatch\n", __func__); | ||
380 | } | ||
381 | __exitcall(omap2xxx_cm_exit); | ||