Pull c2 into release branch
[pandora-kernel.git] / arch / mips / sgi-ip22 / ip22-int.c
index af51889..1834832 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <asm/mipsregs.h>
 #include <asm/addrspace.h>
+#include <asm/irq_cpu.h>
 
 #include <asm/sgi/ioc.h>
 #include <asm/sgi/hpc3.h>
@@ -40,186 +41,86 @@ extern int ip22_eisa_init(void);
 
 static void enable_local0_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
        /* don't allow mappable interrupt to be enabled from setup_irq,
         * we have our own way to do so */
        if (irq != SGI_MAP_0_IRQ)
                sgint->imask0 |= (1 << (irq - SGINT_LOCAL0));
-       local_irq_restore(flags);
-}
-
-static unsigned int startup_local0_irq(unsigned int irq)
-{
-       enable_local0_irq(irq);
-       return 0;               /* Never anything pending  */
 }
 
 static void disable_local0_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
        sgint->imask0 &= ~(1 << (irq - SGINT_LOCAL0));
-       local_irq_restore(flags);
-}
-
-#define shutdown_local0_irq    disable_local0_irq
-#define mask_and_ack_local0_irq        disable_local0_irq
-
-static void end_local0_irq (unsigned int irq)
-{
-       if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-               enable_local0_irq(irq);
 }
 
 static struct irq_chip ip22_local0_irq_type = {
-       .typename       = "IP22 local 0",
-       .startup        = startup_local0_irq,
-       .shutdown       = shutdown_local0_irq,
-       .enable         = enable_local0_irq,
-       .disable        = disable_local0_irq,
-       .ack            = mask_and_ack_local0_irq,
-       .end            = end_local0_irq,
+       .name           = "IP22 local 0",
+       .ack            = disable_local0_irq,
+       .mask           = disable_local0_irq,
+       .mask_ack       = disable_local0_irq,
+       .unmask         = enable_local0_irq,
 };
 
 static void enable_local1_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
        /* don't allow mappable interrupt to be enabled from setup_irq,
         * we have our own way to do so */
        if (irq != SGI_MAP_1_IRQ)
                sgint->imask1 |= (1 << (irq - SGINT_LOCAL1));
-       local_irq_restore(flags);
-}
-
-static unsigned int startup_local1_irq(unsigned int irq)
-{
-       enable_local1_irq(irq);
-       return 0;               /* Never anything pending  */
 }
 
 void disable_local1_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
        sgint->imask1 &= ~(1 << (irq - SGINT_LOCAL1));
-       local_irq_restore(flags);
-}
-
-#define shutdown_local1_irq    disable_local1_irq
-#define mask_and_ack_local1_irq        disable_local1_irq
-
-static void end_local1_irq (unsigned int irq)
-{
-       if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-               enable_local1_irq(irq);
 }
 
 static struct irq_chip ip22_local1_irq_type = {
-       .typename       = "IP22 local 1",
-       .startup        = startup_local1_irq,
-       .shutdown       = shutdown_local1_irq,
-       .enable         = enable_local1_irq,
-       .disable        = disable_local1_irq,
-       .ack            = mask_and_ack_local1_irq,
-       .end            = end_local1_irq,
+       .name           = "IP22 local 1",
+       .ack            = disable_local1_irq,
+       .mask           = disable_local1_irq,
+       .mask_ack       = disable_local1_irq,
+       .unmask         = enable_local1_irq,
 };
 
 static void enable_local2_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
        sgint->imask0 |= (1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0));
        sgint->cmeimask0 |= (1 << (irq - SGINT_LOCAL2));
-       local_irq_restore(flags);
-}
-
-static unsigned int startup_local2_irq(unsigned int irq)
-{
-       enable_local2_irq(irq);
-       return 0;               /* Never anything pending  */
 }
 
 void disable_local2_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
        sgint->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2));
        if (!sgint->cmeimask0)
                sgint->imask0 &= ~(1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0));
-       local_irq_restore(flags);
-}
-
-#define shutdown_local2_irq disable_local2_irq
-#define mask_and_ack_local2_irq        disable_local2_irq
-
-static void end_local2_irq (unsigned int irq)
-{
-       if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-               enable_local2_irq(irq);
 }
 
 static struct irq_chip ip22_local2_irq_type = {
-       .typename       = "IP22 local 2",
-       .startup        = startup_local2_irq,
-       .shutdown       = shutdown_local2_irq,
-       .enable         = enable_local2_irq,
-       .disable        = disable_local2_irq,
-       .ack            = mask_and_ack_local2_irq,
-       .end            = end_local2_irq,
+       .name           = "IP22 local 2",
+       .ack            = disable_local2_irq,
+       .mask           = disable_local2_irq,
+       .mask_ack       = disable_local2_irq,
+       .unmask         = enable_local2_irq,
 };
 
 static void enable_local3_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
        sgint->imask1 |= (1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1));
        sgint->cmeimask1 |= (1 << (irq - SGINT_LOCAL3));
-       local_irq_restore(flags);
-}
-
-static unsigned int startup_local3_irq(unsigned int irq)
-{
-       enable_local3_irq(irq);
-       return 0;               /* Never anything pending  */
 }
 
 void disable_local3_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
        sgint->cmeimask1 &= ~(1 << (irq - SGINT_LOCAL3));
        if (!sgint->cmeimask1)
                sgint->imask1 &= ~(1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1));
-       local_irq_restore(flags);
-}
-
-#define shutdown_local3_irq disable_local3_irq
-#define mask_and_ack_local3_irq        disable_local3_irq
-
-static void end_local3_irq (unsigned int irq)
-{
-       if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-               enable_local3_irq(irq);
 }
 
 static struct irq_chip ip22_local3_irq_type = {
-       .typename       = "IP22 local 3",
-       .startup        = startup_local3_irq,
-       .shutdown       = shutdown_local3_irq,
-       .enable         = enable_local3_irq,
-       .disable        = disable_local3_irq,
-       .ack            = mask_and_ack_local3_irq,
-       .end            = end_local3_irq,
+       .name           = "IP22 local 3",
+       .ack            = disable_local3_irq,
+       .mask           = disable_local3_irq,
+       .mask_ack       = disable_local3_irq,
+       .unmask         = enable_local3_irq,
 };
 
 static void indy_local0_irqdispatch(void)
@@ -336,7 +237,7 @@ extern void indy_8254timer_irq(void);
 
 asmlinkage void plat_irq_dispatch(void)
 {
-       unsigned int pending = read_c0_cause();
+       unsigned int pending = read_c0_status() & read_c0_cause();
 
        /*
         * First we check for r4k counter/timer IRQ.
@@ -353,8 +254,6 @@ asmlinkage void plat_irq_dispatch(void)
                indy_8254timer_irq();
 }
 
-extern void mips_cpu_irq_init(unsigned int irq_base);
-
 void __init arch_init_irq(void)
 {
        int i;
@@ -416,7 +315,7 @@ void __init arch_init_irq(void)
        sgint->cmeimask1 = 0;
 
        /* init CPU irqs */
-       mips_cpu_irq_init(SGINT_CPU);
+       mips_cpu_irq_init();
 
        for (i = SGINT_LOCAL0; i < SGI_INTERRUPTS; i++) {
                struct irq_chip *handler;
@@ -430,10 +329,7 @@ void __init arch_init_irq(void)
                else
                        handler         = &ip22_local3_irq_type;
 
-               irq_desc[i].status      = IRQ_DISABLED;
-               irq_desc[i].action      = 0;
-               irq_desc[i].depth       = 1;
-               irq_desc[i].chip        = handler;
+               set_irq_chip_and_handler(i, handler, handle_level_irq);
        }
 
        /* vector handler. this register the IRQ as non-sharable */