aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/pxa27x.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/pxa27x.c')
-rw-r--r--arch/arm/mach-pxa/pxa27x.c49
1 files changed, 22 insertions, 27 deletions
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 96cf274ec7cb..46a951c3e5a0 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/suspend.h> 17#include <linux/suspend.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/sysdev.h>
19 20
20#include <asm/hardware.h> 21#include <asm/hardware.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
@@ -171,11 +172,6 @@ static struct clk pxa27x_clks[] = {
171#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x 172#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
172#define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] 173#define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x]
173 174
174#define RESTORE_GPLEVEL(n) do { \
175 GPSR##n = sleep_save[SLEEP_SAVE_GPLR##n]; \
176 GPCR##n = ~sleep_save[SLEEP_SAVE_GPLR##n]; \
177} while (0)
178
179/* 175/*
180 * List of global PXA peripheral registers to preserve. 176 * List of global PXA peripheral registers to preserve.
181 * More ones like CP and general purpose register values are preserved 177 * More ones like CP and general purpose register values are preserved
@@ -183,10 +179,6 @@ static struct clk pxa27x_clks[] = {
183 */ 179 */
184enum { SLEEP_SAVE_START = 0, 180enum { SLEEP_SAVE_START = 0,
185 181
186 SLEEP_SAVE_GPLR0, SLEEP_SAVE_GPLR1, SLEEP_SAVE_GPLR2, SLEEP_SAVE_GPLR3,
187 SLEEP_SAVE_GPDR0, SLEEP_SAVE_GPDR1, SLEEP_SAVE_GPDR2, SLEEP_SAVE_GPDR3,
188 SLEEP_SAVE_GRER0, SLEEP_SAVE_GRER1, SLEEP_SAVE_GRER2, SLEEP_SAVE_GRER3,
189 SLEEP_SAVE_GFER0, SLEEP_SAVE_GFER1, SLEEP_SAVE_GFER2, SLEEP_SAVE_GFER3,
190 SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, SLEEP_SAVE_PGSR3, 182 SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, SLEEP_SAVE_PGSR3,
191 183
192 SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U, 184 SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U,
@@ -196,7 +188,6 @@ enum { SLEEP_SAVE_START = 0,
196 188
197 SLEEP_SAVE_PSTR, 189 SLEEP_SAVE_PSTR,
198 190
199 SLEEP_SAVE_ICMR,
200 SLEEP_SAVE_CKEN, 191 SLEEP_SAVE_CKEN,
201 192
202 SLEEP_SAVE_MDREFR, 193 SLEEP_SAVE_MDREFR,
@@ -208,10 +199,6 @@ enum { SLEEP_SAVE_START = 0,
208 199
209void pxa27x_cpu_pm_save(unsigned long *sleep_save) 200void pxa27x_cpu_pm_save(unsigned long *sleep_save)
210{ 201{
211 SAVE(GPLR0); SAVE(GPLR1); SAVE(GPLR2); SAVE(GPLR3);
212 SAVE(GPDR0); SAVE(GPDR1); SAVE(GPDR2); SAVE(GPDR3);
213 SAVE(GRER0); SAVE(GRER1); SAVE(GRER2); SAVE(GRER3);
214 SAVE(GFER0); SAVE(GFER1); SAVE(GFER2); SAVE(GFER3);
215 SAVE(PGSR0); SAVE(PGSR1); SAVE(PGSR2); SAVE(PGSR3); 202 SAVE(PGSR0); SAVE(PGSR1); SAVE(PGSR2); SAVE(PGSR3);
216 203
217 SAVE(GAFR0_L); SAVE(GAFR0_U); 204 SAVE(GAFR0_L); SAVE(GAFR0_U);
@@ -223,12 +210,8 @@ void pxa27x_cpu_pm_save(unsigned long *sleep_save)
223 SAVE(PWER); SAVE(PCFR); SAVE(PRER); 210 SAVE(PWER); SAVE(PCFR); SAVE(PRER);
224 SAVE(PFER); SAVE(PKWR); 211 SAVE(PFER); SAVE(PKWR);
225 212
226 SAVE(ICMR); ICMR = 0;
227 SAVE(CKEN); 213 SAVE(CKEN);
228 SAVE(PSTR); 214 SAVE(PSTR);
229
230 /* Clear GPIO transition detect bits */
231 GEDR0 = GEDR0; GEDR1 = GEDR1; GEDR2 = GEDR2; GEDR3 = GEDR3;
232} 215}
233 216
234void pxa27x_cpu_pm_restore(unsigned long *sleep_save) 217void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
@@ -237,15 +220,10 @@ void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
237 PSPR = 0; 220 PSPR = 0;
238 221
239 /* restore registers */ 222 /* restore registers */
240 RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1);
241 RESTORE_GPLEVEL(2); RESTORE_GPLEVEL(3);
242 RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2); RESTORE(GPDR3);
243 RESTORE(GAFR0_L); RESTORE(GAFR0_U); 223 RESTORE(GAFR0_L); RESTORE(GAFR0_U);
244 RESTORE(GAFR1_L); RESTORE(GAFR1_U); 224 RESTORE(GAFR1_L); RESTORE(GAFR1_U);
245 RESTORE(GAFR2_L); RESTORE(GAFR2_U); 225 RESTORE(GAFR2_L); RESTORE(GAFR2_U);
246 RESTORE(GAFR3_L); RESTORE(GAFR3_U); 226 RESTORE(GAFR3_L); RESTORE(GAFR3_U);
247 RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2); RESTORE(GRER3);
248 RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2); RESTORE(GFER3);
249 RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2); RESTORE(PGSR3); 227 RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2); RESTORE(PGSR3);
250 228
251 RESTORE(MDREFR); 229 RESTORE(MDREFR);
@@ -256,9 +234,6 @@ void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
256 234
257 RESTORE(CKEN); 235 RESTORE(CKEN);
258 236
259 ICLR = 0;
260 ICCR = 1;
261 RESTORE(ICMR);
262 RESTORE(PSTR); 237 RESTORE(PSTR);
263} 238}
264 239
@@ -409,9 +384,22 @@ static struct platform_device *devices[] __initdata = {
409 &pxa27x_device_ssp3, 384 &pxa27x_device_ssp3,
410}; 385};
411 386
387static struct sys_device pxa27x_sysdev[] = {
388 {
389 .id = 0,
390 .cls = &pxa_irq_sysclass,
391 }, {
392 .id = 1,
393 .cls = &pxa_irq_sysclass,
394 }, {
395 .cls = &pxa_gpio_sysclass,
396 },
397};
398
412static int __init pxa27x_init(void) 399static int __init pxa27x_init(void)
413{ 400{
414 int ret = 0; 401 int i, ret = 0;
402
415 if (cpu_is_pxa27x()) { 403 if (cpu_is_pxa27x()) {
416 clks_register(pxa27x_clks, ARRAY_SIZE(pxa27x_clks)); 404 clks_register(pxa27x_clks, ARRAY_SIZE(pxa27x_clks));
417 405
@@ -420,8 +408,15 @@ static int __init pxa27x_init(void)
420 408
421 pxa27x_init_pm(); 409 pxa27x_init_pm();
422 410
411 for (i = 0; i < ARRAY_SIZE(pxa27x_sysdev); i++) {
412 ret = sysdev_register(&pxa27x_sysdev[i]);
413 if (ret)
414 pr_err("failed to register sysdev[%d]\n", i);
415 }
416
423 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 417 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
424 } 418 }
419
425 return ret; 420 return ret;
426} 421}
427 422