diff options
author | eric miao <eric.y.miao@gmail.com> | 2007-08-29 05:22:17 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-10-12 16:15:33 -0400 |
commit | c95530c7798b760901c5d6212e528b03e323b8ac (patch) | |
tree | 9bb58fcfaa0b7d44da117d94fc2b7606bbb9d98e /arch/arm/mach-pxa/pxa27x.c | |
parent | 30f0b40844e5add7ad879e2f5939ff498f72f3e6 (diff) |
[ARM] 4560/1: pxa: move processor specific set_wake logic out of irq.c
a function pxa_init_irq_set_wake() was introduced, so that
processor specific code could install their own version
code setting PFER and PRER registers within pxa_gpio_irq_type
are removed, and the edge configuration is postponed to the
(*set_wake) and copies the GRER and GFER register, which will
always be set up correctly by pxa_gpio_irq_type()
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/pxa27x.c')
-rw-r--r-- | arch/arm/mach-pxa/pxa27x.c | 70 |
1 files changed, 63 insertions, 7 deletions
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index d193755afb2b..2d7fc39732e4 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -306,6 +306,69 @@ static void __init pxa27x_init_pm(void) | |||
306 | } | 306 | } |
307 | #endif | 307 | #endif |
308 | 308 | ||
309 | /* PXA27x: Various gpios can issue wakeup events. This logic only | ||
310 | * handles the simple cases, not the WEMUX2 and WEMUX3 options | ||
311 | */ | ||
312 | #define PXA27x_GPIO_NOWAKE_MASK \ | ||
313 | ((1 << 8) | (1 << 7) | (1 << 6) | (1 << 5) | (1 << 2)) | ||
314 | #define WAKEMASK(gpio) \ | ||
315 | (((gpio) <= 15) \ | ||
316 | ? ((1 << (gpio)) & ~PXA27x_GPIO_NOWAKE_MASK) \ | ||
317 | : ((gpio == 35) ? (1 << 24) : 0)) | ||
318 | |||
319 | static int pxa27x_set_wake(unsigned int irq, unsigned int on) | ||
320 | { | ||
321 | int gpio = IRQ_TO_GPIO(irq); | ||
322 | uint32_t mask; | ||
323 | |||
324 | if ((gpio >= 0 && gpio <= 15) || (gpio == 35)) { | ||
325 | if (WAKEMASK(gpio) == 0) | ||
326 | return -EINVAL; | ||
327 | |||
328 | mask = WAKEMASK(gpio); | ||
329 | |||
330 | if (on) { | ||
331 | if (GRER(gpio) | GPIO_bit(gpio)) | ||
332 | PRER |= mask; | ||
333 | else | ||
334 | PRER &= ~mask; | ||
335 | |||
336 | if (GFER(gpio) | GPIO_bit(gpio)) | ||
337 | PFER |= mask; | ||
338 | else | ||
339 | PFER &= ~mask; | ||
340 | } | ||
341 | goto set_pwer; | ||
342 | } | ||
343 | |||
344 | switch (irq) { | ||
345 | case IRQ_RTCAlrm: | ||
346 | mask = PWER_RTC; | ||
347 | break; | ||
348 | case IRQ_USB: | ||
349 | mask = 1u << 26; | ||
350 | break; | ||
351 | default: | ||
352 | return -EINVAL; | ||
353 | } | ||
354 | |||
355 | set_pwer: | ||
356 | if (on) | ||
357 | PWER |= mask; | ||
358 | else | ||
359 | PWER &=~mask; | ||
360 | |||
361 | return 0; | ||
362 | } | ||
363 | |||
364 | void __init pxa27x_init_irq(void) | ||
365 | { | ||
366 | pxa_init_irq_low(); | ||
367 | pxa_init_irq_high(); | ||
368 | pxa_init_irq_gpio(128); | ||
369 | pxa_init_irq_set_wake(pxa27x_set_wake); | ||
370 | } | ||
371 | |||
309 | /* | 372 | /* |
310 | * device registration specific to PXA27x. | 373 | * device registration specific to PXA27x. |
311 | */ | 374 | */ |
@@ -375,13 +438,6 @@ static struct platform_device *devices[] __initdata = { | |||
375 | &pxa27x_device_ohci, | 438 | &pxa27x_device_ohci, |
376 | }; | 439 | }; |
377 | 440 | ||
378 | void __init pxa27x_init_irq(void) | ||
379 | { | ||
380 | pxa_init_irq_low(); | ||
381 | pxa_init_irq_high(); | ||
382 | pxa_init_irq_gpio(128); | ||
383 | } | ||
384 | |||
385 | static int __init pxa27x_init(void) | 441 | static int __init pxa27x_init(void) |
386 | { | 442 | { |
387 | int ret = 0; | 443 | int ret = 0; |