diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-02-06 10:48:39 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-02-22 12:11:23 -0500 |
commit | f6b0fa02e8b0708d17d631afce456524eadf87ff (patch) | |
tree | 900fcd2149a03ba229bb29e982d3d6a5f3d3fcfc /arch/arm/mm/proc-v7.S | |
parent | 753790e713d80b50b867fa1ed32ec0eb5e82ae8e (diff) |
ARM: pm: add generic CPU suspend/resume support
This adds core support for saving and restoring CPU coprocessor
registers for suspend/resume support. This contains support for suspend
with ARM920, ARM926, SA11x0, PXA25x, PXA27x, PXA3xx, V6 and V7 CPUs.
Tested on Assabet and Tegra 2.
Tested-by: Colin Cross <ccross@android.com>
Tested-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/proc-v7.S')
-rw-r--r-- | arch/arm/mm/proc-v7.S | 116 |
1 files changed, 86 insertions, 30 deletions
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 0c1172b56b4e..a5187ddfb267 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -171,6 +171,87 @@ cpu_v7_name: | |||
171 | .ascii "ARMv7 Processor" | 171 | .ascii "ARMv7 Processor" |
172 | .align | 172 | .align |
173 | 173 | ||
174 | /* | ||
175 | * Memory region attributes with SCTLR.TRE=1 | ||
176 | * | ||
177 | * n = TEX[0],C,B | ||
178 | * TR = PRRR[2n+1:2n] - memory type | ||
179 | * IR = NMRR[2n+1:2n] - inner cacheable property | ||
180 | * OR = NMRR[2n+17:2n+16] - outer cacheable property | ||
181 | * | ||
182 | * n TR IR OR | ||
183 | * UNCACHED 000 00 | ||
184 | * BUFFERABLE 001 10 00 00 | ||
185 | * WRITETHROUGH 010 10 10 10 | ||
186 | * WRITEBACK 011 10 11 11 | ||
187 | * reserved 110 | ||
188 | * WRITEALLOC 111 10 01 01 | ||
189 | * DEV_SHARED 100 01 | ||
190 | * DEV_NONSHARED 100 01 | ||
191 | * DEV_WC 001 10 | ||
192 | * DEV_CACHED 011 10 | ||
193 | * | ||
194 | * Other attributes: | ||
195 | * | ||
196 | * DS0 = PRRR[16] = 0 - device shareable property | ||
197 | * DS1 = PRRR[17] = 1 - device shareable property | ||
198 | * NS0 = PRRR[18] = 0 - normal shareable property | ||
199 | * NS1 = PRRR[19] = 1 - normal shareable property | ||
200 | * NOS = PRRR[24+n] = 1 - not outer shareable | ||
201 | */ | ||
202 | .equ PRRR, 0xff0a81a8 | ||
203 | .equ NMRR, 0x40e040e0 | ||
204 | |||
205 | /* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ | ||
206 | .globl cpu_v7_suspend_size | ||
207 | .equ cpu_v7_suspend_size, 4 * 8 | ||
208 | #ifdef CONFIG_PM | ||
209 | ENTRY(cpu_v7_do_suspend) | ||
210 | stmfd sp!, {r4 - r11, lr} | ||
211 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID | ||
212 | mrc p15, 0, r5, c13, c0, 1 @ Context ID | ||
213 | mrc p15, 0, r6, c3, c0, 0 @ Domain ID | ||
214 | mrc p15, 0, r7, c2, c0, 0 @ TTB 0 | ||
215 | mrc p15, 0, r8, c2, c0, 1 @ TTB 1 | ||
216 | mrc p15, 0, r9, c1, c0, 0 @ Control register | ||
217 | mrc p15, 0, r10, c1, c0, 1 @ Auxiliary control register | ||
218 | mrc p15, 0, r11, c1, c0, 2 @ Co-processor access control | ||
219 | stmia r0, {r4 - r11} | ||
220 | ldmfd sp!, {r4 - r11, pc} | ||
221 | ENDPROC(cpu_v7_do_suspend) | ||
222 | |||
223 | ENTRY(cpu_v7_do_resume) | ||
224 | mov ip, #0 | ||
225 | mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs | ||
226 | mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache | ||
227 | ldmia r0, {r4 - r11} | ||
228 | mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID | ||
229 | mcr p15, 0, r5, c13, c0, 1 @ Context ID | ||
230 | mcr p15, 0, r6, c3, c0, 0 @ Domain ID | ||
231 | mcr p15, 0, r7, c2, c0, 0 @ TTB 0 | ||
232 | mcr p15, 0, r8, c2, c0, 1 @ TTB 1 | ||
233 | mcr p15, 0, ip, c2, c0, 2 @ TTB control register | ||
234 | mcr p15, 0, r10, c1, c0, 1 @ Auxillary control register | ||
235 | mcr p15, 0, r11, c1, c0, 2 @ Co-processor access control | ||
236 | ldr r4, =PRRR @ PRRR | ||
237 | ldr r5, =NMRR @ NMRR | ||
238 | mcr p15, 0, r4, c10, c2, 0 @ write PRRR | ||
239 | mcr p15, 0, r5, c10, c2, 1 @ write NMRR | ||
240 | isb | ||
241 | mov r0, r9 @ control register | ||
242 | mov r2, r7, lsr #14 @ get TTB0 base | ||
243 | mov r2, r2, lsl #14 | ||
244 | ldr r3, cpu_resume_l1_flags | ||
245 | b cpu_resume_mmu | ||
246 | ENDPROC(cpu_v7_do_resume) | ||
247 | cpu_resume_l1_flags: | ||
248 | ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_SMP) | ||
249 | ALT_UP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_UP) | ||
250 | #else | ||
251 | #define cpu_v7_do_suspend 0 | ||
252 | #define cpu_v7_do_resume 0 | ||
253 | #endif | ||
254 | |||
174 | __CPUINIT | 255 | __CPUINIT |
175 | 256 | ||
176 | /* | 257 | /* |
@@ -276,36 +357,8 @@ __v7_setup: | |||
276 | ALT_SMP(orr r4, r4, #TTB_FLAGS_SMP) | 357 | ALT_SMP(orr r4, r4, #TTB_FLAGS_SMP) |
277 | ALT_UP(orr r4, r4, #TTB_FLAGS_UP) | 358 | ALT_UP(orr r4, r4, #TTB_FLAGS_UP) |
278 | mcr p15, 0, r4, c2, c0, 1 @ load TTB1 | 359 | mcr p15, 0, r4, c2, c0, 1 @ load TTB1 |
279 | /* | 360 | ldr r5, =PRRR @ PRRR |
280 | * Memory region attributes with SCTLR.TRE=1 | 361 | ldr r6, =NMRR @ NMRR |
281 | * | ||
282 | * n = TEX[0],C,B | ||
283 | * TR = PRRR[2n+1:2n] - memory type | ||
284 | * IR = NMRR[2n+1:2n] - inner cacheable property | ||
285 | * OR = NMRR[2n+17:2n+16] - outer cacheable property | ||
286 | * | ||
287 | * n TR IR OR | ||
288 | * UNCACHED 000 00 | ||
289 | * BUFFERABLE 001 10 00 00 | ||
290 | * WRITETHROUGH 010 10 10 10 | ||
291 | * WRITEBACK 011 10 11 11 | ||
292 | * reserved 110 | ||
293 | * WRITEALLOC 111 10 01 01 | ||
294 | * DEV_SHARED 100 01 | ||
295 | * DEV_NONSHARED 100 01 | ||
296 | * DEV_WC 001 10 | ||
297 | * DEV_CACHED 011 10 | ||
298 | * | ||
299 | * Other attributes: | ||
300 | * | ||
301 | * DS0 = PRRR[16] = 0 - device shareable property | ||
302 | * DS1 = PRRR[17] = 1 - device shareable property | ||
303 | * NS0 = PRRR[18] = 0 - normal shareable property | ||
304 | * NS1 = PRRR[19] = 1 - normal shareable property | ||
305 | * NOS = PRRR[24+n] = 1 - not outer shareable | ||
306 | */ | ||
307 | ldr r5, =0xff0a81a8 @ PRRR | ||
308 | ldr r6, =0x40e040e0 @ NMRR | ||
309 | mcr p15, 0, r5, c10, c2, 0 @ write PRRR | 362 | mcr p15, 0, r5, c10, c2, 0 @ write PRRR |
310 | mcr p15, 0, r6, c10, c2, 1 @ write NMRR | 363 | mcr p15, 0, r6, c10, c2, 1 @ write NMRR |
311 | #endif | 364 | #endif |
@@ -351,6 +404,9 @@ ENTRY(v7_processor_functions) | |||
351 | .word cpu_v7_dcache_clean_area | 404 | .word cpu_v7_dcache_clean_area |
352 | .word cpu_v7_switch_mm | 405 | .word cpu_v7_switch_mm |
353 | .word cpu_v7_set_pte_ext | 406 | .word cpu_v7_set_pte_ext |
407 | .word 0 | ||
408 | .word 0 | ||
409 | .word 0 | ||
354 | .size v7_processor_functions, . - v7_processor_functions | 410 | .size v7_processor_functions, . - v7_processor_functions |
355 | 411 | ||
356 | .section ".rodata" | 412 | .section ".rodata" |