diff options
Diffstat (limited to 'arch/arm/mach-omap2/pm24xx.c')
-rw-r--r-- | arch/arm/mach-omap2/pm24xx.c | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index bff5c4e89742..374299ea7ade 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -36,12 +36,12 @@ | |||
36 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
37 | 37 | ||
38 | #include <mach/irqs.h> | 38 | #include <mach/irqs.h> |
39 | #include <mach/clock.h> | 39 | #include <plat/clock.h> |
40 | #include <mach/sram.h> | 40 | #include <plat/sram.h> |
41 | #include <mach/control.h> | 41 | #include <plat/control.h> |
42 | #include <mach/mux.h> | 42 | #include <plat/mux.h> |
43 | #include <mach/dma.h> | 43 | #include <plat/dma.h> |
44 | #include <mach/board.h> | 44 | #include <plat/board.h> |
45 | 45 | ||
46 | #include "prm.h" | 46 | #include "prm.h" |
47 | #include "prm-regbits-24xx.h" | 47 | #include "prm-regbits-24xx.h" |
@@ -50,18 +50,15 @@ | |||
50 | #include "sdrc.h" | 50 | #include "sdrc.h" |
51 | #include "pm.h" | 51 | #include "pm.h" |
52 | 52 | ||
53 | #include <mach/powerdomain.h> | 53 | #include <plat/powerdomain.h> |
54 | #include <mach/clockdomain.h> | 54 | #include <plat/clockdomain.h> |
55 | 55 | ||
56 | static void (*omap2_sram_idle)(void); | 56 | static void (*omap2_sram_idle)(void); |
57 | static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl, | 57 | static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl, |
58 | void __iomem *sdrc_power); | 58 | void __iomem *sdrc_power); |
59 | 59 | ||
60 | static struct powerdomain *mpu_pwrdm; | 60 | static struct powerdomain *mpu_pwrdm, *core_pwrdm; |
61 | static struct powerdomain *core_pwrdm; | 61 | static struct clockdomain *dsp_clkdm, *mpu_clkdm, *wkup_clkdm, *gfx_clkdm; |
62 | |||
63 | static struct clockdomain *dsp_clkdm; | ||
64 | static struct clockdomain *gfx_clkdm; | ||
65 | 62 | ||
66 | static struct clk *osc_ck, *emul_ck; | 63 | static struct clk *osc_ck, *emul_ck; |
67 | 64 | ||
@@ -219,11 +216,12 @@ static void omap2_enter_mpu_retention(void) | |||
219 | /* Try to enter MPU retention */ | 216 | /* Try to enter MPU retention */ |
220 | prm_write_mod_reg((0x01 << OMAP_POWERSTATE_SHIFT) | | 217 | prm_write_mod_reg((0x01 << OMAP_POWERSTATE_SHIFT) | |
221 | OMAP_LOGICRETSTATE, | 218 | OMAP_LOGICRETSTATE, |
222 | MPU_MOD, PM_PWSTCTRL); | 219 | MPU_MOD, OMAP2_PM_PWSTCTRL); |
223 | } else { | 220 | } else { |
224 | /* Block MPU retention */ | 221 | /* Block MPU retention */ |
225 | 222 | ||
226 | prm_write_mod_reg(OMAP_LOGICRETSTATE, MPU_MOD, PM_PWSTCTRL); | 223 | prm_write_mod_reg(OMAP_LOGICRETSTATE, MPU_MOD, |
224 | OMAP2_PM_PWSTCTRL); | ||
227 | only_idle = 1; | 225 | only_idle = 1; |
228 | } | 226 | } |
229 | 227 | ||
@@ -333,9 +331,17 @@ static struct platform_suspend_ops omap_pm_ops = { | |||
333 | .valid = suspend_valid_only_mem, | 331 | .valid = suspend_valid_only_mem, |
334 | }; | 332 | }; |
335 | 333 | ||
336 | static int _pm_clkdm_enable_hwsup(struct clockdomain *clkdm, void *unused) | 334 | /* XXX This function should be shareable between OMAP2xxx and OMAP3 */ |
335 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) | ||
337 | { | 336 | { |
338 | omap2_clkdm_allow_idle(clkdm); | 337 | clkdm_clear_all_wkdeps(clkdm); |
338 | clkdm_clear_all_sleepdeps(clkdm); | ||
339 | |||
340 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | ||
341 | omap2_clkdm_allow_idle(clkdm); | ||
342 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && | ||
343 | atomic_read(&clkdm->usecount) == 0) | ||
344 | omap2_clkdm_sleep(clkdm); | ||
339 | return 0; | 345 | return 0; |
340 | } | 346 | } |
341 | 347 | ||
@@ -348,14 +354,6 @@ static void __init prcm_setup_regs(void) | |||
348 | prm_write_mod_reg(OMAP24XX_AUTOIDLE, OCP_MOD, | 354 | prm_write_mod_reg(OMAP24XX_AUTOIDLE, OCP_MOD, |
349 | OMAP2_PRCM_SYSCONFIG_OFFSET); | 355 | OMAP2_PRCM_SYSCONFIG_OFFSET); |
350 | 356 | ||
351 | /* Set all domain wakeup dependencies */ | ||
352 | prm_write_mod_reg(OMAP_EN_WKUP_MASK, MPU_MOD, PM_WKDEP); | ||
353 | prm_write_mod_reg(0, OMAP24XX_DSP_MOD, PM_WKDEP); | ||
354 | prm_write_mod_reg(0, GFX_MOD, PM_WKDEP); | ||
355 | prm_write_mod_reg(0, CORE_MOD, PM_WKDEP); | ||
356 | if (cpu_is_omap2430()) | ||
357 | prm_write_mod_reg(0, OMAP2430_MDM_MOD, PM_WKDEP); | ||
358 | |||
359 | /* | 357 | /* |
360 | * Set CORE powerdomain memory banks to retain their contents | 358 | * Set CORE powerdomain memory banks to retain their contents |
361 | * during RETENTION | 359 | * during RETENTION |
@@ -384,8 +382,12 @@ static void __init prcm_setup_regs(void) | |||
384 | pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); | 382 | pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); |
385 | omap2_clkdm_sleep(gfx_clkdm); | 383 | omap2_clkdm_sleep(gfx_clkdm); |
386 | 384 | ||
387 | /* Enable clockdomain hardware-supervised control for all clkdms */ | 385 | /* |
388 | clkdm_for_each(_pm_clkdm_enable_hwsup, NULL); | 386 | * Clear clockdomain wakeup dependencies and enable |
387 | * hardware-supervised idle for all clkdms | ||
388 | */ | ||
389 | clkdm_for_each(clkdms_setup, NULL); | ||
390 | clkdm_add_wkdep(mpu_clkdm, wkup_clkdm); | ||
389 | 391 | ||
390 | /* Enable clock autoidle for all domains */ | 392 | /* Enable clock autoidle for all domains */ |
391 | cm_write_mod_reg(OMAP24XX_AUTO_CAM | | 393 | cm_write_mod_reg(OMAP24XX_AUTO_CAM | |
@@ -481,7 +483,7 @@ static int __init omap2_pm_init(void) | |||
481 | l = prm_read_mod_reg(OCP_MOD, OMAP2_PRCM_REVISION_OFFSET); | 483 | l = prm_read_mod_reg(OCP_MOD, OMAP2_PRCM_REVISION_OFFSET); |
482 | printk(KERN_INFO "PRCM revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f); | 484 | printk(KERN_INFO "PRCM revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f); |
483 | 485 | ||
484 | /* Look up important powerdomains, clockdomains */ | 486 | /* Look up important powerdomains */ |
485 | 487 | ||
486 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); | 488 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); |
487 | if (!mpu_pwrdm) | 489 | if (!mpu_pwrdm) |
@@ -491,9 +493,19 @@ static int __init omap2_pm_init(void) | |||
491 | if (!core_pwrdm) | 493 | if (!core_pwrdm) |
492 | pr_err("PM: core_pwrdm not found\n"); | 494 | pr_err("PM: core_pwrdm not found\n"); |
493 | 495 | ||
496 | /* Look up important clockdomains */ | ||
497 | |||
498 | mpu_clkdm = clkdm_lookup("mpu_clkdm"); | ||
499 | if (!mpu_clkdm) | ||
500 | pr_err("PM: mpu_clkdm not found\n"); | ||
501 | |||
502 | wkup_clkdm = clkdm_lookup("wkup_clkdm"); | ||
503 | if (!wkup_clkdm) | ||
504 | pr_err("PM: wkup_clkdm not found\n"); | ||
505 | |||
494 | dsp_clkdm = clkdm_lookup("dsp_clkdm"); | 506 | dsp_clkdm = clkdm_lookup("dsp_clkdm"); |
495 | if (!dsp_clkdm) | 507 | if (!dsp_clkdm) |
496 | pr_err("PM: mpu_clkdm not found\n"); | 508 | pr_err("PM: dsp_clkdm not found\n"); |
497 | 509 | ||
498 | gfx_clkdm = clkdm_lookup("gfx_clkdm"); | 510 | gfx_clkdm = clkdm_lookup("gfx_clkdm"); |
499 | if (!gfx_clkdm) | 511 | if (!gfx_clkdm) |