This patch adds back support for the "hard-coded" configuration of the
Cell IIC controller for machines with a very old firmware. That support
was removed with the port to the new irq mapping mecanism

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

Index: linux-irq-work/arch/powerpc/platforms/cell/interrupt.c
===================================================================
--- linux-irq-work.orig/arch/powerpc/platforms/cell/interrupt.c	2006-07-03 10:02:44.000000000 +1000
+++ linux-irq-work/arch/powerpc/platforms/cell/interrupt.c	2006-07-03 10:02:51.000000000 +1000
@@ -244,6 +244,54 @@
 	       hw_cpu, addr, iic->regs, iic->target_id);
 }
 
+/*
+ * Hardcoded setup part to be compatible with older firmware. We don't
+ * associate a device-node to the hosts in this case, which mean that
+ * no mapping from the device-tree is supposed. That's ok as there is
+ * none anyway
+ */
+static int __init setup_iic_hardcoded(void)
+{
+	struct device_node *np;
+	unsigned int nodeid, cpu;
+	unsigned long regs;
+	struct irq_host *host;
+
+	for_each_possible_cpu(cpu) {
+		nodeid = cpu/2;
+		for (np = of_find_node_by_type(NULL, "cpu");
+		     np; np = of_find_node_by_type(np, "cpu")) {
+			if (nodeid == *(int *)get_property(np,"node-id",NULL))
+				break;
+		}
+		if (!np) {
+			printk(KERN_WARNING "IIC: CPU %d not found\n", cpu);
+			return -ENODEV;
+		}
+		regs = *(long *)get_property(np, "iic", NULL);
+
+		/* hack until we have decided on the devtree info */
+		regs += 0x400;
+		if (cpu & 1)
+			regs += 0x20;
+
+		host = NULL;
+		if (nodeid < IIC_NODE_COUNT) {
+			if ((cpu & 1) == 0) {
+				host = irq_alloc_host(IRQ_HOST_MAP_LINEAR,
+						      IIC_SOURCE_COUNT,
+						      &iic_host_ops,
+						      IIC_IRQ_INVALID);
+				iic_hosts[nodeid] = host;
+			} else
+				host = iic_hosts[nodeid];
+		}
+		init_one_iic(cpu, regs, host);
+	}
+
+	return 0;
+}
+
 static int __init setup_iic(void)
 {
 	struct device_node *dn;
@@ -295,7 +343,7 @@
 {
 	/* Discover and initialize iics */
 	if (setup_iic() < 0)
-		panic("IIC: Failed to initialize !\n");
+		setup_iic_hardcoded();
 
 	/* Set master interrupt handling function */
 	ppc_md.get_irq = iic_get_irq;
