diff options
author | Tony Lindgren <tony@atomide.com> | 2011-11-04 20:40:52 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-11-04 20:40:52 -0400 |
commit | 7fd92b56e5508fc3453ac9a65e11561178e86330 (patch) | |
tree | 8fad9740a733326b580f4a39ddaac84ae5e6674d /arch | |
parent | 2cbb6160b56038aad0ce0b05bed7a75d6f086171 (diff) | |
parent | 3047454475adca98e30e00dfca21021a0de99d78 (diff) |
Merge branch 'for_3.2/pm-cleanup-2' of git://github.com/khilman/linux-omap-pm into fixes
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/id.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 70 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/cpu.h | 17 |
3 files changed, 53 insertions, 39 deletions
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index d27daf921c7e..7f47092a193f 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c | |||
@@ -187,8 +187,11 @@ static void __init omap3_check_features(void) | |||
187 | OMAP3_CHECK_FEATURE(status, ISP); | 187 | OMAP3_CHECK_FEATURE(status, ISP); |
188 | if (cpu_is_omap3630()) | 188 | if (cpu_is_omap3630()) |
189 | omap_features |= OMAP3_HAS_192MHZ_CLK; | 189 | omap_features |= OMAP3_HAS_192MHZ_CLK; |
190 | if (!cpu_is_omap3505() && !cpu_is_omap3517()) | 190 | if (cpu_is_omap3430() || cpu_is_omap3630()) |
191 | omap_features |= OMAP3_HAS_IO_WAKEUP; | 191 | omap_features |= OMAP3_HAS_IO_WAKEUP; |
192 | if (cpu_is_omap3630() || omap_rev() == OMAP3430_REV_ES3_1 || | ||
193 | omap_rev() == OMAP3430_REV_ES3_1_2) | ||
194 | omap_features |= OMAP3_HAS_IO_CHAIN_CTRL; | ||
192 | 195 | ||
193 | omap_features |= OMAP3_HAS_SDRC; | 196 | omap_features |= OMAP3_HAS_SDRC; |
194 | 197 | ||
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index c8cbd00a41af..efa66494c1e3 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -99,31 +99,27 @@ static void omap3_enable_io_chain(void) | |||
99 | { | 99 | { |
100 | int timeout = 0; | 100 | int timeout = 0; |
101 | 101 | ||
102 | if (omap_rev() >= OMAP3430_REV_ES3_1) { | 102 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, |
103 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, | 103 | PM_WKEN); |
104 | PM_WKEN); | 104 | /* Do a readback to assure write has been done */ |
105 | /* Do a readback to assure write has been done */ | 105 | omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN); |
106 | omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN); | 106 | |
107 | 107 | while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) & | |
108 | while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) & | 108 | OMAP3430_ST_IO_CHAIN_MASK)) { |
109 | OMAP3430_ST_IO_CHAIN_MASK)) { | 109 | timeout++; |
110 | timeout++; | 110 | if (timeout > 1000) { |
111 | if (timeout > 1000) { | 111 | pr_err("Wake up daisy chain activation failed.\n"); |
112 | printk(KERN_ERR "Wake up daisy chain " | 112 | return; |
113 | "activation failed.\n"); | ||
114 | return; | ||
115 | } | ||
116 | omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, | ||
117 | WKUP_MOD, PM_WKEN); | ||
118 | } | 113 | } |
114 | omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, | ||
115 | WKUP_MOD, PM_WKEN); | ||
119 | } | 116 | } |
120 | } | 117 | } |
121 | 118 | ||
122 | static void omap3_disable_io_chain(void) | 119 | static void omap3_disable_io_chain(void) |
123 | { | 120 | { |
124 | if (omap_rev() >= OMAP3430_REV_ES3_1) | 121 | omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, |
125 | omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, | 122 | PM_WKEN); |
126 | PM_WKEN); | ||
127 | } | 123 | } |
128 | 124 | ||
129 | static void omap3_core_save_context(void) | 125 | static void omap3_core_save_context(void) |
@@ -363,7 +359,6 @@ void omap_sram_idle(void) | |||
363 | printk(KERN_ERR "Invalid mpu state in sram_idle\n"); | 359 | printk(KERN_ERR "Invalid mpu state in sram_idle\n"); |
364 | return; | 360 | return; |
365 | } | 361 | } |
366 | pwrdm_pre_transition(); | ||
367 | 362 | ||
368 | /* NEON control */ | 363 | /* NEON control */ |
369 | if (pwrdm_read_pwrst(neon_pwrdm) == PWRDM_POWER_ON) | 364 | if (pwrdm_read_pwrst(neon_pwrdm) == PWRDM_POWER_ON) |
@@ -376,7 +371,8 @@ void omap_sram_idle(void) | |||
376 | (per_next_state < PWRDM_POWER_ON || | 371 | (per_next_state < PWRDM_POWER_ON || |
377 | core_next_state < PWRDM_POWER_ON)) { | 372 | core_next_state < PWRDM_POWER_ON)) { |
378 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN); | 373 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN); |
379 | omap3_enable_io_chain(); | 374 | if (omap3_has_io_chain_ctrl()) |
375 | omap3_enable_io_chain(); | ||
380 | } | 376 | } |
381 | 377 | ||
382 | /* Block console output in case it is on one of the OMAP UARTs */ | 378 | /* Block console output in case it is on one of the OMAP UARTs */ |
@@ -386,6 +382,8 @@ void omap_sram_idle(void) | |||
386 | if (!console_trylock()) | 382 | if (!console_trylock()) |
387 | goto console_still_active; | 383 | goto console_still_active; |
388 | 384 | ||
385 | pwrdm_pre_transition(); | ||
386 | |||
389 | /* PER */ | 387 | /* PER */ |
390 | if (per_next_state < PWRDM_POWER_ON) { | 388 | if (per_next_state < PWRDM_POWER_ON) { |
391 | per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0; | 389 | per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0; |
@@ -409,13 +407,14 @@ void omap_sram_idle(void) | |||
409 | omap3_intc_prepare_idle(); | 407 | omap3_intc_prepare_idle(); |
410 | 408 | ||
411 | /* | 409 | /* |
412 | * On EMU/HS devices ROM code restores a SRDC value | 410 | * On EMU/HS devices ROM code restores a SRDC value |
413 | * from scratchpad which has automatic self refresh on timeout | 411 | * from scratchpad which has automatic self refresh on timeout |
414 | * of AUTO_CNT = 1 enabled. This takes care of erratum ID i443. | 412 | * of AUTO_CNT = 1 enabled. This takes care of erratum ID i443. |
415 | * Hence store/restore the SDRC_POWER register here. | 413 | * Hence store/restore the SDRC_POWER register here. |
416 | */ | 414 | */ |
417 | if (omap_rev() >= OMAP3430_REV_ES3_0 && | 415 | if (cpu_is_omap3430() && omap_rev() >= OMAP3430_REV_ES3_0 && |
418 | omap_type() != OMAP2_DEVICE_TYPE_GP && | 416 | (omap_type() == OMAP2_DEVICE_TYPE_EMU || |
417 | omap_type() == OMAP2_DEVICE_TYPE_SEC) && | ||
419 | core_next_state == PWRDM_POWER_OFF) | 418 | core_next_state == PWRDM_POWER_OFF) |
420 | sdrc_pwr = sdrc_read_reg(SDRC_POWER); | 419 | sdrc_pwr = sdrc_read_reg(SDRC_POWER); |
421 | 420 | ||
@@ -432,8 +431,9 @@ void omap_sram_idle(void) | |||
432 | omap34xx_do_sram_idle(save_state); | 431 | omap34xx_do_sram_idle(save_state); |
433 | 432 | ||
434 | /* Restore normal SDRC POWER settings */ | 433 | /* Restore normal SDRC POWER settings */ |
435 | if (omap_rev() >= OMAP3430_REV_ES3_0 && | 434 | if (cpu_is_omap3430() && omap_rev() >= OMAP3430_REV_ES3_0 && |
436 | omap_type() != OMAP2_DEVICE_TYPE_GP && | 435 | (omap_type() == OMAP2_DEVICE_TYPE_EMU || |
436 | omap_type() == OMAP2_DEVICE_TYPE_SEC) && | ||
437 | core_next_state == PWRDM_POWER_OFF) | 437 | core_next_state == PWRDM_POWER_OFF) |
438 | sdrc_write_reg(sdrc_pwr, SDRC_POWER); | 438 | sdrc_write_reg(sdrc_pwr, SDRC_POWER); |
439 | 439 | ||
@@ -455,6 +455,8 @@ void omap_sram_idle(void) | |||
455 | } | 455 | } |
456 | omap3_intc_resume_idle(); | 456 | omap3_intc_resume_idle(); |
457 | 457 | ||
458 | pwrdm_post_transition(); | ||
459 | |||
458 | /* PER */ | 460 | /* PER */ |
459 | if (per_next_state < PWRDM_POWER_ON) { | 461 | if (per_next_state < PWRDM_POWER_ON) { |
460 | per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); | 462 | per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); |
@@ -475,11 +477,10 @@ console_still_active: | |||
475 | core_next_state < PWRDM_POWER_ON)) { | 477 | core_next_state < PWRDM_POWER_ON)) { |
476 | omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, | 478 | omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, |
477 | PM_WKEN); | 479 | PM_WKEN); |
478 | omap3_disable_io_chain(); | 480 | if (omap3_has_io_chain_ctrl()) |
481 | omap3_disable_io_chain(); | ||
479 | } | 482 | } |
480 | 483 | ||
481 | pwrdm_post_transition(); | ||
482 | |||
483 | clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]); | 484 | clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]); |
484 | } | 485 | } |
485 | 486 | ||
@@ -870,6 +871,9 @@ static int __init omap3_pm_init(void) | |||
870 | if (!cpu_is_omap34xx()) | 871 | if (!cpu_is_omap34xx()) |
871 | return -ENODEV; | 872 | return -ENODEV; |
872 | 873 | ||
874 | if (!omap3_has_io_chain_ctrl()) | ||
875 | pr_warning("PM: no software I/O chain control; some wakeups may be lost\n"); | ||
876 | |||
873 | pm_errata_configure(); | 877 | pm_errata_configure(); |
874 | 878 | ||
875 | /* XXX prcm_setup_regs needs to be before enabling hw | 879 | /* XXX prcm_setup_regs needs to be before enabling hw |
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h index 2f9026942229..408a12f79205 100644 --- a/arch/arm/plat-omap/include/plat/cpu.h +++ b/arch/arm/plat-omap/include/plat/cpu.h | |||
@@ -399,6 +399,13 @@ void omap2_check_revision(void); | |||
399 | 399 | ||
400 | /* | 400 | /* |
401 | * Runtime detection of OMAP3 features | 401 | * Runtime detection of OMAP3 features |
402 | * | ||
403 | * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip | ||
404 | * family have OS-level control over the I/O chain clock. This is | ||
405 | * to avoid a window during which wakeups could potentially be lost | ||
406 | * during powerdomain transitions. If this bit is set, it | ||
407 | * indicates that the chip does support OS-level control of this | ||
408 | * feature. | ||
402 | */ | 409 | */ |
403 | extern u32 omap_features; | 410 | extern u32 omap_features; |
404 | 411 | ||
@@ -410,9 +417,10 @@ extern u32 omap_features; | |||
410 | #define OMAP3_HAS_192MHZ_CLK BIT(5) | 417 | #define OMAP3_HAS_192MHZ_CLK BIT(5) |
411 | #define OMAP3_HAS_IO_WAKEUP BIT(6) | 418 | #define OMAP3_HAS_IO_WAKEUP BIT(6) |
412 | #define OMAP3_HAS_SDRC BIT(7) | 419 | #define OMAP3_HAS_SDRC BIT(7) |
413 | #define OMAP4_HAS_MPU_1GHZ BIT(8) | 420 | #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8) |
414 | #define OMAP4_HAS_MPU_1_2GHZ BIT(9) | 421 | #define OMAP4_HAS_MPU_1GHZ BIT(9) |
415 | #define OMAP4_HAS_MPU_1_5GHZ BIT(10) | 422 | #define OMAP4_HAS_MPU_1_2GHZ BIT(10) |
423 | #define OMAP4_HAS_MPU_1_5GHZ BIT(11) | ||
416 | 424 | ||
417 | 425 | ||
418 | #define OMAP3_HAS_FEATURE(feat,flag) \ | 426 | #define OMAP3_HAS_FEATURE(feat,flag) \ |
@@ -429,12 +437,11 @@ OMAP3_HAS_FEATURE(isp, ISP) | |||
429 | OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) | 437 | OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) |
430 | OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) | 438 | OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) |
431 | OMAP3_HAS_FEATURE(sdrc, SDRC) | 439 | OMAP3_HAS_FEATURE(sdrc, SDRC) |
440 | OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL) | ||
432 | 441 | ||
433 | /* | 442 | /* |
434 | * Runtime detection of OMAP4 features | 443 | * Runtime detection of OMAP4 features |
435 | */ | 444 | */ |
436 | extern u32 omap_features; | ||
437 | |||
438 | #define OMAP4_HAS_FEATURE(feat, flag) \ | 445 | #define OMAP4_HAS_FEATURE(feat, flag) \ |
439 | static inline unsigned int omap4_has_ ##feat(void) \ | 446 | static inline unsigned int omap4_has_ ##feat(void) \ |
440 | { \ | 447 | { \ |