aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRajendra Nayak <rnayak@ti.com>2009-06-09 13:00:41 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-11 17:42:28 -0500
commitf265dc4c5d39f2bd369d97c87a7bd89061b159d4 (patch)
treedb16053ad7010c141a054ab0c8b5c243c311962f /arch/arm
parent3a7ec26bb44988051d97479f6dfcfd4942a99049 (diff)
OMAP3: PM: Program SDRC to send self refresh on timeout of AUTO_CNT
Due to an OMAP3 errata (1.142), on HS/EMU devices SDRC should be programed to issue automatic self refresh on timeout of AUTO_CNT = 1 prior to any transition to OFF mode. This is needed only on sil rev's ES3.0 and above. This patch enables the above needed WA in the SDRC power register value stored in scratchpad, so that ROM code restores this value in SDRC POWER on the wakeup path. The original SDRC POWER register value is stored and restored back in omap_sram_idle() function. This fixes some random crashes observed while stressing suspend on HS/EMU devices. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@digia.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/control.c16
-rw-r--r--arch/arm/mach-omap2/pm34xx.c24
-rw-r--r--arch/arm/plat-omap/include/plat/sdrc.h6
3 files changed, 28 insertions, 18 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 2ff8d7cc60a2..cdd1f35636dd 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -265,7 +265,21 @@ void omap3_save_scratchpad_contents(void)
265 (sdrc_read_reg(SDRC_ERR_TYPE) & 0xFFFF); 265 (sdrc_read_reg(SDRC_ERR_TYPE) & 0xFFFF);
266 sdrc_block_contents.dll_a_ctrl = sdrc_read_reg(SDRC_DLLA_CTRL); 266 sdrc_block_contents.dll_a_ctrl = sdrc_read_reg(SDRC_DLLA_CTRL);
267 sdrc_block_contents.dll_b_ctrl = 0x0; 267 sdrc_block_contents.dll_b_ctrl = 0x0;
268 sdrc_block_contents.power = sdrc_read_reg(SDRC_POWER); 268 /*
269 * Due to a OMAP3 errata (1.142), on EMU/HS devices SRDC should
270 * be programed to issue automatic self refresh on timeout
271 * of AUTO_CNT = 1 prior to any transition to OFF mode.
272 */
273 if ((omap_type() != OMAP2_DEVICE_TYPE_GP)
274 && (omap_rev() >= OMAP3430_REV_ES3_0))
275 sdrc_block_contents.power = (sdrc_read_reg(SDRC_POWER) &
276 ~(SDRC_POWER_AUTOCOUNT_MASK|
277 SDRC_POWER_CLKCTRL_MASK)) |
278 (1 << SDRC_POWER_AUTOCOUNT_SHIFT) |
279 SDRC_SELF_REFRESH_ON_AUTOCOUNT;
280 else
281 sdrc_block_contents.power = sdrc_read_reg(SDRC_POWER);
282
269 sdrc_block_contents.cs_0 = 0x0; 283 sdrc_block_contents.cs_0 = 0x0;
270 sdrc_block_contents.mcfg_0 = sdrc_read_reg(SDRC_MCFG_0); 284 sdrc_block_contents.mcfg_0 = sdrc_read_reg(SDRC_MCFG_0);
271 sdrc_block_contents.mr_0 = (sdrc_read_reg(SDRC_MR_0) & 0xFFFF); 285 sdrc_block_contents.mr_0 = (sdrc_read_reg(SDRC_MR_0) & 0xFFFF);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 511a57dc7015..01b95eaae75a 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -48,12 +48,6 @@
48#include "pm.h" 48#include "pm.h"
49#include "sdrc.h" 49#include "sdrc.h"
50 50
51#define SDRC_POWER_AUTOCOUNT_SHIFT 8
52#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
53#define SDRC_POWER_CLKCTRL_SHIFT 4
54#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
55#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
56
57/* Scratchpad offsets */ 51/* Scratchpad offsets */
58#define OMAP343X_TABLE_ADDRESS_OFFSET 0x31 52#define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
59#define OMAP343X_TABLE_VALUE_OFFSET 0x30 53#define OMAP343X_TABLE_VALUE_OFFSET 0x30
@@ -402,19 +396,15 @@ static void omap_sram_idle(void)
402 } 396 }
403 397
404 /* 398 /*
405 * Force SDRAM controller to self-refresh mode after timeout on 399 * On EMU/HS devices ROM code restores a SRDC value
406 * autocount. This is needed on ES3.0 to avoid SDRAM controller 400 * from scratchpad which has automatic self refresh on timeout
407 * hang-ups. 401 * of AUTO_CNT = 1 enabled. This takes care of errata 1.142.
408 */ 402 * Hence store/restore the SDRC_POWER register here.
403 */
409 if (omap_rev() >= OMAP3430_REV_ES3_0 && 404 if (omap_rev() >= OMAP3430_REV_ES3_0 &&
410 omap_type() != OMAP2_DEVICE_TYPE_GP && 405 omap_type() != OMAP2_DEVICE_TYPE_GP &&
411 core_next_state == PWRDM_POWER_OFF) { 406 core_next_state == PWRDM_POWER_OFF)
412 sdrc_pwr = sdrc_read_reg(SDRC_POWER); 407 sdrc_pwr = sdrc_read_reg(SDRC_POWER);
413 sdrc_write_reg((sdrc_pwr &
414 ~(SDRC_POWER_AUTOCOUNT_MASK|SDRC_POWER_CLKCTRL_MASK)) |
415 (1 << SDRC_POWER_AUTOCOUNT_SHIFT) |
416 SDRC_SELF_REFRESH_ON_AUTOCOUNT, SDRC_POWER);
417 }
418 408
419 /* 409 /*
420 * omap3_arm_context is the location where ARM registers 410 * omap3_arm_context is the location where ARM registers
@@ -424,7 +414,7 @@ static void omap_sram_idle(void)
424 _omap_sram_idle(omap3_arm_context, save_state); 414 _omap_sram_idle(omap3_arm_context, save_state);
425 cpu_init(); 415 cpu_init();
426 416
427 /* Restore normal SDRAM settings */ 417 /* Restore normal SDRC POWER settings */
428 if (omap_rev() >= OMAP3430_REV_ES3_0 && 418 if (omap_rev() >= OMAP3430_REV_ES3_0 &&
429 omap_type() != OMAP2_DEVICE_TYPE_GP && 419 omap_type() != OMAP2_DEVICE_TYPE_GP &&
430 core_next_state == PWRDM_POWER_OFF) 420 core_next_state == PWRDM_POWER_OFF)
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h
index 772b71e8b44f..f704030d2a70 100644
--- a/arch/arm/plat-omap/include/plat/sdrc.h
+++ b/arch/arm/plat-omap/include/plat/sdrc.h
@@ -44,6 +44,12 @@
44#define SDRC_RFR_CTRL_1 0x0D4 44#define SDRC_RFR_CTRL_1 0x0D4
45#define SDRC_MANUAL_1 0x0D8 45#define SDRC_MANUAL_1 0x0D8
46 46
47#define SDRC_POWER_AUTOCOUNT_SHIFT 8
48#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
49#define SDRC_POWER_CLKCTRL_SHIFT 4
50#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
51#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
52
47/* 53/*
48 * These values represent the number of memory clock cycles between 54 * These values represent the number of memory clock cycles between
49 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192 55 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192