diff options
Diffstat (limited to 'arch/arm/mach-omap2/pm34xx.c')
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 310c189efb5d..3f1f656348fc 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -44,6 +44,13 @@ | |||
44 | 44 | ||
45 | #include "prm.h" | 45 | #include "prm.h" |
46 | #include "pm.h" | 46 | #include "pm.h" |
47 | #include "sdrc.h" | ||
48 | |||
49 | #define SDRC_POWER_AUTOCOUNT_SHIFT 8 | ||
50 | #define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT) | ||
51 | #define SDRC_POWER_CLKCTRL_SHIFT 4 | ||
52 | #define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT) | ||
53 | #define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT) | ||
47 | 54 | ||
48 | /* Scratchpad offsets */ | 55 | /* Scratchpad offsets */ |
49 | #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31 | 56 | #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31 |
@@ -297,6 +304,7 @@ static void omap_sram_idle(void) | |||
297 | int per_next_state = PWRDM_POWER_ON; | 304 | int per_next_state = PWRDM_POWER_ON; |
298 | int core_next_state = PWRDM_POWER_ON; | 305 | int core_next_state = PWRDM_POWER_ON; |
299 | int core_prev_state, per_prev_state; | 306 | int core_prev_state, per_prev_state; |
307 | u32 sdrc_pwr = 0; | ||
300 | 308 | ||
301 | if (!_omap_sram_idle) | 309 | if (!_omap_sram_idle) |
302 | return; | 310 | return; |
@@ -349,6 +357,21 @@ static void omap_sram_idle(void) | |||
349 | } | 357 | } |
350 | 358 | ||
351 | /* | 359 | /* |
360 | * Force SDRAM controller to self-refresh mode after timeout on | ||
361 | * autocount. This is needed on ES3.0 to avoid SDRAM controller | ||
362 | * hang-ups. | ||
363 | */ | ||
364 | if (omap_rev() >= OMAP3430_REV_ES3_0 && | ||
365 | omap_type() != OMAP2_DEVICE_TYPE_GP && | ||
366 | core_next_state == PWRDM_POWER_OFF) { | ||
367 | sdrc_pwr = sdrc_read_reg(SDRC_POWER); | ||
368 | sdrc_write_reg((sdrc_pwr & | ||
369 | ~(SDRC_POWER_AUTOCOUNT_MASK|SDRC_POWER_CLKCTRL_MASK)) | | ||
370 | (1 << SDRC_POWER_AUTOCOUNT_SHIFT) | | ||
371 | SDRC_SELF_REFRESH_ON_AUTOCOUNT, SDRC_POWER); | ||
372 | } | ||
373 | |||
374 | /* | ||
352 | * omap3_arm_context is the location where ARM registers | 375 | * omap3_arm_context is the location where ARM registers |
353 | * get saved. The restore path then reads from this | 376 | * get saved. The restore path then reads from this |
354 | * location and restores them back. | 377 | * location and restores them back. |
@@ -356,6 +379,12 @@ static void omap_sram_idle(void) | |||
356 | _omap_sram_idle(omap3_arm_context, save_state); | 379 | _omap_sram_idle(omap3_arm_context, save_state); |
357 | cpu_init(); | 380 | cpu_init(); |
358 | 381 | ||
382 | /* Restore normal SDRAM settings */ | ||
383 | if (omap_rev() >= OMAP3430_REV_ES3_0 && | ||
384 | omap_type() != OMAP2_DEVICE_TYPE_GP && | ||
385 | core_next_state == PWRDM_POWER_OFF) | ||
386 | sdrc_write_reg(sdrc_pwr, SDRC_POWER); | ||
387 | |||
359 | /* Restore table entry modified during MMU restoration */ | 388 | /* Restore table entry modified during MMU restoration */ |
360 | if (pwrdm_read_prev_pwrst(mpu_pwrdm) == PWRDM_POWER_OFF) | 389 | if (pwrdm_read_prev_pwrst(mpu_pwrdm) == PWRDM_POWER_OFF) |
361 | restore_table_entry(); | 390 | restore_table_entry(); |