aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-06-21 11:29:30 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-06-24 03:48:45 -0400
commita9503d2185bbc28e498c435a07f24986c48b5cbe (patch)
tree86987b72ceccea710fa67085f51c6083a9fc672e
parent372c0ac8aca7655b6a8920b10bf9563402ac19d8 (diff)
ARM: pm: pxa: move cpu_suspend into C code
We don't need a veneer for cpu_suspend, it can be called directly from C code now. Move it into the PXA CPU suspend functions, along with the accumulator register saving/restoring. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-pxa/include/mach/pm.h4
-rw-r--r--arch/arm/mach-pxa/pxa25x.c3
-rw-r--r--arch/arm/mach-pxa/pxa27x.c11
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c13
-rw-r--r--arch/arm/mach-pxa/sleep.S58
-rw-r--r--arch/arm/mach-pxa/zeus.c3
6 files changed, 33 insertions, 59 deletions
diff --git a/arch/arm/mach-pxa/include/mach/pm.h b/arch/arm/mach-pxa/include/mach/pm.h
index f15afe012995..a566720527cf 100644
--- a/arch/arm/mach-pxa/include/mach/pm.h
+++ b/arch/arm/mach-pxa/include/mach/pm.h
@@ -22,8 +22,8 @@ struct pxa_cpu_pm_fns {
22extern struct pxa_cpu_pm_fns *pxa_cpu_pm_fns; 22extern struct pxa_cpu_pm_fns *pxa_cpu_pm_fns;
23 23
24/* sleep.S */ 24/* sleep.S */
25extern void pxa25x_cpu_suspend(unsigned int, long); 25extern void pxa25x_finish_suspend(unsigned long);
26extern void pxa27x_cpu_suspend(unsigned int, long); 26extern void pxa27x_finish_suspend(unsigned long);
27 27
28extern int pxa_pm_enter(suspend_state_t state); 28extern int pxa_pm_enter(suspend_state_t state);
29extern int pxa_pm_prepare(void); 29extern int pxa_pm_prepare(void);
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index fed363cec9c6..fd7725cb5c01 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -244,7 +244,8 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)
244 244
245 switch (state) { 245 switch (state) {
246 case PM_SUSPEND_MEM: 246 case PM_SUSPEND_MEM:
247 pxa25x_cpu_suspend(PWRMODE_SLEEP, PLAT_PHYS_OFFSET - PAGE_OFFSET); 247 cpu_suspend(0, PHYS_OFFSET - PAGE_OFFSET, PWRMODE_SLEEP,
248 pxa25x_finish_suspend);
248 break; 249 break;
249 } 250 }
250} 251}
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 2fecbec58d88..824379d43758 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -284,6 +284,11 @@ void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
284void pxa27x_cpu_pm_enter(suspend_state_t state) 284void pxa27x_cpu_pm_enter(suspend_state_t state)
285{ 285{
286 extern void pxa_cpu_standby(void); 286 extern void pxa_cpu_standby(void);
287#ifndef CONFIG_IWMMXT
288 u64 acc0;
289
290 asm volatile("mra %Q0, %R0, acc0" : "=r" (acc0));
291#endif
287 292
288 /* ensure voltage-change sequencer not initiated, which hangs */ 293 /* ensure voltage-change sequencer not initiated, which hangs */
289 PCFR &= ~PCFR_FVC; 294 PCFR &= ~PCFR_FVC;
@@ -299,7 +304,11 @@ void pxa27x_cpu_pm_enter(suspend_state_t state)
299 pxa_cpu_standby(); 304 pxa_cpu_standby();
300 break; 305 break;
301 case PM_SUSPEND_MEM: 306 case PM_SUSPEND_MEM:
302 pxa27x_cpu_suspend(pwrmode, PLAT_PHYS_OFFSET - PAGE_OFFSET); 307 cpu_suspend(0, PHYS_OFFSET - PAGE_OFFSET, pwrmode,
308 pxa27x_finish_suspend);
309#ifndef CONFIG_IWMMXT
310 asm volatile("mar acc0, %Q0, %R0" : "=r" (acc0));
311#endif
303 break; 312 break;
304 } 313 }
305} 314}
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 8521d7d6f1da..220fd8c15dab 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -141,8 +141,13 @@ static void pxa3xx_cpu_pm_suspend(void)
141{ 141{
142 volatile unsigned long *p = (volatile void *)0xc0000000; 142 volatile unsigned long *p = (volatile void *)0xc0000000;
143 unsigned long saved_data = *p; 143 unsigned long saved_data = *p;
144#ifndef CONFIG_IWMMXT
145 u64 acc0;
144 146
145 extern void pxa3xx_cpu_suspend(long); 147 asm volatile("mra %Q0, %R0, acc0" : "=r" (acc0));
148#endif
149
150 extern void pxa3xx_finish_suspend(unsigned long);
146 151
147 /* resuming from D2 requires the HSIO2/BOOT/TPM clocks enabled */ 152 /* resuming from D2 requires the HSIO2/BOOT/TPM clocks enabled */
148 CKENA |= (1 << CKEN_BOOT) | (1 << CKEN_TPM); 153 CKENA |= (1 << CKEN_BOOT) | (1 << CKEN_TPM);
@@ -162,11 +167,15 @@ static void pxa3xx_cpu_pm_suspend(void)
162 /* overwrite with the resume address */ 167 /* overwrite with the resume address */
163 *p = virt_to_phys(cpu_resume); 168 *p = virt_to_phys(cpu_resume);
164 169
165 pxa3xx_cpu_suspend(PLAT_PHYS_OFFSET - PAGE_OFFSET); 170 cpu_suspend(0, PHYS_OFFSET - PAGE_OFFSET, 0, pxa3xx_finish_suspend);
166 171
167 *p = saved_data; 172 *p = saved_data;
168 173
169 AD3ER = 0; 174 AD3ER = 0;
175
176#ifndef CONFIG_IWMMXT
177 asm volatile("mar acc0, %Q0, %R0" : "=r" (acc0));
178#endif
170} 179}
171 180
172static void pxa3xx_cpu_pm_enter(suspend_state_t state) 181static void pxa3xx_cpu_pm_enter(suspend_state_t state)
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index 3a67887e6dbd..1e544be9905d 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -24,22 +24,9 @@
24 24
25#ifdef CONFIG_PXA3xx 25#ifdef CONFIG_PXA3xx
26/* 26/*
27 * pxa3xx_cpu_suspend() - forces CPU into sleep state (S2D3C4) 27 * pxa3xx_finish_suspend() - forces CPU into sleep state (S2D3C4)
28 *
29 * r0 = v:p offset
30 */ 28 */
31ENTRY(pxa3xx_cpu_suspend) 29ENTRY(pxa3xx_finish_suspend)
32
33#ifndef CONFIG_IWMMXT
34 mra r2, r3, acc0
35#endif
36 stmfd sp!, {r2 - r12, lr} @ save registers on stack
37 mov r1, r0
38 adr r3, BSYM(pxa3xx_finish_suspend)
39 bl cpu_suspend
40 b pxa_cpu_resume
41
42pxa3xx_finish_suspend:
43 mov r0, #0x06 @ S2D3C4 mode 30 mov r0, #0x06 @ S2D3C4 mode
44 mcr p14, 0, r0, c7, c0, 0 @ enter sleep 31 mcr p14, 0, r0, c7, c0, 0 @ enter sleep
45 32
@@ -48,25 +35,13 @@ pxa3xx_finish_suspend:
48 35
49#ifdef CONFIG_PXA27x 36#ifdef CONFIG_PXA27x
50/* 37/*
51 * pxa27x_cpu_suspend() 38 * pxa27x_finish_suspend()
52 * 39 *
53 * Forces CPU into sleep state. 40 * Forces CPU into sleep state.
54 * 41 *
55 * r0 = value for PWRMODE M field for desired sleep state 42 * r0 = value for PWRMODE M field for desired sleep state
56 * r1 = v:p offset
57 */ 43 */
58ENTRY(pxa27x_cpu_suspend) 44ENTRY(pxa27x_finish_suspend)
59
60#ifndef CONFIG_IWMMXT
61 mra r2, r3, acc0
62#endif
63 stmfd sp!, {r2 - r12, lr} @ save registers on stack
64 mov r2, r0 @ save sleep mode
65 adr r3, BSYM(pxa27x_finish_suspend)
66 bl cpu_suspend
67 b pxa_cpu_resume
68
69pxa27x_finish_suspend:
70 @ Put the processor to sleep 45 @ Put the processor to sleep
71 @ (also workaround for sighting 28071) 46 @ (also workaround for sighting 28071)
72 47
@@ -103,22 +78,14 @@ pxa27x_finish_suspend:
103 78
104#ifdef CONFIG_PXA25x 79#ifdef CONFIG_PXA25x
105/* 80/*
106 * pxa25x_cpu_suspend() 81 * pxa25x_finish_suspend()
107 * 82 *
108 * Forces CPU into sleep state. 83 * Forces CPU into sleep state.
109 * 84 *
110 * r0 = value for PWRMODE M field for desired sleep state 85 * r0 = value for PWRMODE M field for desired sleep state
111 * r1 = v:p offset
112 */ 86 */
113 87
114ENTRY(pxa25x_cpu_suspend) 88ENTRY(pxa25x_finish_suspend)
115 stmfd sp!, {r2 - r12, lr} @ save registers on stack
116 mov r2, r0 @ save sleep mode
117 adr r3, BSYM(pxa25x_finish_suspend)
118 bl cpu_suspend
119 b pxa_cpu_resume
120
121pxa25x_finish_suspend:
122 @ prepare value for sleep mode 89 @ prepare value for sleep mode
123 mov r1, r0 @ sleep mode 90 mov r1, r0 @ sleep mode
124 91
@@ -202,16 +169,3 @@ pxa_cpu_do_suspend:
202 mcr p14, 0, r1, c7, c0, 0 @ PWRMODE 169 mcr p14, 0, r1, c7, c0, 0 @ PWRMODE
203 170
20420: b 20b @ loop waiting for sleep 17120: b 20b @ loop waiting for sleep
205
206/*
207 * pxa_cpu_resume()
208 *
209 * entry point from bootloader into kernel during resume
210 */
211 .align 5
212pxa_cpu_resume:
213 ldmfd sp!, {r2, r3}
214#ifndef CONFIG_IWMMXT
215 mar acc0, r2, r3
216#endif
217 ldmfd sp!, {r4 - r12, pc} @ return to caller
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index 00363c7ac182..28eb410ca779 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -676,7 +676,8 @@ static struct pxa2xx_udc_mach_info zeus_udc_info = {
676static void zeus_power_off(void) 676static void zeus_power_off(void)
677{ 677{
678 local_irq_disable(); 678 local_irq_disable();
679 pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP, PLAT_PHYS_OFFSET - PAGE_OFFSET); 679 cpu_suspend(0, PHYS_OFFSET - PAGE_OFFSET, PWRMODE_DEEPSLEEP,
680 pxa27x_finish_suspend);
680} 681}
681#else 682#else
682#define zeus_power_off NULL 683#define zeus_power_off NULL