Subject: small hacks for running on BPA hardware, v3 This patch is not meant for inclusion in a generic kernel, but is currently needed to support the available HW. Most of the things done in here are workarounds for deficiencies in the present hardware or firmware that will be solved there in later releases. Signed-off-by: Arnd Bergmann --- Index: linus-2.6/arch/powerpc/platforms/cell/Makefile =================================================================== --- linus-2.6.orig/arch/powerpc/platforms/cell/Makefile +++ linus-2.6/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) += spu-base.o spufs/ Index: linus-2.6/arch/powerpc/platforms/cell/pci.c =================================================================== --- /dev/null +++ linus-2.6/arch/powerpc/platforms/cell/pci.c @@ -0,0 +1,82 @@ +/* + * Cell specific PCI code + * + * Copyright (C) 2005 IBM Corporation, + Arnd Bergmann + * + * 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 +#include +#include + +#include +#include +#include + +#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: linus-2.6/arch/powerpc/platforms/cell/setup.c =================================================================== --- linus-2.6.orig/arch/powerpc/platforms/cell/setup.c +++ linus-2.6/arch/powerpc/platforms/cell/setup.c @@ -56,6 +56,7 @@ #else #define DBG(fmt...) #endif +extern void cell_final_fixup(void); static void cell_show_cpuinfo(struct seq_file *m) { @@ -217,6 +218,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: linus-2.6/include/linux/pci_ids.h =================================================================== --- linus-2.6.orig/include/linux/pci_ids.h +++ linus-2.6/include/linux/pci_ids.h @@ -1393,6 +1393,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: linus-2.6/arch/powerpc/platforms/cell/spu_base.c =================================================================== --- linus-2.6.orig/arch/powerpc/platforms/cell/spu_base.c +++ linus-2.6/arch/powerpc/platforms/cell/spu_base.c @@ -533,6 +533,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); }