diff options
author | Tero Kristo <tero.kristo@nokia.com> | 2008-10-13 06:17:06 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-11-11 17:42:25 -0500 |
commit | 13a6fe0f6adf62bf73be055322197507761d160a (patch) | |
tree | ee29ff33f79750c4caf6b4210a50fd4c09b612f7 /arch | |
parent | 9d97140bd0c5da55f174a81dafd2bbef135f5748 (diff) |
OMAP3: PM: Enable SDRAM auto-refresh during sleep
Fix for ES3.0 bug: SDRC not sending auto-refresh when OMAP wakes-up
from OFF mode (warning for HS devices.)
Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch')
-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(); |