linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Support for MPIC on native cell
@ 2006-10-16  7:45 Benjamin Herrenschmidt
  2006-10-19 14:38 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-16  7:45 UTC (permalink / raw)
  To: linuxppc-dev list; +Cc: cbe-oss-dev@ozlabs.org

Add support for southbridges using the MPIC interrupt controller to
the native cell platforms.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


Index: linux-cell/arch/powerpc/Kconfig
===================================================================
--- linux-cell.orig/arch/powerpc/Kconfig	2006-10-16 14:48:22.000000000 +1000
+++ linux-cell/arch/powerpc/Kconfig	2006-10-16 14:48:27.000000000 +1000
@@ -461,6 +461,7 @@ config PPC_CELL_NATIVE
 	bool
 	select PPC_CELL
 	select PPC_DCR_MMIO
+	select MPIC
 	default n
 
 config PPC_IBM_CELL_BLADE
Index: linux-cell/arch/powerpc/platforms/cell/setup.c
===================================================================
--- linux-cell.orig/arch/powerpc/platforms/cell/setup.c	2006-10-16 14:46:50.000000000 +1000
+++ linux-cell/arch/powerpc/platforms/cell/setup.c	2006-10-16 14:48:27.000000000 +1000
@@ -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"
@@ -88,10 +89,53 @@ static void __init cell_pcibios_fixup(vo
 		pci_read_irq_line(dev);
 }
 
+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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc: Support for MPIC on native cell
  2006-10-16  7:45 [PATCH] powerpc: Support for MPIC on native cell Benjamin Herrenschmidt
@ 2006-10-19 14:38 ` Arnd Bergmann
  2006-10-19 23:40   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2006-10-19 14:38 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: cbe-oss-dev@ozlabs.org

On Monday 16 October 2006 09:45, Benjamin Herrenschmidt wrote:
> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0/* The MPIC driver will get=
 everything it needs from the
> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 * device-tree, just pass 0=
 to all arguments
> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 */
> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0mpic =3D mpic_alloc(dn, 0, =
0, 0, 0, " MPIC =A0 =A0 ");

Do you expect future users to do the same and just pass zeroes?
If so, maybe we should add a small wrapper like

static inline struct mpic *mpic_probe(struct device_node *dn)
{
	return mpic_alloc(dn, 0, 0, 0, 0, " MPIC     ");
}

in <asm/mpic.h>

	Arnd <><

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc: Support for MPIC on native cell
  2006-10-19 14:38 ` Arnd Bergmann
@ 2006-10-19 23:40   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-19 23:40 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev, cbe-oss-dev@ozlabs.org

On Thu, 2006-10-19 at 16:38 +0200, Arnd Bergmann wrote:
> On Monday 16 October 2006 09:45, Benjamin Herrenschmidt wrote:
> > +               /* 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     ");
> 
> Do you expect future users to do the same and just pass zeroes?
> If so, maybe we should add a small wrapper like
> 
> static inline struct mpic *mpic_probe(struct device_node *dn)
> {
> 	return mpic_alloc(dn, 0, 0, 0, 0, " MPIC     ");
> }

Possibly... there are still flags that it can't figure out by itself,
like segher never put "big-endian" in the SLOF DT of the blades etc...

But yes, I might move in that direction.

Ben.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-19 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-16  7:45 [PATCH] powerpc: Support for MPIC on native cell Benjamin Herrenschmidt
2006-10-19 14:38 ` Arnd Bergmann
2006-10-19 23:40   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).