diff options
author | Tero Kristo <tero.kristo@nokia.com> | 2008-10-13 10:58:50 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-11-11 17:42:27 -0500 |
commit | 0795a75a369b931150074a14473f024359b7f25c (patch) | |
tree | 789448b6e79df2ed2a0fc2742a3505b06cd3f6d3 | |
parent | 692ec4abb96174c0e4b3aef6d2b71f36a4a14c8b (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.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-omap2/sleep34xx.S | 84 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/control.h | 1 |
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 |
54 | ENTRY(get_restore_pointer_sz) | 62 | ENTRY(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 */ | ||
67 | ENTRY(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 | ||
71 | ENTRY(get_es3_restore_pointer_sz) | ||
72 | .word . - get_es3_restore_pointer | ||
73 | |||
74 | ENTRY(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 | ||
100 | sdrc_syscfg: | ||
101 | .word SDRC_SYSCONFIG_P | ||
102 | sdrc_mr_0: | ||
103 | .word SDRC_MR_0_P | ||
104 | sdrc_emr2_0: | ||
105 | .word SDRC_EMR2_0_P | ||
106 | sdrc_manual_0: | ||
107 | .word SDRC_MANUAL_0_P | ||
108 | sdrc_mr_1: | ||
109 | .word SDRC_MR_1_P | ||
110 | sdrc_emr2_1: | ||
111 | .word SDRC_EMR2_1_P | ||
112 | sdrc_manual_1: | ||
113 | .word SDRC_MANUAL_1_P | ||
114 | ENTRY(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 */ |
58 | ENTRY(save_secure_ram_context) | 118 | ENTRY(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 |
193 | restore_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 | ||
204 | copy_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 | ||
133 | restore: | 211 | restore: |
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 |
479 | pm_prepwstst_core: | 557 | pm_prepwstst_core: |
480 | .word PM_PREPWSTST_CORE_V | 558 | .word PM_PREPWSTST_CORE_V |
559 | pm_prepwstst_core_p: | ||
560 | .word PM_PREPWSTST_CORE_P | ||
481 | pm_prepwstst_mpu: | 561 | pm_prepwstst_mpu: |
482 | .word PM_PREPWSTST_MPU_V | 562 | .word PM_PREPWSTST_MPU_V |
483 | pm_pwstctrl_mpu: | 563 | pm_pwstctrl_mpu: |
484 | .word PM_PWSTCTRL_MPU_P | 564 | .word PM_PWSTCTRL_MPU_P |
485 | scratchpad_base: | 565 | scratchpad_base: |
486 | .word SCRATCHPAD_BASE_P | 566 | .word SCRATCHPAD_BASE_P |
567 | sram_base: | ||
568 | .word SRAM_BASE_P + 0x8000 | ||
487 | sdrc_power: | 569 | sdrc_power: |
488 | .word SDRC_POWER_V | 570 | .word SDRC_POWER_V |
489 | clk_stabilize_delay: | 571 | clk_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); | |||
268 | extern void omap3_save_scratchpad_contents(void); | 268 | extern void omap3_save_scratchpad_contents(void); |
269 | extern void omap3_clear_scratchpad_contents(void); | 269 | extern void omap3_clear_scratchpad_contents(void); |
270 | extern u32 *get_restore_pointer(void); | 270 | extern u32 *get_restore_pointer(void); |
271 | extern u32 *get_es3_restore_pointer(void); | ||
271 | extern u32 omap3_arm_context[128]; | 272 | extern u32 omap3_arm_context[128]; |
272 | extern void omap3_control_save_context(void); | 273 | extern void omap3_control_save_context(void); |
273 | extern void omap3_control_restore_context(void); | 274 | extern void omap3_control_restore_context(void); |