]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
[ARM] pxa: add EXT_WAKEUP interrupts handling for pxa3xx
authorMike Rapoport <mike@compulab.co.il>
Wed, 11 Nov 2009 09:36:59 +0000 (11:36 +0200)
committerEric Miao <eric.y.miao@gmail.com>
Tue, 1 Dec 2009 01:02:58 +0000 (09:02 +0800)
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
arch/arm/mach-pxa/pxa3xx.c

index 3198680626ecbf6e92d909ed89f547895c5d0f25..fcb0721f466947f221c447f235846841204f8bf8 100644 (file)
@@ -30,6 +30,7 @@
 #include <mach/pm.h>
 #include <mach/dma.h>
 #include <mach/ssp.h>
+#include <mach/regs-intc.h>
 #include <plat/i2c.h>
 
 #include "generic.h"
@@ -45,6 +46,9 @@
 #define ACCR_D0CS      (1 << 26)
 #define ACCR_PCCE      (1 << 11)
 
+#define PECR_IE(n)     ((1 << ((n) * 2)) << 28)
+#define PECR_IS(n)     ((1 << ((n) * 2)) << 29)
+
 /* crystal frequency to static memory controller multiplier (SMCFS) */
 static unsigned char smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, };
 
@@ -532,6 +536,43 @@ static inline void pxa3xx_init_pm(void) {}
 #define pxa3xx_set_wake        NULL
 #endif
 
+static void pxa_ack_ext_wakeup(unsigned int irq)
+{
+       PECR |= PECR_IS(irq - IRQ_WAKEUP0);
+}
+
+static void pxa_mask_ext_wakeup(unsigned int irq)
+{
+       ICMR2 &= ~(1 << ((irq - PXA_IRQ(0)) & 0x1f));
+       PECR &= ~PECR_IE(irq - IRQ_WAKEUP0);
+}
+
+static void pxa_unmask_ext_wakeup(unsigned int irq)
+{
+       ICMR2 |= 1 << ((irq - PXA_IRQ(0)) & 0x1f);
+       PECR |= PECR_IE(irq - IRQ_WAKEUP0);
+}
+
+static struct irq_chip pxa_ext_wakeup_chip = {
+       .name           = "WAKEUP",
+       .ack            = pxa_ack_ext_wakeup,
+       .mask           = pxa_mask_ext_wakeup,
+       .unmask         = pxa_unmask_ext_wakeup,
+};
+
+static void __init pxa_init_ext_wakeup_irq(set_wake_t fn)
+{
+       int irq;
+
+       for (irq = IRQ_WAKEUP0; irq <= IRQ_WAKEUP1; irq++) {
+               set_irq_chip(irq, &pxa_ext_wakeup_chip);
+               set_irq_handler(irq, handle_edge_irq);
+               set_irq_flags(irq, IRQF_VALID);
+       }
+
+       pxa_ext_wakeup_chip.set_wake = fn;
+}
+
 void __init pxa3xx_init_irq(void)
 {
        /* enable CP6 access */
@@ -541,6 +582,7 @@ void __init pxa3xx_init_irq(void)
        __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value));
 
        pxa_init_irq(56, pxa3xx_set_wake);
+       pxa_init_ext_wakeup_irq(pxa3xx_set_wake);
        pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
 }