]> git.sur5r.net Git - u-boot/blobdiff - drivers/pci/pci-uclass.c
dm: pci: Correct bus number when scanning sub-buses
[u-boot] / drivers / pci / pci-uclass.c
index d48d865bac13ef0728afd08647063b44cb778242..edec93f9a47c89296d85d258bf66ce5b5a8eb7c5 100644 (file)
@@ -296,6 +296,7 @@ int pci_auto_config_devices(struct udevice *bus)
             !ret && dev;
             ret = device_find_next_child(&dev)) {
                struct pci_child_platdata *pplat;
+               struct pci_controller *ctlr_hose;
 
                pplat = dev_get_parent_platdata(dev);
                unsigned int max_bus;
@@ -303,7 +304,10 @@ int pci_auto_config_devices(struct udevice *bus)
 
                bdf = PCI_ADD_BUS(bus->seq, pplat->devfn);
                debug("%s: device %s\n", __func__, dev->name);
-               max_bus = pciauto_config_device(hose, bdf);
+
+               /* The root controller has the region information */
+               ctlr_hose = hose->ctlr->uclass_priv;
+               max_bus = pciauto_config_device(ctlr_hose, bdf);
                sub_bus = max(sub_bus, max_bus);
        }
        debug("%s: done\n", __func__);
@@ -330,7 +334,7 @@ int dm_pci_hose_probe_bus(struct pci_controller *hose, pci_dev_t bdf)
 
        sub_bus = pci_get_bus_max() + 1;
        debug("%s: bus = %d/%s\n", __func__, sub_bus, bus->name);
-       pciauto_prescan_setup_bridge(hose, bdf, bus->seq);
+       pciauto_prescan_setup_bridge(hose, bdf, sub_bus);
 
        ret = device_probe(bus);
        if (ret) {
@@ -596,6 +600,7 @@ int pci_bridge_write_config(struct udevice *bus, pci_dev_t devfn, uint offset,
 UCLASS_DRIVER(pci) = {
        .id             = UCLASS_PCI,
        .name           = "pci",
+       .flags          = DM_UC_FLAG_SEQ_ALIAS,
        .post_bind      = pci_uclass_post_bind,
        .pre_probe      = pci_uclass_pre_probe,
        .post_probe     = pci_uclass_post_probe,