diff options
author | Mike Rapoport <mike@compulab.co.il> | 2009-11-11 04:36:59 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-11-30 20:02:58 -0500 |
commit | bf293aec15fb223fd81c0cdfd1829edff95a325b (patch) | |
tree | 92ab607c731ba2694dd6046df29648db5740429e /arch/arm/mach-pxa/pxa3xx.c | |
parent | 15cc7112abb66e7e1c956135ba2390638acf3416 (diff) |
[ARM] pxa: add EXT_WAKEUP interrupts handling for pxa3xx
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/pxa3xx.c')
-rw-r--r-- | arch/arm/mach-pxa/pxa3xx.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 3198680626ec..fcb0721f4669 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <mach/pm.h> | 30 | #include <mach/pm.h> |
31 | #include <mach/dma.h> | 31 | #include <mach/dma.h> |
32 | #include <mach/ssp.h> | 32 | #include <mach/ssp.h> |
33 | #include <mach/regs-intc.h> | ||
33 | #include <plat/i2c.h> | 34 | #include <plat/i2c.h> |
34 | 35 | ||
35 | #include "generic.h" | 36 | #include "generic.h" |
@@ -45,6 +46,9 @@ | |||
45 | #define ACCR_D0CS (1 << 26) | 46 | #define ACCR_D0CS (1 << 26) |
46 | #define ACCR_PCCE (1 << 11) | 47 | #define ACCR_PCCE (1 << 11) |
47 | 48 | ||
49 | #define PECR_IE(n) ((1 << ((n) * 2)) << 28) | ||
50 | #define PECR_IS(n) ((1 << ((n) * 2)) << 29) | ||
51 | |||
48 | /* crystal frequency to static memory controller multiplier (SMCFS) */ | 52 | /* crystal frequency to static memory controller multiplier (SMCFS) */ |
49 | static unsigned char smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, }; | 53 | static unsigned char smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, }; |
50 | 54 | ||
@@ -532,6 +536,43 @@ static inline void pxa3xx_init_pm(void) {} | |||
532 | #define pxa3xx_set_wake NULL | 536 | #define pxa3xx_set_wake NULL |
533 | #endif | 537 | #endif |
534 | 538 | ||
539 | static void pxa_ack_ext_wakeup(unsigned int irq) | ||
540 | { | ||
541 | PECR |= PECR_IS(irq - IRQ_WAKEUP0); | ||
542 | } | ||
543 | |||
544 | static void pxa_mask_ext_wakeup(unsigned int irq) | ||
545 | { | ||
546 | ICMR2 &= ~(1 << ((irq - PXA_IRQ(0)) & 0x1f)); | ||
547 | PECR &= ~PECR_IE(irq - IRQ_WAKEUP0); | ||
548 | } | ||
549 | |||
550 | static void pxa_unmask_ext_wakeup(unsigned int irq) | ||
551 | { | ||
552 | ICMR2 |= 1 << ((irq - PXA_IRQ(0)) & 0x1f); | ||
553 | PECR |= PECR_IE(irq - IRQ_WAKEUP0); | ||
554 | } | ||
555 | |||
556 | static struct irq_chip pxa_ext_wakeup_chip = { | ||
557 | .name = "WAKEUP", | ||
558 | .ack = pxa_ack_ext_wakeup, | ||
559 | .mask = pxa_mask_ext_wakeup, | ||
560 | .unmask = pxa_unmask_ext_wakeup, | ||
561 | }; | ||
562 | |||
563 | static void __init pxa_init_ext_wakeup_irq(set_wake_t fn) | ||
564 | { | ||
565 | int irq; | ||
566 | |||
567 | for (irq = IRQ_WAKEUP0; irq <= IRQ_WAKEUP1; irq++) { | ||
568 | set_irq_chip(irq, &pxa_ext_wakeup_chip); | ||
569 | set_irq_handler(irq, handle_edge_irq); | ||
570 | set_irq_flags(irq, IRQF_VALID); | ||
571 | } | ||
572 | |||
573 | pxa_ext_wakeup_chip.set_wake = fn; | ||
574 | } | ||
575 | |||
535 | void __init pxa3xx_init_irq(void) | 576 | void __init pxa3xx_init_irq(void) |
536 | { | 577 | { |
537 | /* enable CP6 access */ | 578 | /* enable CP6 access */ |
@@ -541,6 +582,7 @@ void __init pxa3xx_init_irq(void) | |||
541 | __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); | 582 | __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); |
542 | 583 | ||
543 | pxa_init_irq(56, pxa3xx_set_wake); | 584 | pxa_init_irq(56, pxa3xx_set_wake); |
585 | pxa_init_ext_wakeup_irq(pxa3xx_set_wake); | ||
544 | pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL); | 586 | pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL); |
545 | } | 587 | } |
546 | 588 | ||