Pull release into acpica branch
[pandora-kernel.git] / arch / mips / au1000 / common / irq.c
index ebf93bd..1339a09 100644 (file)
@@ -83,7 +83,7 @@ inline void local_disable_irq(unsigned int irq_nr);
 void   (*board_init_irq)(void);
 
 #ifdef CONFIG_PM
-extern void counter0_irq(int irq, void *dev_id, struct pt_regs *regs);
+extern irqreturn_t counter0_irq(int irq, void *dev_id, struct pt_regs *regs);
 #endif
 
 static DEFINE_SPINLOCK(irq_lock);
@@ -293,8 +293,32 @@ static struct hw_interrupt_type level_irq_type = {
 };
 
 #ifdef CONFIG_PM
-void startup_match20_interrupt(void)
+void startup_match20_interrupt(irqreturn_t (*handler)(int, void *, struct pt_regs *))
 {
+       struct irq_desc *desc = &irq_desc[AU1000_TOY_MATCH2_INT];
+
+       static struct irqaction action;
+       memset(&action, 0, sizeof(struct irqaction));
+
+       /* This is a big problem.... since we didn't use request_irq
+        * when kernel/irq.c calls probe_irq_xxx this interrupt will
+        * be probed for usage. This will end up disabling the device :(
+        * Give it a bogus "action" pointer -- this will keep it from
+        * getting auto-probed!
+        *
+        * By setting the status to match that of request_irq() we
+        * can avoid it.  --cgray
+       */
+       action.dev_id = handler;
+       action.flags = SA_INTERRUPT;
+       cpus_clear(action.mask);
+       action.name = "Au1xxx TOY";
+       action.handler = handler;
+       action.next = NULL;
+
+       desc->action = &action;
+       desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS);
+
        local_enable_irq(AU1000_TOY_MATCH2_INT);
 }
 #endif
@@ -422,7 +446,6 @@ void __init arch_init_irq(void)
        extern int au1xxx_ic0_nr_irqs;
 
        cp0_status = read_c0_status();
-       memset(irq_desc, 0, sizeof(irq_desc));
        set_except_vector(0, au1000_IRQ);
 
        /* Initialize interrupt controllers to a safe state.
@@ -517,17 +540,7 @@ void intc0_req1_irqdispatch(struct pt_regs *regs)
 
        irq = au_ffs(intc0_req1) - 1;
        intc0_req1 &= ~(1<<irq);
-#ifdef CONFIG_PM
-       if (irq == AU1000_TOY_MATCH2_INT) {
-               mask_and_ack_rise_edge_irq(irq);
-               counter0_irq(irq, NULL, regs);
-               local_enable_irq(irq);
-       }
-       else
-#endif
-       {
-               do_IRQ(irq, regs);
-       }
+       do_IRQ(irq, regs);
 }