diff options
author | Eric Miao <eric.y.miao@gmail.com> | 2007-07-18 06:40:13 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-07-20 12:25:20 -0400 |
commit | b750a09385d7c464113ae8915e63541a163fbac8 (patch) | |
tree | cf7204368ff629ff00cecdabe8bc0e2ba3a82c85 /arch/arm/mach-pxa/sleep.S | |
parent | 711be5ccfe9a02ba560aa918a008c31ea4760163 (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/mach-pxa/sleep.S')
-rw-r--r-- | arch/arm/mach-pxa/sleep.S | 112 |
1 files changed, 73 insertions, 39 deletions
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 | /* | 25 | pxa_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 | |||
35 | ENTRY(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 | |||
43 | pxa_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 | |||
60 | ENTRY(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 | |||
116 | ENTRY(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 |
139 | 1: | 175 | pxa_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 |
156 | 10: subs r0, r0, #1 | 191 | 10: 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 |