diff options
author | Tero Kristo <tero.kristo@nokia.com> | 2008-10-13 06:15:00 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-11-11 17:42:25 -0500 |
commit | 27d59a4a2def42307349079f2e3538d96934c379 (patch) | |
tree | d581f0960d280dbe0f8c8ee03e111cadbfcf59db /arch/arm/mach-omap2/sleep34xx.S | |
parent | f2d1185824fd3ed631f3164daeff59d0b4e55d79 (diff) |
OMAP3 PM: off-mode support for HS/EMU devices
For HS/EMU devices, some additional resources need to be
saved/restored for off-mode support. Namely, saving the secure RAM
and a pointer to it in the scratchpad.
Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2/sleep34xx.S')
-rw-r--r-- | arch/arm/mach-omap2/sleep34xx.S | 75 |
1 files changed, 74 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index f8d3834bf681..db75167bc52d 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S | |||
@@ -37,6 +37,8 @@ | |||
37 | #define PM_PREPWSTST_MPU_V OMAP34XX_PRM_REGADDR(MPU_MOD, \ | 37 | #define PM_PREPWSTST_MPU_V OMAP34XX_PRM_REGADDR(MPU_MOD, \ |
38 | OMAP3430_PM_PREPWSTST) | 38 | OMAP3430_PM_PREPWSTST) |
39 | #define PM_PWSTCTRL_MPU_P OMAP3430_PRM_BASE + MPU_MOD + PM_PWSTCTRL | 39 | #define PM_PWSTCTRL_MPU_P OMAP3430_PRM_BASE + MPU_MOD + PM_PWSTCTRL |
40 | #define SRAM_BASE_P 0x40200000 | ||
41 | #define CONTROL_STAT 0x480022F0 | ||
40 | #define SCRATCHPAD_MEM_OFFS 0x310 /* Move this as correct place is | 42 | #define SCRATCHPAD_MEM_OFFS 0x310 /* Move this as correct place is |
41 | * available */ | 43 | * available */ |
42 | #define SCRATCHPAD_BASE_P (OMAP343X_CTRL_BASE + OMAP343X_CONTROL_MEM_WKUP\ | 44 | #define SCRATCHPAD_BASE_P (OMAP343X_CTRL_BASE + OMAP343X_CONTROL_MEM_WKUP\ |
@@ -51,6 +53,40 @@ ENTRY(get_restore_pointer) | |||
51 | ldmfd sp!, {pc} @ restore regs and return | 53 | ldmfd sp!, {pc} @ restore regs and return |
52 | ENTRY(get_restore_pointer_sz) | 54 | ENTRY(get_restore_pointer_sz) |
53 | .word . - get_restore_pointer_sz | 55 | .word . - get_restore_pointer_sz |
56 | |||
57 | /* Function to call rom code to save secure ram context */ | ||
58 | ENTRY(save_secure_ram_context) | ||
59 | stmfd sp!, {r1-r12, lr} @ save registers on stack | ||
60 | save_secure_ram_debug: | ||
61 | /* b save_secure_ram_debug */ @ enable to debug save code | ||
62 | adr r3, api_params @ r3 points to parameters | ||
63 | str r0, [r3,#0x4] @ r0 has sdram address | ||
64 | ldr r12, high_mask | ||
65 | and r3, r3, r12 | ||
66 | ldr r12, sram_phy_addr_mask | ||
67 | orr r3, r3, r12 | ||
68 | mov r0, #25 @ set service ID for PPA | ||
69 | mov r12, r0 @ copy secure service ID in r12 | ||
70 | mov r1, #0 @ set task id for ROM code in r1 | ||
71 | mov r2, #7 @ set some flags in r2, r6 | ||
72 | mov r6, #0xff | ||
73 | mcr p15, 0, r0, c7, c10, 4 @ data write barrier | ||
74 | mcr p15, 0, r0, c7, c10, 5 @ data memory barrier | ||
75 | .word 0xE1600071 @ call SMI monitor (smi #1) | ||
76 | nop | ||
77 | nop | ||
78 | nop | ||
79 | nop | ||
80 | ldmfd sp!, {r1-r12, pc} | ||
81 | sram_phy_addr_mask: | ||
82 | .word SRAM_BASE_P | ||
83 | high_mask: | ||
84 | .word 0xffff | ||
85 | api_params: | ||
86 | .word 0x4, 0x0, 0x0, 0x1, 0x1 | ||
87 | ENTRY(save_secure_ram_context_sz) | ||
88 | .word . - save_secure_ram_context | ||
89 | |||
54 | /* | 90 | /* |
55 | * Forces OMAP into idle state | 91 | * Forces OMAP into idle state |
56 | * | 92 | * |
@@ -107,9 +143,44 @@ restore: | |||
107 | moveq r9, #0x3 @ MPU OFF => L1 and L2 lost | 143 | moveq r9, #0x3 @ MPU OFF => L1 and L2 lost |
108 | movne r9, #0x1 @ Only L1 and L2 lost => avoid L2 invalidation | 144 | movne r9, #0x1 @ Only L1 and L2 lost => avoid L2 invalidation |
109 | bne logic_l1_restore | 145 | bne logic_l1_restore |
146 | ldr r0, control_stat | ||
147 | ldr r1, [r0] | ||
148 | and r1, #0x700 | ||
149 | cmp r1, #0x300 | ||
150 | beq l2_inv_gp | ||
151 | mov r0, #40 @ set service ID for PPA | ||
152 | mov r12, r0 @ copy secure Service ID in r12 | ||
153 | mov r1, #0 @ set task id for ROM code in r1 | ||
154 | mov r2, #4 @ set some flags in r2, r6 | ||
155 | mov r6, #0xff | ||
156 | adr r3, l2_inv_api_params @ r3 points to dummy parameters | ||
157 | mcr p15, 0, r0, c7, c10, 4 @ data write barrier | ||
158 | mcr p15, 0, r0, c7, c10, 5 @ data memory barrier | ||
159 | .word 0xE1600071 @ call SMI monitor (smi #1) | ||
160 | /* Write to Aux control register to set some bits */ | ||
161 | mov r0, #42 @ set service ID for PPA | ||
162 | mov r12, r0 @ copy secure Service ID in r12 | ||
163 | mov r1, #0 @ set task id for ROM code in r1 | ||
164 | mov r2, #4 @ set some flags in r2, r6 | ||
165 | mov r6, #0xff | ||
166 | adr r3, write_aux_control_params @ r3 points to parameters | ||
167 | mcr p15, 0, r0, c7, c10, 4 @ data write barrier | ||
168 | mcr p15, 0, r0, c7, c10, 5 @ data memory barrier | ||
169 | .word 0xE1600071 @ call SMI monitor (smi #1) | ||
170 | |||
171 | b logic_l1_restore | ||
172 | l2_inv_api_params: | ||
173 | .word 0x1, 0x00 | ||
174 | write_aux_control_params: | ||
175 | .word 0x1, 0x72 | ||
176 | l2_inv_gp: | ||
110 | /* Execute smi to invalidate L2 cache */ | 177 | /* Execute smi to invalidate L2 cache */ |
111 | mov r12, #0x1 @ set up to invalide L2 | 178 | mov r12, #0x1 @ set up to invalide L2 |
112 | smi: .word 0xE1600070 @ Call SMI monitor (smieq) | 179 | smi: .word 0xE1600070 @ Call SMI monitor (smieq) |
180 | /* Write to Aux control register to set some bits */ | ||
181 | mov r0, #0x72 | ||
182 | mov r12, #0x3 | ||
183 | .word 0xE1600070 @ Call SMI monitor (smieq) | ||
113 | logic_l1_restore: | 184 | logic_l1_restore: |
114 | mov r1, #0 | 185 | mov r1, #0 |
115 | /* Invalidate all instruction caches to PoU | 186 | /* Invalidate all instruction caches to PoU |
@@ -429,5 +500,7 @@ table_entry: | |||
429 | .word 0x00000C02 | 500 | .word 0x00000C02 |
430 | cache_pred_disable_mask: | 501 | cache_pred_disable_mask: |
431 | .word 0xFFFFE7FB | 502 | .word 0xFFFFE7FB |
503 | control_stat: | ||
504 | .word CONTROL_STAT | ||
432 | ENTRY(omap34xx_cpu_suspend_sz) | 505 | ENTRY(omap34xx_cpu_suspend_sz) |
433 | .word . - omap34xx_cpu_suspend | 506 | .word . - omap34xx_cpu_suspend |