Fix support for PCI devices behind a SSB->PCI bridge.

SVN-Revision: 10468
This commit is contained in:
Michael Büsch 2008-02-16 17:09:50 +00:00
parent 99aaf500ed
commit 939ceadf76
3 changed files with 86 additions and 111 deletions

View File

@ -1,111 +0,0 @@
diff -Naur linux-2.6.23.1.orig/drivers/ssb/b43_pci_bridge.c linux-2.6.23.1/drivers/ssb/b43_pci_bridge.c
--- linux-2.6.23.1.orig/drivers/ssb/b43_pci_bridge.c 2007-11-09 16:48:55.000000000 +0100
+++ linux-2.6.23.1/drivers/ssb/b43_pci_bridge.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,48 +0,0 @@
-/*
- * Broadcom 43xx PCI-SSB bridge module
- *
- * This technically is a seperate PCI driver module, but
- * because of its small size we include it in the SSB core
- * instead of creating a standalone module.
- *
- * Copyright 2007 Michael Buesch <mb@bu3sch.de>
- *
- * Licensed under the GNU/GPL. See COPYING for details.
- */
-
-#include <linux/pci.h>
-#include <linux/ssb/ssb.h>
-
-#include "ssb_private.h"
-
-
-static const struct pci_device_id b43_pci_bridge_tbl[] = {
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4301) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4307) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4311) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4325) },
- { 0, },
-};
-MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl);
-
-static struct pci_driver b43_pci_bridge_driver = {
- .name = "b43-pci-bridge",
- .id_table = b43_pci_bridge_tbl,
-};
-
-
-int __init b43_pci_ssb_bridge_init(void)
-{
- return ssb_pcihost_register(&b43_pci_bridge_driver);
-}
-
-void __exit b43_pci_ssb_bridge_exit(void)
-{
- ssb_pcihost_unregister(&b43_pci_bridge_driver);
-}
diff -Naur linux-2.6.23.1.orig/drivers/ssb/main.c linux-2.6.23.1/drivers/ssb/main.c
--- linux-2.6.23.1.orig/drivers/ssb/main.c 2007-11-09 16:48:55.000000000 +0100
+++ linux-2.6.23.1/drivers/ssb/main.c 2007-11-09 22:11:32.000000000 +0100
@@ -1142,21 +1142,12 @@
if (err)
bus_unregister(&ssb_bustype);
- err = b43_pci_ssb_bridge_init();
- if (err) {
- ssb_printk(KERN_ERR "Broadcom 43xx PCI-SSB-bridge "
- "initialization failed");
- /* don't fail SSB init because of this */
- err = 0;
- }
-
return err;
}
subsys_initcall(ssb_modinit);
static void __exit ssb_modexit(void)
{
- b43_pci_ssb_bridge_exit();
bus_unregister(&ssb_bustype);
}
module_exit(ssb_modexit)
diff -Naur linux-2.6.23.1.orig/drivers/ssb/Makefile linux-2.6.23.1/drivers/ssb/Makefile
--- linux-2.6.23.1.orig/drivers/ssb/Makefile 2007-11-09 16:48:55.000000000 +0100
+++ linux-2.6.23.1/drivers/ssb/Makefile 2007-11-09 22:30:32.000000000 +0100
@@ -11,8 +11,4 @@
ssb-$(CONFIG_SSB_DRIVER_EXTIF) += driver_extif.o
ssb-$(CONFIG_SSB_DRIVER_PCICORE) += driver_pcicore.o
-# b43 pci-ssb-bridge driver
-# Not strictly a part of SSB, but kept here for convenience
-ssb-$(CONFIG_SSB_PCIHOST) += b43_pci_bridge.o
-
obj-$(CONFIG_SSB) += ssb.o
diff -Naur linux-2.6.23.1.orig/drivers/ssb/ssb_private.h linux-2.6.23.1/drivers/ssb/ssb_private.h
--- linux-2.6.23.1.orig/drivers/ssb/ssb_private.h 2007-11-09 16:48:55.000000000 +0100
+++ linux-2.6.23.1/drivers/ssb/ssb_private.h 2007-11-09 22:11:11.000000000 +0100
@@ -119,18 +119,4 @@
extern int ssb_devices_thaw(struct ssb_bus *bus);
extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
-/* b43_pci_bridge.c */
-#ifdef CONFIG_SSB_PCIHOST
-extern int __init b43_pci_ssb_bridge_init(void);
-extern void __exit b43_pci_ssb_bridge_exit(void);
-#else /* CONFIG_SSB_PCIHOST */
-static inline int b43_pci_ssb_bridge_init(void)
-{
- return 0;
-}
-static inline void b43_pci_ssb_bridge_exit(void)
-{
-}
-#endif /* CONFIG_SSB_PCIHOST */
-
#endif /* LINUX_SSB_PRIVATE_H_ */

View File

@ -0,0 +1,65 @@
Index: linux-2.6.23.16/drivers/ssb/driver_pcicore.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_pcicore.c 2008-02-16 17:55:20.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_pcicore.c 2008-02-16 17:55:35.000000000 +0100
@@ -66,6 +66,7 @@ int pcibios_plat_dev_init(struct pci_dev
base = &ssb_pcicore_pcibus_iobase;
else
base = &ssb_pcicore_pcibus_membase;
+ res->flags |= IORESOURCE_PCI_FIXED;
if (res->end) {
size = res->end - res->start + 1;
if (*base & (size - 1))
@@ -88,10 +89,12 @@ int pcibios_plat_dev_init(struct pci_dev
static void __init ssb_fixup_pcibridge(struct pci_dev *dev)
{
+ u8 lat;
+
if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0)
return;
- ssb_printk(KERN_INFO "PCI: fixing up bridge\n");
+ ssb_printk(KERN_INFO "PCI: Fixing up bridge %s\n", pci_name(dev));
/* Enable PCI bridge bus mastering and memory space */
pci_set_master(dev);
@@ -101,7 +104,10 @@ static void __init ssb_fixup_pcibridge(s
pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
/* Make sure our latency is high enough to handle the devices behind us */
- pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xa8);
+ lat = 168;
+ ssb_printk(KERN_INFO "PCI: Fixing latency timer of device %s to %u\n",
+ pci_name(dev), lat);
+ pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
}
DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge);
@@ -279,14 +285,14 @@ static struct resource ssb_pcicore_mem_r
.name = "SSB PCIcore external memory",
.start = SSB_PCI_DMA,
.end = SSB_PCI_DMA + SSB_PCI_DMA_SZ - 1,
- .flags = IORESOURCE_MEM,
+ .flags = IORESOURCE_MEM | IORESOURCE_PCI_FIXED,
};
static struct resource ssb_pcicore_io_resource = {
.name = "SSB PCIcore external I/O",
.start = 0x100,
.end = 0x7FF,
- .flags = IORESOURCE_IO,
+ .flags = IORESOURCE_IO | IORESOURCE_PCI_FIXED,
};
static struct pci_controller ssb_pcicore_controller = {
@@ -344,7 +350,8 @@ static void ssb_pcicore_init_hostmode(st
/* Ok, ready to run, register it to the system.
* The following needs change, if we want to port hostmode
* to non-MIPS platform. */
- set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000));
+ ssb_pcicore_controller.io_map_base = (unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000);
+ set_io_port_base(ssb_pcicore_controller.io_map_base);
/* Give some time to the PCI controller to configure itself with the new
* values. Not waiting at this point causes crashes of the machine. */
mdelay(10);

View File

@ -0,0 +1,21 @@
The SSB pcicore driver does create some MMIO resource collisions.
However, the pcicore PCI-fixup routine fixes these collisions afterwards.
Remove this sanity check for now until we find a better solution.
--mb
Index: linux-2.6.23.16/arch/mips/pci/pci.c
===================================================================
--- linux-2.6.23.16.orig/arch/mips/pci/pci.c 2008-02-16 17:55:20.000000000 +0100
+++ linux-2.6.23.16/arch/mips/pci/pci.c 2008-02-16 17:57:39.000000000 +0100
@@ -177,10 +177,8 @@ static int pcibios_enable_resources(stru
continue;
r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
+ if (!r->start && r->end)
+ printk(KERN_WARNING "PCI: Device %s resource collisions detected. Ignoring...\n", pci_name(dev));
if (r->flags & IORESOURCE_IO)
cmd |= PCI_COMMAND_IO;
if (r->flags & IORESOURCE_MEM)