aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm34xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/pm34xx.c')
-rw-r--r--arch/arm/mach-omap2/pm34xx.c88
1 files changed, 3 insertions, 85 deletions
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index b77df735fa6c..027a537d72b2 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -50,10 +50,6 @@
50#include "sdrc.h" 50#include "sdrc.h"
51#include "control.h" 51#include "control.h"
52 52
53#ifdef CONFIG_SUSPEND
54static suspend_state_t suspend_state = PM_SUSPEND_ON;
55#endif
56
57/* pm34xx errata defined in pm.h */ 53/* pm34xx errata defined in pm.h */
58u16 pm34xx_errata; 54u16 pm34xx_errata;
59 55
@@ -75,16 +71,6 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
75static struct powerdomain *core_pwrdm, *per_pwrdm; 71static struct powerdomain *core_pwrdm, *per_pwrdm;
76static struct powerdomain *cam_pwrdm; 72static struct powerdomain *cam_pwrdm;
77 73
78static inline void omap3_per_save_context(void)
79{
80 omap_gpio_save_context();
81}
82
83static inline void omap3_per_restore_context(void)
84{
85 omap_gpio_restore_context();
86}
87
88static void omap3_enable_io_chain(void) 74static void omap3_enable_io_chain(void)
89{ 75{
90 int timeout = 0; 76 int timeout = 0;
@@ -290,11 +276,6 @@ void omap_sram_idle(void)
290 int core_prev_state, per_prev_state; 276 int core_prev_state, per_prev_state;
291 u32 sdrc_pwr = 0; 277 u32 sdrc_pwr = 0;
292 278
293 pwrdm_clear_all_prev_pwrst(mpu_pwrdm);
294 pwrdm_clear_all_prev_pwrst(neon_pwrdm);
295 pwrdm_clear_all_prev_pwrst(core_pwrdm);
296 pwrdm_clear_all_prev_pwrst(per_pwrdm);
297
298 mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm); 279 mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm);
299 switch (mpu_next_state) { 280 switch (mpu_next_state) {
300 case PWRDM_POWER_ON: 281 case PWRDM_POWER_ON:
@@ -332,8 +313,6 @@ void omap_sram_idle(void)
332 if (per_next_state < PWRDM_POWER_ON) { 313 if (per_next_state < PWRDM_POWER_ON) {
333 per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0; 314 per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;
334 omap2_gpio_prepare_for_idle(per_going_off); 315 omap2_gpio_prepare_for_idle(per_going_off);
335 if (per_next_state == PWRDM_POWER_OFF)
336 omap3_per_save_context();
337 } 316 }
338 317
339 /* CORE */ 318 /* CORE */
@@ -399,8 +378,6 @@ void omap_sram_idle(void)
399 if (per_next_state < PWRDM_POWER_ON) { 378 if (per_next_state < PWRDM_POWER_ON) {
400 per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); 379 per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm);
401 omap2_gpio_resume_after_idle(); 380 omap2_gpio_resume_after_idle();
402 if (per_prev_state == PWRDM_POWER_OFF)
403 omap3_per_restore_context();
404 } 381 }
405 382
406 /* Disable IO-PAD and IO-CHAIN wakeup */ 383 /* Disable IO-PAD and IO-CHAIN wakeup */
@@ -477,50 +454,6 @@ restore:
477 return ret; 454 return ret;
478} 455}
479 456
480static int omap3_pm_enter(suspend_state_t unused)
481{
482 int ret = 0;
483
484 switch (suspend_state) {
485 case PM_SUSPEND_STANDBY:
486 case PM_SUSPEND_MEM:
487 ret = omap3_pm_suspend();
488 break;
489 default:
490 ret = -EINVAL;
491 }
492
493 return ret;
494}
495
496/* Hooks to enable / disable UART interrupts during suspend */
497static int omap3_pm_begin(suspend_state_t state)
498{
499 disable_hlt();
500 suspend_state = state;
501 omap_prcm_irq_prepare();
502 return 0;
503}
504
505static void omap3_pm_end(void)
506{
507 suspend_state = PM_SUSPEND_ON;
508 enable_hlt();
509 return;
510}
511
512static void omap3_pm_finish(void)
513{
514 omap_prcm_irq_complete();
515}
516
517static const struct platform_suspend_ops omap_pm_ops = {
518 .begin = omap3_pm_begin,
519 .end = omap3_pm_end,
520 .enter = omap3_pm_enter,
521 .finish = omap3_pm_finish,
522 .valid = suspend_valid_only_mem,
523};
524#endif /* CONFIG_SUSPEND */ 457#endif /* CONFIG_SUSPEND */
525 458
526 459
@@ -741,21 +674,6 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
741} 674}
742 675
743/* 676/*
744 * Enable hw supervised mode for all clockdomains if it's
745 * supported. Initiate sleep transition for other clockdomains, if
746 * they are not used
747 */
748static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
749{
750 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
751 clkdm_allow_idle(clkdm);
752 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
753 atomic_read(&clkdm->usecount) == 0)
754 clkdm_sleep(clkdm);
755 return 0;
756}
757
758/*
759 * Push functions to SRAM 677 * Push functions to SRAM
760 * 678 *
761 * The minimum set of functions is pushed to SRAM for execution: 679 * The minimum set of functions is pushed to SRAM for execution:
@@ -824,7 +742,7 @@ static int __init omap3_pm_init(void)
824 goto err2; 742 goto err2;
825 } 743 }
826 744
827 (void) clkdm_for_each(clkdms_setup, NULL); 745 (void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
828 746
829 mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); 747 mpu_pwrdm = pwrdm_lookup("mpu_pwrdm");
830 if (mpu_pwrdm == NULL) { 748 if (mpu_pwrdm == NULL) {
@@ -843,8 +761,8 @@ static int __init omap3_pm_init(void)
843 core_clkdm = clkdm_lookup("core_clkdm"); 761 core_clkdm = clkdm_lookup("core_clkdm");
844 762
845#ifdef CONFIG_SUSPEND 763#ifdef CONFIG_SUSPEND
846 suspend_set_ops(&omap_pm_ops); 764 omap_pm_suspend = omap3_pm_suspend;
847#endif /* CONFIG_SUSPEND */ 765#endif
848 766
849 arm_pm_idle = omap3_pm_idle; 767 arm_pm_idle = omap3_pm_idle;
850 omap3_idle_init(); 768 omap3_idle_init();