ssb: Fix support for PCI devices behind a SSB->PCI bridge

We must pin all resources and make sure the PCI subsystem
won't relocate us, as the addresses are hardwired into hardware.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by Michael Buesch and committed by John W. Linville fc71acc8 5078ed50

+12 -5
+12 -5
drivers/ssb/driver_pcicore.c
··· 79 79 base = &ssb_pcicore_pcibus_iobase; 80 80 else 81 81 base = &ssb_pcicore_pcibus_membase; 82 + res->flags |= IORESOURCE_PCI_FIXED; 82 83 if (res->end) { 83 84 size = res->end - res->start + 1; 84 85 if (*base & (size - 1)) ··· 102 101 103 102 static void __init ssb_fixup_pcibridge(struct pci_dev *dev) 104 103 { 104 + u8 lat; 105 + 105 106 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0) 106 107 return; 107 108 108 - ssb_printk(KERN_INFO "PCI: fixing up bridge\n"); 109 + ssb_printk(KERN_INFO "PCI: Fixing up bridge %s\n", pci_name(dev)); 109 110 110 111 /* Enable PCI bridge bus mastering and memory space */ 111 112 pci_set_master(dev); ··· 117 114 pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3); 118 115 119 116 /* Make sure our latency is high enough to handle the devices behind us */ 120 - pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xa8); 117 + lat = 168; 118 + ssb_printk(KERN_INFO "PCI: Fixing latency timer of device %s to %u\n", 119 + pci_name(dev), lat); 120 + pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); 121 121 } 122 122 DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge); 123 123 ··· 300 294 .name = "SSB PCIcore external memory", 301 295 .start = SSB_PCI_DMA, 302 296 .end = SSB_PCI_DMA + SSB_PCI_DMA_SZ - 1, 303 - .flags = IORESOURCE_MEM, 297 + .flags = IORESOURCE_MEM | IORESOURCE_PCI_FIXED, 304 298 }; 305 299 306 300 static struct resource ssb_pcicore_io_resource = { 307 301 .name = "SSB PCIcore external I/O", 308 302 .start = 0x100, 309 303 .end = 0x7FF, 310 - .flags = IORESOURCE_IO, 304 + .flags = IORESOURCE_IO | IORESOURCE_PCI_FIXED, 311 305 }; 312 306 313 307 static struct pci_controller ssb_pcicore_controller = { ··· 374 368 /* Ok, ready to run, register it to the system. 375 369 * The following needs change, if we want to port hostmode 376 370 * to non-MIPS platform. */ 377 - set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000)); 371 + ssb_pcicore_controller.io_map_base = (unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000); 372 + set_io_port_base(ssb_pcicore_controller.io_map_base); 378 373 /* Give some time to the PCI controller to configure itself with the new 379 374 * values. Not waiting at this point causes crashes of the machine. */ 380 375 mdelay(10);