[POWERPC] Native cell support for MPIC in southbridge
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sat, 11 Nov 2006 06:24:58 +0000 (17:24 +1100)
committerPaul Mackerras <paulus@samba.org>
Mon, 4 Dec 2006 05:08:46 +0000 (16:08 +1100)
Add support for southbridges using the MPIC interrupt controller to
the native cell platforms.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/Kconfig
arch/powerpc/platforms/cell/setup.c

index 0e564d30fc468050b68b0df5e1c2e404563f3054..65588a6bd2fedd0d1e5019996a018bc69ce2da61 100644 (file)
@@ -469,6 +469,7 @@ config PPC_CELL_NATIVE
        bool
        select PPC_CELL
        select PPC_DCR_MMIO
+       select MPIC
        default n
 
 config PPC_IBM_CELL_BLADE
index 1944bb413f04e38e3de051cb7a16b154ba1f4379..13f628def36304565a37678e9f0f7c1a0eadc5f9 100644 (file)
@@ -50,6 +50,7 @@
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
 #include <asm/udbg.h>
+#include <asm/mpic.h>
 
 #include "interrupt.h"
 #include "iommu.h"
@@ -80,10 +81,53 @@ static void cell_progress(char *s, unsigned short hex)
        printk("*** %04x : %s\n", hex, s ? s : "");
 }
 
+static void cell_mpic_cascade(unsigned int irq, struct irq_desc *desc)
+{
+       struct mpic *mpic = desc->handler_data;
+       unsigned int virq;
+
+       virq = mpic_get_one_irq(mpic);
+       if (virq != NO_IRQ)
+               generic_handle_irq(virq);
+       desc->chip->eoi(irq);
+}
+
+static void __init mpic_init_IRQ(void)
+{
+       struct device_node *dn;
+       struct mpic *mpic;
+       unsigned int virq;
+
+       for (dn = NULL;
+            (dn = of_find_node_by_name(dn, "interrupt-controller"));) {
+               if (!device_is_compatible(dn, "CBEA,platform-open-pic"))
+                       continue;
+
+               /* The MPIC driver will get everything it needs from the
+                * device-tree, just pass 0 to all arguments
+                */
+               mpic = mpic_alloc(dn, 0, 0, 0, 0, " MPIC     ");
+               if (mpic == NULL)
+                       continue;
+               mpic_init(mpic);
+
+               virq = irq_of_parse_and_map(dn, 0);
+               if (virq == NO_IRQ)
+                       continue;
+
+               printk(KERN_INFO "%s : hooking up to IRQ %d\n",
+                      dn->full_name, virq);
+               set_irq_data(virq, mpic);
+               set_irq_chained_handler(virq, cell_mpic_cascade);
+       }
+}
+
+
 static void __init cell_init_irq(void)
 {
        iic_init_IRQ();
        spider_init_IRQ();
+       mpic_init_IRQ();
 }
 
 static void __init cell_setup_arch(void)