diff options
Diffstat (limited to 'arch/arm/mach-pxa/sleep.S')
-rw-r--r-- | arch/arm/mach-pxa/sleep.S | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S index 14bb4a93ea52..784716eb7fc5 100644 --- a/arch/arm/mach-pxa/sleep.S +++ b/arch/arm/mach-pxa/sleep.S | |||
@@ -50,6 +50,108 @@ pxa_cpu_save_sp: | |||
50 | str r0, [r1] | 50 | str r0, [r1] |
51 | ldr pc, [sp], #4 | 51 | ldr pc, [sp], #4 |
52 | 52 | ||
53 | #ifdef CONFIG_PXA3xx | ||
54 | /* | ||
55 | * pxa3xx_cpu_suspend() - forces CPU into sleep state (S2D3C4) | ||
56 | * | ||
57 | * NOTE: unfortunately, pxa_cpu_save_cp can not be reused here since | ||
58 | * the auxiliary control register address is different between pxa3xx | ||
59 | * and pxa{25x,27x} | ||
60 | */ | ||
61 | |||
62 | ENTRY(pxa3xx_cpu_suspend) | ||
63 | |||
64 | #ifndef CONFIG_IWMMXT | ||
65 | mra r2, r3, acc0 | ||
66 | #endif | ||
67 | stmfd sp!, {r2 - r12, lr} @ save registers on stack | ||
68 | |||
69 | mrc p14, 0, r3, c6, c0, 0 @ clock configuration, for turbo mode | ||
70 | mrc p15, 0, r4, c15, c1, 0 @ CP access reg | ||
71 | mrc p15, 0, r5, c13, c0, 0 @ PID | ||
72 | mrc p15, 0, r6, c3, c0, 0 @ domain ID | ||
73 | mrc p15, 0, r7, c2, c0, 0 @ translation table base addr | ||
74 | mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg | ||
75 | mrc p15, 0, r9, c1, c0, 0 @ control reg | ||
76 | |||
77 | bic r3, r3, #2 @ clear frequency change bit | ||
78 | |||
79 | @ store them plus current virtual stack ptr on stack | ||
80 | mov r10, sp | ||
81 | stmfd sp!, {r3 - r10} | ||
82 | |||
83 | @ store physical address of stack pointer | ||
84 | mov r0, sp | ||
85 | bl sleep_phys_sp | ||
86 | ldr r1, =sleep_save_sp | ||
87 | str r0, [r1] | ||
88 | |||
89 | @ clean data cache | ||
90 | bl xsc3_flush_kern_cache_all | ||
91 | |||
92 | mov r0, #0x06 @ S2D3C4 mode | ||
93 | mcr p14, 0, r0, c7, c0, 0 @ enter sleep | ||
94 | |||
95 | 20: b 20b @ waiting for sleep | ||
96 | |||
97 | .data | ||
98 | .align 5 | ||
99 | /* | ||
100 | * pxa3xx_cpu_resume | ||
101 | */ | ||
102 | |||
103 | ENTRY(pxa3xx_cpu_resume) | ||
104 | |||
105 | mov r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE @ set SVC, irqs off | ||
106 | msr cpsr_c, r0 | ||
107 | |||
108 | ldr r0, sleep_save_sp @ stack phys addr | ||
109 | ldmfd r0, {r3 - r9, sp} @ CP regs + virt stack ptr | ||
110 | |||
111 | mov r1, #0 | ||
112 | mcr p15, 0, r1, c7, c7, 0 @ invalidate I & D caches, BTB | ||
113 | mcr p15, 0, r1, c7, c10, 4 @ drain write (&fill) buffer | ||
114 | mcr p15, 0, r1, c7, c5, 4 @ flush prefetch buffer | ||
115 | mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs | ||
116 | |||
117 | mcr p14, 0, r3, c6, c0, 0 @ clock configuration, turbo mode. | ||
118 | mcr p15, 0, r4, c15, c1, 0 @ CP access reg | ||
119 | mcr p15, 0, r5, c13, c0, 0 @ PID | ||
120 | mcr p15, 0, r6, c3, c0, 0 @ domain ID | ||
121 | mcr p15, 0, r7, c2, c0, 0 @ translation table base addr | ||
122 | mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg | ||
123 | |||
124 | @ temporarily map resume_turn_on_mmu into the page table, | ||
125 | @ otherwise prefetch abort occurs after MMU is turned on | ||
126 | mov r1, r7 | ||
127 | bic r1, r1, #0x00ff | ||
128 | bic r1, r1, #0x3f00 | ||
129 | ldr r2, =0x542e | ||
130 | |||
131 | adr r3, resume_turn_on_mmu | ||
132 | mov r3, r3, lsr #20 | ||
133 | orr r4, r2, r3, lsl #20 | ||
134 | ldr r5, [r1, r3, lsl #2] | ||
135 | str r4, [r1, r3, lsl #2] | ||
136 | |||
137 | @ Mapping page table address in the page table | ||
138 | mov r6, r1, lsr #20 | ||
139 | orr r7, r2, r6, lsl #20 | ||
140 | ldr r8, [r1, r6, lsl #2] | ||
141 | str r7, [r1, r6, lsl #2] | ||
142 | |||
143 | ldr r2, =pxa3xx_resume_after_mmu @ absolute virtual address | ||
144 | b resume_turn_on_mmu @ cache align execution | ||
145 | |||
146 | .text | ||
147 | pxa3xx_resume_after_mmu: | ||
148 | /* restore the temporary mapping */ | ||
149 | str r5, [r1, r3, lsl #2] | ||
150 | str r8, [r1, r6, lsl #2] | ||
151 | b resume_after_mmu | ||
152 | |||
153 | #endif /* CONFIG_PXA3xx */ | ||
154 | |||
53 | #ifdef CONFIG_PXA27x | 155 | #ifdef CONFIG_PXA27x |
54 | /* | 156 | /* |
55 | * pxa27x_cpu_suspend() | 157 | * pxa27x_cpu_suspend() |