powerpc/pci: Delay populating pdn
[cascardo/linux.git] / arch / powerpc / platforms / maple / pci.c
index a923230..a2f89e6 100644 (file)
@@ -568,6 +568,26 @@ void maple_pci_irq_fixup(struct pci_dev *dev)
        DBG(" <- maple_pci_irq_fixup\n");
 }
 
+static int maple_pci_root_bridge_prepare(struct pci_host_bridge *bridge)
+{
+       struct pci_controller *hose = pci_bus_to_host(bridge->bus);
+       struct device_node *np, *child;
+
+       if (hose != u3_agp)
+               return 0;
+
+       /* Fixup the PCI<->OF mapping for U3 AGP due to bus renumbering. We
+        * assume there is no P2P bridge on the AGP bus, which should be a
+        * safe assumptions hopefully.
+        */
+       np = hose->dn;
+       PCI_DN(np)->busno = 0xf0;
+       for_each_child_of_node(np, child)
+               PCI_DN(child)->busno = 0xf0;
+
+       return 0;
+}
+
 void __init maple_pci_init(void)
 {
        struct device_node *np, *root;
@@ -605,19 +625,7 @@ void __init maple_pci_init(void)
        if (ht && maple_add_bridge(ht) != 0)
                of_node_put(ht);
 
-       /* Setup the linkage between OF nodes and PHBs */ 
-       pci_devs_phb_init();
-
-       /* Fixup the PCI<->OF mapping for U3 AGP due to bus renumbering. We
-        * assume there is no P2P bridge on the AGP bus, which should be a
-        * safe assumptions hopefully.
-        */
-       if (u3_agp) {
-               struct device_node *np = u3_agp->dn;
-               PCI_DN(np)->busno = 0xf0;
-               for (np = np->child; np; np = np->sibling)
-                       PCI_DN(np)->busno = 0xf0;
-       }
+       ppc_md.pcibios_root_bridge_prepare = maple_pci_root_bridge_prepare;
 
        /* Tell pci.c to not change any resource allocations.  */
        pci_add_flags(PCI_PROBE_ONLY);