[FYI/PATCH 1/2] small hacks for running on BPA hardware, v4

Arnd Bergmann arnd at arndb.de
Thu Feb 23 20:41:14 EST 2006


The things done in here are workarounds for
deficiencies in the firmware that will be solved
there in later releases.

Signed-off-by: Arnd Bergmann <arndb at de.ibm.com>

Index: linux-2.6.16-rc/arch/powerpc/platforms/cell/Makefile
===================================================================
--- linux-2.6.16-rc.orig/arch/powerpc/platforms/cell/Makefile
+++ linux-2.6.16-rc/arch/powerpc/platforms/cell/Makefile
@@ -1,5 +1,5 @@
 obj-y			+= interrupt.o iommu.o setup.o spider-pic.o
-obj-y			+= pervasive.o
+obj-y			+= pervasive.o pci.o
 
 obj-$(CONFIG_SMP)	+= smp.o
 obj-$(CONFIG_SPU_FS)	+= spufs/ spu-base.o
Index: linux-2.6.16-rc/arch/powerpc/platforms/cell/pci.c
===================================================================
--- /dev/null
+++ linux-2.6.16-rc/arch/powerpc/platforms/cell/pci.c
@@ -0,0 +1,82 @@
+/*
+ * Cell specific PCI code
+ *
+ * Copyright (C) 2005 IBM Corporation,
+ 			Arnd Bergmann <arndb at de.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+
+#include <asm/prom.h>
+#include <asm/machdep.h>
+#include <asm/pci-bridge.h>
+
+#include "interrupt.h"
+
+void __init cell_final_fixup(void)
+{
+	struct pci_dev *dev = NULL;
+
+	//phbs_remap_io();
+
+	for_each_pci_dev(dev) {
+	// FIXME: fix IRQ numbers for devices on second south bridge
+	}
+}
+
+static void fixup_spider_ipci_irq(struct pci_dev* dev)
+{
+	int irq_node_offset;
+	pr_debug("fixup for %04x:%04x at %02x.%1x: ", dev->vendor, dev->device,
+			 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
+	switch (dev->devfn) {
+		case PCI_DEVFN(3,0):
+			/* ethernet */
+			dev->irq = 8;
+			break;
+		case PCI_DEVFN(5,0):
+			/* OHCI 0 */
+			dev->irq = 10;
+			break;
+		case PCI_DEVFN(6,0):
+			/* OHCI 1 */
+			dev->irq = 11;
+			break;
+		case PCI_DEVFN(5,1):
+			/* EHCI 0 */
+			dev->irq = 10;
+			break;
+		case PCI_DEVFN(6,1):
+			/* EHCI 1 */
+			dev->irq = 11;
+			break;
+	}
+
+	irq_node_offset = IIC_NODE_STRIDE * (pci_domain_nr(dev->bus)-1);
+	dev->irq += irq_node_offset;
+
+	pr_debug("irq %0x\n", dev->irq);
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA_2,
+		PCI_DEVICE_ID_TOSHIBA_SPIDER_NET, fixup_spider_ipci_irq);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA_2,
+		PCI_DEVICE_ID_TOSHIBA_SPIDER_OHCI, fixup_spider_ipci_irq);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA_2,
+		PCI_DEVICE_ID_TOSHIBA_SPIDER_EHCI, fixup_spider_ipci_irq);
Index: linux-2.6.16-rc/arch/powerpc/platforms/cell/setup.c
===================================================================
--- linux-2.6.16-rc.orig/arch/powerpc/platforms/cell/setup.c
+++ linux-2.6.16-rc/arch/powerpc/platforms/cell/setup.c
@@ -58,6 +58,7 @@
 #else
 #define DBG(fmt...)
 #endif
+extern void cell_final_fixup(void);
 
 void cell_show_cpuinfo(struct seq_file *m)
 {
@@ -297,6 +298,7 @@ struct machdep_calls __initdata cell_md 
 	.setup_arch		= cell_setup_arch,
 	.init_early		= cell_init_early,
 	.show_cpuinfo		= cell_show_cpuinfo,
+	.pcibios_fixup		= cell_final_fixup,
 	.restart		= rtas_restart,
 	.power_off		= rtas_power_off,
 	.halt			= rtas_halt,
Index: linux-2.6.16-rc/include/linux/pci_ids.h
===================================================================
--- linux-2.6.16-rc.orig/include/linux/pci_ids.h
+++ linux-2.6.16-rc/include/linux/pci_ids.h
@@ -1367,6 +1367,8 @@
 #define PCI_DEVICE_ID_TOSHIBA_TC35815CF	0x0030
 #define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC	0x0108
 #define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3
+#define PCI_DEVICE_ID_TOSHIBA_SPIDER_OHCI 0x01b6
+#define PCI_DEVICE_ID_TOSHIBA_SPIDER_EHCI 0x01b5
 
 #define PCI_VENDOR_ID_RICOH		0x1180
 #define PCI_DEVICE_ID_RICOH_RL5C465	0x0465
Index: linux-2.6.16-rc/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6.16-rc.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linux-2.6.16-rc/arch/powerpc/platforms/cell/spu_base.c
@@ -534,6 +534,10 @@ static void __iomem * __init map_spe_pro
 
 	prop = p;
 
+	/* FIXME: Firmware bug */
+	if (strcmp (name, "priv2") == 0 && prop->len < 0x20000)
+		return ioremap(prop->address, 0x20000);
+
 	return ioremap(prop->address, prop->len);
 }
 



More information about the Linuxppc64-dev mailing list