diff options
author | Santosh Shilimkar <santosh.shilimkar@ti.com> | 2011-01-08 16:29:09 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-12-08 14:29:01 -0500 |
commit | 5e94c6e33e7c4726ef09f46c267e9ca232c5148a (patch) | |
tree | ea13686167925b0a3f9e67ae02817cbb6986e0fc /arch/arm/mach-omap2/sleep44xx.S | |
parent | 0f3cf2ec81aeb4747624954bae2cc8decc48e12f (diff) |
ARM: OMAP4: PM: Add L2X0 cache lowpower support
When MPUSS hits off-mode, L2 cache is lost. This patch adds L2X0
necessary maintenance operations and context restoration in the
low power code.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Jean Pihet <j-pihet@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-by: Vishwanath BS <vishwanath.bs@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/sleep44xx.S')
-rw-r--r-- | arch/arm/mach-omap2/sleep44xx.S | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S index e5521945ba8e..3154b63def35 100644 --- a/arch/arm/mach-omap2/sleep44xx.S +++ b/arch/arm/mach-omap2/sleep44xx.S | |||
@@ -32,6 +32,9 @@ | |||
32 | ppa_zero_params: | 32 | ppa_zero_params: |
33 | .word 0x0 | 33 | .word 0x0 |
34 | 34 | ||
35 | ppa_por_params: | ||
36 | .word 1, 0 | ||
37 | |||
35 | /* | 38 | /* |
36 | * ============================= | 39 | * ============================= |
37 | * == CPU suspend finisher == | 40 | * == CPU suspend finisher == |
@@ -132,6 +135,54 @@ skip_scu_gp_set: | |||
132 | mcrne p15, 0, r0, c1, c0, 1 | 135 | mcrne p15, 0, r0, c1, c0, 1 |
133 | isb | 136 | isb |
134 | dsb | 137 | dsb |
138 | #ifdef CONFIG_CACHE_L2X0 | ||
139 | /* | ||
140 | * Clean and invalidate the L2 cache. | ||
141 | * Common cache-l2x0.c functions can't be used here since it | ||
142 | * uses spinlocks. We are out of coherency here with data cache | ||
143 | * disabled. The spinlock implementation uses exclusive load/store | ||
144 | * instruction which can fail without data cache being enabled. | ||
145 | * OMAP4 hardware doesn't support exclusive monitor which can | ||
146 | * overcome exclusive access issue. Because of this, CPU can | ||
147 | * lead to deadlock. | ||
148 | */ | ||
149 | bl omap4_get_sar_ram_base | ||
150 | mov r8, r0 | ||
151 | mrc p15, 0, r5, c0, c0, 5 @ Read MPIDR | ||
152 | ands r5, r5, #0x0f | ||
153 | ldreq r0, [r8, #L2X0_SAVE_OFFSET0] @ Retrieve L2 state from SAR | ||
154 | ldrne r0, [r8, #L2X0_SAVE_OFFSET1] @ memory. | ||
155 | cmp r0, #3 | ||
156 | bne do_WFI | ||
157 | #ifdef CONFIG_PL310_ERRATA_727915 | ||
158 | mov r0, #0x03 | ||
159 | mov r12, #OMAP4_MON_L2X0_DBG_CTRL_INDEX | ||
160 | DO_SMC | ||
161 | #endif | ||
162 | bl omap4_get_l2cache_base | ||
163 | mov r2, r0 | ||
164 | ldr r0, =0xffff | ||
165 | str r0, [r2, #L2X0_CLEAN_INV_WAY] | ||
166 | wait: | ||
167 | ldr r0, [r2, #L2X0_CLEAN_INV_WAY] | ||
168 | ldr r1, =0xffff | ||
169 | ands r0, r0, r1 | ||
170 | bne wait | ||
171 | #ifdef CONFIG_PL310_ERRATA_727915 | ||
172 | mov r0, #0x00 | ||
173 | mov r12, #OMAP4_MON_L2X0_DBG_CTRL_INDEX | ||
174 | DO_SMC | ||
175 | #endif | ||
176 | l2x_sync: | ||
177 | bl omap4_get_l2cache_base | ||
178 | mov r2, r0 | ||
179 | mov r0, #0x0 | ||
180 | str r0, [r2, #L2X0_CACHE_SYNC] | ||
181 | sync: | ||
182 | ldr r0, [r2, #L2X0_CACHE_SYNC] | ||
183 | ands r0, r0, #0x1 | ||
184 | bne sync | ||
185 | #endif | ||
135 | 186 | ||
136 | do_WFI: | 187 | do_WFI: |
137 | bl omap_do_wfi | 188 | bl omap_do_wfi |
@@ -225,6 +276,50 @@ enable_smp_bit: | |||
225 | mcreq p15, 0, r0, c1, c0, 1 | 276 | mcreq p15, 0, r0, c1, c0, 1 |
226 | isb | 277 | isb |
227 | skip_ns_smp_enable: | 278 | skip_ns_smp_enable: |
279 | #ifdef CONFIG_CACHE_L2X0 | ||
280 | /* | ||
281 | * Restore the L2 AUXCTRL and enable the L2 cache. | ||
282 | * OMAP4_MON_L2X0_AUXCTRL_INDEX = Program the L2X0 AUXCTRL | ||
283 | * OMAP4_MON_L2X0_CTRL_INDEX = Enable the L2 using L2X0 CTRL | ||
284 | * register r0 contains value to be programmed. | ||
285 | * L2 cache is already invalidate by ROM code as part | ||
286 | * of MPUSS OFF wakeup path. | ||
287 | */ | ||
288 | ldr r2, =OMAP44XX_L2CACHE_BASE | ||
289 | ldr r0, [r2, #L2X0_CTRL] | ||
290 | and r0, #0x0f | ||
291 | cmp r0, #1 | ||
292 | beq skip_l2en @ Skip if already enabled | ||
293 | ldr r3, =OMAP44XX_SAR_RAM_BASE | ||
294 | ldr r1, [r3, #OMAP_TYPE_OFFSET] | ||
295 | cmp r1, #0x1 @ Check for HS device | ||
296 | bne set_gp_por | ||
297 | ldr r0, =OMAP4_PPA_L2_POR_INDEX | ||
298 | ldr r1, =OMAP44XX_SAR_RAM_BASE | ||
299 | ldr r4, [r1, #L2X0_PREFETCH_CTRL_OFFSET] | ||
300 | adr r3, ppa_por_params | ||
301 | str r4, [r3, #0x04] | ||
302 | mov r1, #0x0 @ Process ID | ||
303 | mov r2, #0x4 @ Flag | ||
304 | mov r6, #0xff | ||
305 | mov r12, #0x00 @ Secure Service ID | ||
306 | DO_SMC | ||
307 | b set_aux_ctrl | ||
308 | set_gp_por: | ||
309 | ldr r1, =OMAP44XX_SAR_RAM_BASE | ||
310 | ldr r0, [r1, #L2X0_PREFETCH_CTRL_OFFSET] | ||
311 | ldr r12, =OMAP4_MON_L2X0_PREFETCH_INDEX @ Setup L2 PREFETCH | ||
312 | DO_SMC | ||
313 | set_aux_ctrl: | ||
314 | ldr r1, =OMAP44XX_SAR_RAM_BASE | ||
315 | ldr r0, [r1, #L2X0_AUXCTRL_OFFSET] | ||
316 | ldr r12, =OMAP4_MON_L2X0_AUXCTRL_INDEX @ Setup L2 AUXCTRL | ||
317 | DO_SMC | ||
318 | mov r0, #0x1 | ||
319 | ldr r12, =OMAP4_MON_L2X0_CTRL_INDEX @ Enable L2 cache | ||
320 | DO_SMC | ||
321 | skip_l2en: | ||
322 | #endif | ||
228 | 323 | ||
229 | b cpu_resume @ Jump to generic resume | 324 | b cpu_resume @ Jump to generic resume |
230 | ENDPROC(omap4_cpu_resume) | 325 | ENDPROC(omap4_cpu_resume) |