Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[sfrench/cifs-2.6.git] / arch / powerpc / platforms / maple / pci.c
index 63b4d1bff359b226a4dd882efbe8757dfcdd2e07..73c59904697fa00eb1325aa61daa46950f549628 100644 (file)
@@ -425,14 +425,6 @@ static void __init setup_u4_pcie(struct pci_controller* hose)
         hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000);
         hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000);
 
-        /* The bus contains a bridge from root -> device, we need to
-         * make it visible on bus 0 so that we pick the right type
-         * of config cycles. If we didn't, we would have to force all
-         * config cycles to be type 1. So we override the "bus-range"
-         * property here
-         */
-        hose->first_busno = 0x00;
-        hose->last_busno = 0xff;
         u4_pcie = hose;
 }
 
@@ -502,38 +494,29 @@ static int __init add_bridge(struct device_node *dev)
 }
 
 
-void __init maple_pcibios_fixup(void)
+void __devinit maple_pci_irq_fixup(struct pci_dev *dev)
 {
-       struct pci_dev *dev = NULL;
-
-       DBG(" -> maple_pcibios_fixup\n");
-
-       for_each_pci_dev(dev) {
-               /* Fixup IRQ for PCIe host */
-               if (u4_pcie != NULL && dev->bus->number == 0 &&
-                   pci_bus_to_host(dev->bus) == u4_pcie) {
-                       printk(KERN_DEBUG "Fixup U4 PCIe IRQ\n");
-                       dev->irq = irq_create_mapping(NULL, 1);
-                       if (dev->irq != NO_IRQ)
-                               set_irq_type(dev->irq, IRQ_TYPE_LEVEL_LOW);
-                       continue;
-               }
-
-               /* Hide AMD8111 IDE interrupt when in legacy mode so
-                * the driver calls pci_get_legacy_ide_irq()
-                */
-               if (dev->vendor == PCI_VENDOR_ID_AMD &&
-                   dev->device == PCI_DEVICE_ID_AMD_8111_IDE &&
-                   (dev->class & 5) != 5) {
-                       dev->irq = NO_IRQ;
-                       continue;
-               }
+       DBG(" -> maple_pci_irq_fixup\n");
+
+       /* Fixup IRQ for PCIe host */
+       if (u4_pcie != NULL && dev->bus->number == 0 &&
+           pci_bus_to_host(dev->bus) == u4_pcie) {
+               printk(KERN_DEBUG "Fixup U4 PCIe IRQ\n");
+               dev->irq = irq_create_mapping(NULL, 1);
+               if (dev->irq != NO_IRQ)
+                       set_irq_type(dev->irq, IRQ_TYPE_LEVEL_LOW);
+       }
 
-               /* For all others, map the interrupt from the device-tree */
-               pci_read_irq_line(dev);
+       /* Hide AMD8111 IDE interrupt when in legacy mode so
+        * the driver calls pci_get_legacy_ide_irq()
+        */
+       if (dev->vendor == PCI_VENDOR_ID_AMD &&
+           dev->device == PCI_DEVICE_ID_AMD_8111_IDE &&
+           (dev->class & 5) != 5) {
+               dev->irq = NO_IRQ;
        }
 
-       DBG(" <- maple_pcibios_fixup\n");
+       DBG(" <- maple_pci_irq_fixup\n");
 }
 
 static void __init maple_fixup_phb_resources(void)
@@ -569,13 +552,16 @@ void __init maple_pci_init(void)
                return;
        }
        for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) {
-               if (np->name == NULL)
+               if (!np->type)
                        continue;
-               if (strcmp(np->name, "pci") == 0) {
-                       if (add_bridge(np) == 0)
-                               of_node_get(np);
-               }
-               if (strcmp(np->name, "ht") == 0) {
+               if (strcmp(np->type, "pci") && strcmp(np->type, "ht"))
+                       continue;
+               if ((device_is_compatible(np, "u4-pcie") ||
+                    device_is_compatible(np, "u3-agp")) &&
+                   add_bridge(np) == 0)
+                       of_node_get(np);
+
+               if (device_is_compatible(np, "u3-ht")) {
                        of_node_get(np);
                        ht = np;
                }