]> git.sur5r.net Git - u-boot/blobdiff - drivers/pci/pci-uclass.c
spi: zynq_[q]spi: Use BIT macro
[u-boot] / drivers / pci / pci-uclass.c
index 2f4368fa1bf762fdfba1c6e80ef668ee7c6c13e3..1d93194b6755474ff18f7422c37fa7bf533074ec 100644 (file)
@@ -85,30 +85,7 @@ static int pci_get_bus_max(void)
 
 int pci_last_busno(void)
 {
-       struct pci_controller *hose;
-       struct udevice *bus;
-       struct uclass *uc;
-       int ret;
-
-       debug("pci_last_busno\n");
-       ret = uclass_get(UCLASS_PCI, &uc);
-       if (ret || list_empty(&uc->dev_head))
-               return -1;
-
-       /* Probe the last bus */
-       bus = list_entry(uc->dev_head.prev, struct udevice, uclass_node);
-       debug("bus = %p, %s\n", bus, bus->name);
-       assert(bus);
-       ret = device_probe(bus);
-       if (ret)
-               return ret;
-
-       /* If that bus has bridges, we may have new buses now. Get the last */
-       bus = list_entry(uc->dev_head.prev, struct udevice, uclass_node);
-       hose = dev_get_uclass_priv(bus);
-       debug("bus = %s, hose = %p\n", bus->name, hose);
-
-       return hose->last_busno;
+       return pci_get_bus_max();
 }
 
 int pci_get_ff(enum pci_size_t size)
@@ -387,9 +364,23 @@ int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep)
        return 0;
 }
 
+static void set_vga_bridge_bits(struct udevice *dev)
+{
+       struct udevice *parent = dev->parent;
+       u16 bc;
+
+       while (parent->seq != 0) {
+               dm_pci_read_config16(parent, PCI_BRIDGE_CONTROL, &bc);
+               bc |= PCI_BRIDGE_CTL_VGA;
+               dm_pci_write_config16(parent, PCI_BRIDGE_CONTROL, bc);
+               parent = parent->parent;
+       }
+}
+
 int pci_auto_config_devices(struct udevice *bus)
 {
        struct pci_controller *hose = bus->uclass_priv;
+       struct pci_child_platdata *pplat;
        unsigned int sub_bus;
        struct udevice *dev;
        int ret;
@@ -409,6 +400,10 @@ int pci_auto_config_devices(struct udevice *bus)
                        return ret;
                max_bus = ret;
                sub_bus = max(sub_bus, max_bus);
+
+               pplat = dev_get_parent_platdata(dev);
+               if (pplat->class == (PCI_CLASS_DISPLAY_VGA << 8))
+                       set_vga_bridge_bits(dev);
        }
        debug("%s: done\n", __func__);