aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTero Kristo <tero.kristo@nokia.com>2008-10-13 10:58:50 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-11 17:42:27 -0500
commit0795a75a369b931150074a14473f024359b7f25c (patch)
tree789448b6e79df2ed2a0fc2742a3505b06cd3f6d3
parent692ec4abb96174c0e4b3aef6d2b71f36a4a14c8b (diff)
OMAP3: PM: SDRC auto-refresh workaround for off-mode
Errata: ES3.0, ES3.1 SDRC not sending auto-refresh when OMAP wakes-up from OFF mode Signed-off-by: Tero Kristo <tero.kristo@nokia.com> Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@digia.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r--arch/arm/mach-omap2/control.c9
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S84
-rw-r--r--arch/arm/plat-omap/include/plat/control.h1
3 files changed, 91 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index c41565ec16e3..2ff8d7cc60a2 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -209,8 +209,13 @@ void omap3_save_scratchpad_contents(void)
209 209
210 /* Populate the Scratchpad contents */ 210 /* Populate the Scratchpad contents */
211 scratchpad_contents.boot_config_ptr = 0x0; 211 scratchpad_contents.boot_config_ptr = 0x0;
212 scratchpad_contents.public_restore_ptr = 212 if (omap_rev() != OMAP3430_REV_ES3_0 &&
213 virt_to_phys(get_restore_pointer()); 213 omap_rev() != OMAP3430_REV_ES3_1)
214 scratchpad_contents.public_restore_ptr =
215 virt_to_phys(get_restore_pointer());
216 else
217 scratchpad_contents.public_restore_ptr =
218 virt_to_phys(get_es3_restore_pointer());
214 if (omap_type() == OMAP2_DEVICE_TYPE_GP) 219 if (omap_type() == OMAP2_DEVICE_TYPE_GP)
215 scratchpad_contents.secure_ram_restore_ptr = 0x0; 220 scratchpad_contents.secure_ram_restore_ptr = 0x0;
216 else 221 else
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index b6abadccb1c6..dedfa0e6c639 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -34,6 +34,7 @@
34 34
35#define PM_PREPWSTST_CORE_V OMAP34XX_PRM_REGADDR(CORE_MOD, \ 35#define PM_PREPWSTST_CORE_V OMAP34XX_PRM_REGADDR(CORE_MOD, \
36 OMAP3430_PM_PREPWSTST) 36 OMAP3430_PM_PREPWSTST)
37#define PM_PREPWSTST_CORE_P 0x48306AE8
37#define PM_PREPWSTST_MPU_V OMAP34XX_PRM_REGADDR(MPU_MOD, \ 38#define PM_PREPWSTST_MPU_V OMAP34XX_PRM_REGADDR(MPU_MOD, \
38 OMAP3430_PM_PREPWSTST) 39 OMAP3430_PM_PREPWSTST)
39#define PM_PWSTCTRL_MPU_P OMAP3430_PRM_BASE + MPU_MOD + PM_PWSTCTRL 40#define PM_PWSTCTRL_MPU_P OMAP3430_PRM_BASE + MPU_MOD + PM_PWSTCTRL
@@ -44,6 +45,13 @@
44#define SCRATCHPAD_BASE_P (OMAP343X_CTRL_BASE + OMAP343X_CONTROL_MEM_WKUP\ 45#define SCRATCHPAD_BASE_P (OMAP343X_CTRL_BASE + OMAP343X_CONTROL_MEM_WKUP\
45 + SCRATCHPAD_MEM_OFFS) 46 + SCRATCHPAD_MEM_OFFS)
46#define SDRC_POWER_V OMAP34XX_SDRC_REGADDR(SDRC_POWER) 47#define SDRC_POWER_V OMAP34XX_SDRC_REGADDR(SDRC_POWER)
48#define SDRC_SYSCONFIG_P (OMAP343X_SDRC_BASE + SDRC_SYSCONFIG)
49#define SDRC_MR_0_P (OMAP343X_SDRC_BASE + SDRC_MR_0)
50#define SDRC_EMR2_0_P (OMAP343X_SDRC_BASE + SDRC_EMR2_0)
51#define SDRC_MANUAL_0_P (OMAP343X_SDRC_BASE + SDRC_MANUAL_0)
52#define SDRC_MR_1_P (OMAP343X_SDRC_BASE + SDRC_MR_1)
53#define SDRC_EMR2_1_P (OMAP343X_SDRC_BASE + SDRC_EMR2_1)
54#define SDRC_MANUAL_1_P (OMAP343X_SDRC_BASE + SDRC_MANUAL_1)
47 55
48 .text 56 .text
49/* Function call to get the restore pointer for resume from OFF */ 57/* Function call to get the restore pointer for resume from OFF */
@@ -52,7 +60,59 @@ ENTRY(get_restore_pointer)
52 adr r0, restore 60 adr r0, restore
53 ldmfd sp!, {pc} @ restore regs and return 61 ldmfd sp!, {pc} @ restore regs and return
54ENTRY(get_restore_pointer_sz) 62ENTRY(get_restore_pointer_sz)
55 .word . - get_restore_pointer_sz 63 .word . - get_restore_pointer
64
65 .text
66/* Function call to get the restore pointer for for ES3 to resume from OFF */
67ENTRY(get_es3_restore_pointer)
68 stmfd sp!, {lr} @ save registers on stack
69 adr r0, restore_es3
70 ldmfd sp!, {pc} @ restore regs and return
71ENTRY(get_es3_restore_pointer_sz)
72 .word . - get_es3_restore_pointer
73
74ENTRY(es3_sdrc_fix)
75 ldr r4, sdrc_syscfg @ get config addr
76 ldr r5, [r4] @ get value
77 tst r5, #0x100 @ is part access blocked
78 it eq
79 biceq r5, r5, #0x100 @ clear bit if set
80 str r5, [r4] @ write back change
81 ldr r4, sdrc_mr_0 @ get config addr
82 ldr r5, [r4] @ get value
83 str r5, [r4] @ write back change
84 ldr r4, sdrc_emr2_0 @ get config addr
85 ldr r5, [r4] @ get value
86 str r5, [r4] @ write back change
87 ldr r4, sdrc_manual_0 @ get config addr
88 mov r5, #0x2 @ autorefresh command
89 str r5, [r4] @ kick off refreshes
90 ldr r4, sdrc_mr_1 @ get config addr
91 ldr r5, [r4] @ get value
92 str r5, [r4] @ write back change
93 ldr r4, sdrc_emr2_1 @ get config addr
94 ldr r5, [r4] @ get value
95 str r5, [r4] @ write back change
96 ldr r4, sdrc_manual_1 @ get config addr
97 mov r5, #0x2 @ autorefresh command
98 str r5, [r4] @ kick off refreshes
99 bx lr
100sdrc_syscfg:
101 .word SDRC_SYSCONFIG_P
102sdrc_mr_0:
103 .word SDRC_MR_0_P
104sdrc_emr2_0:
105 .word SDRC_EMR2_0_P
106sdrc_manual_0:
107 .word SDRC_MANUAL_0_P
108sdrc_mr_1:
109 .word SDRC_MR_1_P
110sdrc_emr2_1:
111 .word SDRC_EMR2_1_P
112sdrc_manual_1:
113 .word SDRC_MANUAL_1_P
114ENTRY(es3_sdrc_fix_sz)
115 .word . - es3_sdrc_fix
56 116
57/* Function to call rom code to save secure ram context */ 117/* Function to call rom code to save secure ram context */
58ENTRY(save_secure_ram_context) 118ENTRY(save_secure_ram_context)
@@ -130,6 +190,24 @@ loop:
130 bl i_dll_wait 190 bl i_dll_wait
131 191
132 ldmfd sp!, {r0-r12, pc} @ restore regs and return 192 ldmfd sp!, {r0-r12, pc} @ restore regs and return
193restore_es3:
194 /*b restore_es3*/ @ Enable to debug restore code
195 ldr r5, pm_prepwstst_core_p
196 ldr r4, [r5]
197 and r4, r4, #0x3
198 cmp r4, #0x0 @ Check if previous power state of CORE is OFF
199 bne restore
200 adr r0, es3_sdrc_fix
201 ldr r1, sram_base
202 ldr r2, es3_sdrc_fix_sz
203 mov r2, r2, ror #2
204copy_to_sram:
205 ldmia r0!, {r3} @ val = *src
206 stmia r1!, {r3} @ *dst = val
207 subs r2, r2, #0x1 @ num_words--
208 bne copy_to_sram
209 ldr r1, sram_base
210 blx r1
133restore: 211restore:
134 /* b restore*/ @ Enable to debug restore code 212 /* b restore*/ @ Enable to debug restore code
135 /* Check what was the reason for mpu reset and store the reason in r9*/ 213 /* Check what was the reason for mpu reset and store the reason in r9*/
@@ -478,12 +556,16 @@ i_dll_delay:
478 bx lr 556 bx lr
479pm_prepwstst_core: 557pm_prepwstst_core:
480 .word PM_PREPWSTST_CORE_V 558 .word PM_PREPWSTST_CORE_V
559pm_prepwstst_core_p:
560 .word PM_PREPWSTST_CORE_P
481pm_prepwstst_mpu: 561pm_prepwstst_mpu:
482 .word PM_PREPWSTST_MPU_V 562 .word PM_PREPWSTST_MPU_V
483pm_pwstctrl_mpu: 563pm_pwstctrl_mpu:
484 .word PM_PWSTCTRL_MPU_P 564 .word PM_PWSTCTRL_MPU_P
485scratchpad_base: 565scratchpad_base:
486 .word SCRATCHPAD_BASE_P 566 .word SCRATCHPAD_BASE_P
567sram_base:
568 .word SRAM_BASE_P + 0x8000
487sdrc_power: 569sdrc_power:
488 .word SDRC_POWER_V 570 .word SDRC_POWER_V
489clk_stabilize_delay: 571clk_stabilize_delay:
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/plat-omap/include/plat/control.h
index 8ca73471ba45..8237cb9e74fd 100644
--- a/arch/arm/plat-omap/include/plat/control.h
+++ b/arch/arm/plat-omap/include/plat/control.h
@@ -268,6 +268,7 @@ extern void omap_ctrl_writel(u32 val, u16 offset);
268extern void omap3_save_scratchpad_contents(void); 268extern void omap3_save_scratchpad_contents(void);
269extern void omap3_clear_scratchpad_contents(void); 269extern void omap3_clear_scratchpad_contents(void);
270extern u32 *get_restore_pointer(void); 270extern u32 *get_restore_pointer(void);
271extern u32 *get_es3_restore_pointer(void);
271extern u32 omap3_arm_context[128]; 272extern u32 omap3_arm_context[128];
272extern void omap3_control_save_context(void); 273extern void omap3_control_save_context(void);
273extern void omap3_control_restore_context(void); 274extern void omap3_control_restore_context(void);