aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2007-07-18 06:40:13 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-07-20 12:25:20 -0400
commitb750a09385d7c464113ae8915e63541a163fbac8 (patch)
treecf7204368ff629ff00cecdabe8bc0e2ba3a82c85 /arch/arm
parent711be5ccfe9a02ba560aa918a008c31ea4760163 (diff)
[ARM] 4489/1: pxa: split pxa_cpu_suspend to processor specific ones
1. split pxa_cpu_suspend to pxa25x_cpu_suspend and pxa27x_cpu_suspend and make pxa25x_cpu_pm_enter() and pxa27x_cpu_pm_enter() to invoke the corresponding _suspend functions, thus remove all those ugly #ifdef .. #endif out of sleep.S 2. move the declarations of those suspend functions to pm.h note: this is not a clean enough solution until all the pxa25x and pxa27x specific part is further removed out of sleep.S, sleep.S is supposed to contain generic code only Signed-off-by: eric miao <eric.y.miao@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-pxa/pxa25x.c5
-rw-r--r--arch/arm/mach-pxa/pxa27x.c4
-rw-r--r--arch/arm/mach-pxa/sleep.S112
3 files changed, 75 insertions, 46 deletions
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 1ec4bf1ff249..6dfcca72e90f 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -180,16 +180,13 @@ static void pxa25x_cpu_pm_restore(unsigned long *sleep_save)
180 180
181static void pxa25x_cpu_pm_enter(suspend_state_t state) 181static void pxa25x_cpu_pm_enter(suspend_state_t state)
182{ 182{
183 extern void pxa_cpu_suspend(unsigned int);
184 extern void pxa_cpu_resume(void);
185
186 CKEN = 0; 183 CKEN = 0;
187 184
188 switch (state) { 185 switch (state) {
189 case PM_SUSPEND_MEM: 186 case PM_SUSPEND_MEM:
190 /* set resume return address */ 187 /* set resume return address */
191 PSPR = virt_to_phys(pxa_cpu_resume); 188 PSPR = virt_to_phys(pxa_cpu_resume);
192 pxa_cpu_suspend(PWRMODE_SLEEP); 189 pxa25x_cpu_suspend(PWRMODE_SLEEP);
193 break; 190 break;
194 } 191 }
195} 192}
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 9240d37e23fa..203371ab19db 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -223,8 +223,6 @@ void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
223void pxa27x_cpu_pm_enter(suspend_state_t state) 223void pxa27x_cpu_pm_enter(suspend_state_t state)
224{ 224{
225 extern void pxa_cpu_standby(void); 225 extern void pxa_cpu_standby(void);
226 extern void pxa_cpu_suspend(unsigned int);
227 extern void pxa_cpu_resume(void);
228 226
229 if (state == PM_SUSPEND_STANDBY) 227 if (state == PM_SUSPEND_STANDBY)
230 CKEN = (1 << CKEN_MEMC) | (1 << CKEN_OSTIMER) | 228 CKEN = (1 << CKEN_MEMC) | (1 << CKEN_OSTIMER) |
@@ -245,7 +243,7 @@ void pxa27x_cpu_pm_enter(suspend_state_t state)
245 case PM_SUSPEND_MEM: 243 case PM_SUSPEND_MEM:
246 /* set resume return address */ 244 /* set resume return address */
247 PSPR = virt_to_phys(pxa_cpu_resume); 245 PSPR = virt_to_phys(pxa_cpu_resume);
248 pxa_cpu_suspend(PWRMODE_SLEEP); 246 pxa27x_cpu_suspend(PWRMODE_SLEEP);
249 break; 247 break;
250 } 248 }
251} 249}
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index 15874b360e51..aff71fec618a 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -17,28 +17,12 @@
17 17
18#include <asm/arch/pxa-regs.h> 18#include <asm/arch/pxa-regs.h>
19 19
20#ifdef CONFIG_PXA27x // workaround for Errata 50
21#define MDREFR_KDIV 0x200a4000 // all banks 20#define MDREFR_KDIV 0x200a4000 // all banks
22#define CCCR_SLEEP 0x00000107 // L=7 2N=2 A=0 PPDIS=0 CPDIS=0 21#define CCCR_SLEEP 0x00000107 // L=7 2N=2 A=0 PPDIS=0 CPDIS=0
23#endif
24 22
25 .text 23 .text
26 24
27/* 25pxa_cpu_save_cp:
28 * pxa_cpu_suspend()
29 *
30 * Forces CPU into sleep state.
31 *
32 * r0 = value for PWRMODE M field for desired sleep state
33 */
34
35ENTRY(pxa_cpu_suspend)
36
37#ifndef CONFIG_IWMMXT
38 mra r2, r3, acc0
39#endif
40 stmfd sp!, {r2 - r12, lr} @ save registers on stack
41
42 @ get coprocessor registers 26 @ get coprocessor registers
43 mrc p14, 0, r3, c6, c0, 0 @ clock configuration, for turbo mode 27 mrc p14, 0, r3, c6, c0, 0 @ clock configuration, for turbo mode
44 mrc p15, 0, r4, c15, c1, 0 @ CP access reg 28 mrc p15, 0, r4, c15, c1, 0 @ CP access reg
@@ -54,12 +38,36 @@ ENTRY(pxa_cpu_suspend)
54 mov r10, sp 38 mov r10, sp
55 stmfd sp!, {r3 - r10} 39 stmfd sp!, {r3 - r10}
56 40
57 mov r5, r0 @ save sleep mode 41 mov pc, lr
42
43pxa_cpu_save_sp:
58 @ preserve phys address of stack 44 @ preserve phys address of stack
59 mov r0, sp 45 mov r0, sp
46 mov r2, lr
60 bl sleep_phys_sp 47 bl sleep_phys_sp
61 ldr r1, =sleep_save_sp 48 ldr r1, =sleep_save_sp
62 str r0, [r1] 49 str r0, [r1]
50 mov pc, r2
51
52/*
53 * pxa27x_cpu_suspend()
54 *
55 * Forces CPU into sleep state.
56 *
57 * r0 = value for PWRMODE M field for desired sleep state
58 */
59
60ENTRY(pxa27x_cpu_suspend)
61
62#ifndef CONFIG_IWMMXT
63 mra r2, r3, acc0
64#endif
65 stmfd sp!, {r2 - r12, lr} @ save registers on stack
66
67 bl pxa_cpu_save_cp
68
69 mov r5, r0 @ save sleep mode
70 bl pxa_cpu_save_sp
63 71
64 @ clean data cache 72 @ clean data cache
65 bl xscale_flush_kern_cache_all 73 bl xscale_flush_kern_cache_all
@@ -80,13 +88,55 @@ ENTRY(pxa_cpu_suspend)
80 @ enable SDRAM self-refresh mode 88 @ enable SDRAM self-refresh mode
81 orr r5, r5, #MDREFR_SLFRSH 89 orr r5, r5, #MDREFR_SLFRSH
82 90
83#ifdef CONFIG_PXA27x
84 @ set SDCLKx divide-by-2 bits (this is part of a workaround for Errata 50) 91 @ set SDCLKx divide-by-2 bits (this is part of a workaround for Errata 50)
85 ldr r6, =MDREFR_KDIV 92 ldr r6, =MDREFR_KDIV
86 orr r5, r5, r6 93 orr r5, r5, r6
87#endif
88 94
89#ifdef CONFIG_PXA25x 95 @ Intel PXA270 Specification Update notes problems sleeping
96 @ with core operating above 91 MHz
97 @ (see Errata 50, ...processor does not exit from sleep...)
98
99 ldr r6, =CCCR
100 ldr r8, [r6] @ keep original value for resume
101
102 ldr r7, =CCCR_SLEEP @ prepare CCCR sleep value
103 mov r0, #0x2 @ prepare value for CLKCFG
104
105 @ align execution to a cache line
106 b pxa_cpu_do_suspend
107
108/*
109 * pxa27x_cpu_suspend()
110 *
111 * Forces CPU into sleep state.
112 *
113 * r0 = value for PWRMODE M field for desired sleep state
114 */
115
116ENTRY(pxa25x_cpu_suspend)
117 stmfd sp!, {r2 - r12, lr} @ save registers on stack
118
119 bl pxa_cpu_save_cp
120
121 mov r5, r0 @ save sleep mode
122 bl pxa_cpu_save_sp
123
124 @ clean data cache
125 bl xscale_flush_kern_cache_all
126
127 @ prepare value for sleep mode
128 mov r1, r5 @ sleep mode
129
130 @ prepare pointer to physical address 0 (virtual mapping in generic.c)
131 mov r2, #UNCACHED_PHYS_0
132
133 @ prepare SDRAM refresh settings
134 ldr r4, =MDREFR
135 ldr r5, [r4]
136
137 @ enable SDRAM self-refresh mode
138 orr r5, r5, #MDREFR_SLFRSH
139
90 @ Intel PXA255 Specification Update notes problems 140 @ Intel PXA255 Specification Update notes problems
91 @ about suspending with PXBus operating above 133MHz 141 @ about suspending with PXBus operating above 133MHz
92 @ (see Errata 31, GPIO output signals, ... unpredictable in sleep 142 @ (see Errata 31, GPIO output signals, ... unpredictable in sleep
@@ -118,30 +168,15 @@ ENTRY(pxa_cpu_suspend)
118 mov r0, #0 168 mov r0, #0
119 mcr p14, 0, r0, c6, c0, 0 169 mcr p14, 0, r0, c6, c0, 0
120 orr r0, r0, #2 @ initiate change bit 170 orr r0, r0, #2 @ initiate change bit
121#endif 171 b pxa_cpu_do_suspend
122#ifdef CONFIG_PXA27x
123 @ Intel PXA270 Specification Update notes problems sleeping
124 @ with core operating above 91 MHz
125 @ (see Errata 50, ...processor does not exit from sleep...)
126
127 ldr r6, =CCCR
128 ldr r8, [r6] @ keep original value for resume
129
130 ldr r7, =CCCR_SLEEP @ prepare CCCR sleep value
131 mov r0, #0x2 @ prepare value for CLKCFG
132#endif
133
134 @ align execution to a cache line
135 b 1f
136 172
137 .ltorg 173 .ltorg
138 .align 5 174 .align 5
1391: 175pxa_cpu_do_suspend:
140 176
141 @ All needed values are now in registers. 177 @ All needed values are now in registers.
142 @ These last instructions should be in cache 178 @ These last instructions should be in cache
143 179
144#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
145 @ initiate the frequency change... 180 @ initiate the frequency change...
146 str r7, [r6] 181 str r7, [r6]
147 mcr p14, 0, r0, c6, c0, 0 182 mcr p14, 0, r0, c6, c0, 0
@@ -155,7 +190,6 @@ ENTRY(pxa_cpu_suspend)
155 mov r0, #42 190 mov r0, #42
15610: subs r0, r0, #1 19110: subs r0, r0, #1
157 bne 10b 192 bne 10b
158#endif
159 193
160 @ Do not reorder... 194 @ Do not reorder...
161 @ Intel PXA270 Specification Update notes problems performing 195 @ Intel PXA270 Specification Update notes problems performing