[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>

authored by Eric Miao and committed by Russell King b750a093 711be5cc

+80 -46
+1 -4
arch/arm/mach-pxa/pxa25x.c
··· 180 180 181 181 static 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 183 CKEN = 0; 187 184 188 185 switch (state) { 189 186 case PM_SUSPEND_MEM: 190 187 /* set resume return address */ 191 188 PSPR = virt_to_phys(pxa_cpu_resume); 192 - pxa_cpu_suspend(PWRMODE_SLEEP); 189 + pxa25x_cpu_suspend(PWRMODE_SLEEP); 193 190 break; 194 191 } 195 192 }
+1 -3
arch/arm/mach-pxa/pxa27x.c
··· 223 223 void pxa27x_cpu_pm_enter(suspend_state_t state) 224 224 { 225 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 227 if (state == PM_SUSPEND_STANDBY) 230 228 CKEN = (1 << CKEN_MEMC) | (1 << CKEN_OSTIMER) | ··· 243 245 case PM_SUSPEND_MEM: 244 246 /* set resume return address */ 245 247 PSPR = virt_to_phys(pxa_cpu_resume); 246 - pxa_cpu_suspend(PWRMODE_SLEEP); 248 + pxa27x_cpu_suspend(PWRMODE_SLEEP); 247 249 break; 248 250 } 249 251 }
+73 -39
arch/arm/mach-pxa/sleep.S
··· 17 17 18 18 #include <asm/arch/pxa-regs.h> 19 19 20 - #ifdef CONFIG_PXA27x // workaround for Errata 50 21 20 #define MDREFR_KDIV 0x200a4000 // all banks 22 21 #define CCCR_SLEEP 0x00000107 // L=7 2N=2 A=0 PPDIS=0 CPDIS=0 23 - #endif 24 22 25 23 .text 26 24 27 - /* 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 - 25 + pxa_cpu_save_cp: 42 26 @ get coprocessor registers 43 27 mrc p14, 0, r3, c6, c0, 0 @ clock configuration, for turbo mode 44 28 mrc p15, 0, r4, c15, c1, 0 @ CP access reg ··· 38 54 mov r10, sp 39 55 stmfd sp!, {r3 - r10} 40 56 41 - mov r5, r0 @ save sleep mode 57 + mov pc, lr 58 + 59 + pxa_cpu_save_sp: 42 60 @ preserve phys address of stack 43 61 mov r0, sp 62 + mov r2, lr 44 63 bl sleep_phys_sp 45 64 ldr r1, =sleep_save_sp 46 65 str r0, [r1] 66 + mov pc, r2 67 + 68 + /* 69 + * pxa27x_cpu_suspend() 70 + * 71 + * Forces CPU into sleep state. 72 + * 73 + * r0 = value for PWRMODE M field for desired sleep state 74 + */ 75 + 76 + ENTRY(pxa27x_cpu_suspend) 77 + 78 + #ifndef CONFIG_IWMMXT 79 + mra r2, r3, acc0 80 + #endif 81 + stmfd sp!, {r2 - r12, lr} @ save registers on stack 82 + 83 + bl pxa_cpu_save_cp 84 + 85 + mov r5, r0 @ save sleep mode 86 + bl pxa_cpu_save_sp 47 87 48 88 @ clean data cache 49 89 bl xscale_flush_kern_cache_all ··· 88 80 @ enable SDRAM self-refresh mode 89 81 orr r5, r5, #MDREFR_SLFRSH 90 82 91 - #ifdef CONFIG_PXA27x 92 83 @ set SDCLKx divide-by-2 bits (this is part of a workaround for Errata 50) 93 84 ldr r6, =MDREFR_KDIV 94 85 orr r5, r5, r6 95 - #endif 96 86 97 - #ifdef CONFIG_PXA25x 87 + @ Intel PXA270 Specification Update notes problems sleeping 88 + @ with core operating above 91 MHz 89 + @ (see Errata 50, ...processor does not exit from sleep...) 90 + 91 + ldr r6, =CCCR 92 + ldr r8, [r6] @ keep original value for resume 93 + 94 + ldr r7, =CCCR_SLEEP @ prepare CCCR sleep value 95 + mov r0, #0x2 @ prepare value for CLKCFG 96 + 97 + @ align execution to a cache line 98 + b pxa_cpu_do_suspend 99 + 100 + /* 101 + * pxa27x_cpu_suspend() 102 + * 103 + * Forces CPU into sleep state. 104 + * 105 + * r0 = value for PWRMODE M field for desired sleep state 106 + */ 107 + 108 + ENTRY(pxa25x_cpu_suspend) 109 + stmfd sp!, {r2 - r12, lr} @ save registers on stack 110 + 111 + bl pxa_cpu_save_cp 112 + 113 + mov r5, r0 @ save sleep mode 114 + bl pxa_cpu_save_sp 115 + 116 + @ clean data cache 117 + bl xscale_flush_kern_cache_all 118 + 119 + @ prepare value for sleep mode 120 + mov r1, r5 @ sleep mode 121 + 122 + @ prepare pointer to physical address 0 (virtual mapping in generic.c) 123 + mov r2, #UNCACHED_PHYS_0 124 + 125 + @ prepare SDRAM refresh settings 126 + ldr r4, =MDREFR 127 + ldr r5, [r4] 128 + 129 + @ enable SDRAM self-refresh mode 130 + orr r5, r5, #MDREFR_SLFRSH 131 + 98 132 @ Intel PXA255 Specification Update notes problems 99 133 @ about suspending with PXBus operating above 133MHz 100 134 @ (see Errata 31, GPIO output signals, ... unpredictable in sleep ··· 168 118 mov r0, #0 169 119 mcr p14, 0, r0, c6, c0, 0 170 120 orr r0, r0, #2 @ initiate change bit 171 - #endif 172 - #ifdef CONFIG_PXA27x 173 - @ Intel PXA270 Specification Update notes problems sleeping 174 - @ with core operating above 91 MHz 175 - @ (see Errata 50, ...processor does not exit from sleep...) 176 - 177 - ldr r6, =CCCR 178 - ldr r8, [r6] @ keep original value for resume 179 - 180 - ldr r7, =CCCR_SLEEP @ prepare CCCR sleep value 181 - mov r0, #0x2 @ prepare value for CLKCFG 182 - #endif 183 - 184 - @ align execution to a cache line 185 - b 1f 121 + b pxa_cpu_do_suspend 186 122 187 123 .ltorg 188 124 .align 5 189 - 1: 125 + pxa_cpu_do_suspend: 190 126 191 127 @ All needed values are now in registers. 192 128 @ These last instructions should be in cache 193 129 194 - #if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x) 195 130 @ initiate the frequency change... 196 131 str r7, [r6] 197 132 mcr p14, 0, r0, c6, c0, 0 ··· 190 155 mov r0, #42 191 156 10: subs r0, r0, #1 192 157 bne 10b 193 - #endif 194 158 195 159 @ Do not reorder... 196 160 @ Intel PXA270 Specification Update notes problems performing
+5
include/asm-arm/arch-pxa/pm.h
··· 17 17 18 18 extern struct pxa_cpu_pm_fns *pxa_cpu_pm_fns; 19 19 20 + /* sleep.S */ 21 + extern void pxa25x_cpu_suspend(unsigned int); 22 + extern void pxa27x_cpu_suspend(unsigned int); 23 + extern void pxa_cpu_resume(void); 24 + 20 25 extern int pxa_pm_enter(suspend_state_t state);