@@ -17,6 +17,8 @@
#include <linux/io.h>
#include <mach/regs-icu.h>
+#include <mach/regs-apmu.h>
+#include <mach/cputype.h>
#include "common.h"
@@ -42,6 +44,19 @@ static struct irq_chip icu_irq_chip = {
.unmask = icu_unmask_irq,
};
+void handle_pxa168_keypad_irq(unsigned int irq, struct irq_desc *desc)
+{
+ uint32_t val;
+ uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
+
+ /* clear keypad wake event */
+ val = __raw_readl(APMU_WAKE_CLR);
+ __raw_writel(val | mask, APMU_WAKE_CLR);
+
+ /* handle irq */
+ handle_level_irq(irq, desc);
+}
+
void __init icu_init_irq(void)
{
int irq;
@@ -49,7 +64,13 @@ void __init icu_init_irq(void)
for (irq = 0; irq < 64; irq++) {
icu_mask_irq(irq);
set_irq_chip(irq, &icu_irq_chip);
- set_irq_handler(irq, handle_level_irq);
+
+ /* special handler for keypad */
+ if (cpu_is_pxa168() && irq == IRQ_PXA168_KEYPAD)
+ set_irq_handler(irq, handle_pxa168_keypad_irq);
+ else
+ set_irq_handler(irq, handle_level_irq);
+
set_irq_flags(irq, IRQF_VALID);
}
}