]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/pci/pci-uclass.c
ARM: imx6: clocks: remove function local definitions of mxc_ccm_reg and anatop_regs
[karo-tx-uboot.git] / drivers / pci / pci-uclass.c
index 416027438f1850f518a71be359caed40bf707e00..b25298fb5e9cec04a8a5e383206521049e8c18c3 100644 (file)
@@ -14,6 +14,9 @@
 #include <dm/lists.h>
 #include <dm/root.h>
 #include <dm/device-internal.h>
+#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
+#include <asm/fsp/fsp_support.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -628,6 +631,13 @@ error:
 
 static int pci_uclass_post_bind(struct udevice *bus)
 {
+       /*
+        * If there is no pci device listed in the device tree,
+        * don't bother scanning the device tree.
+        */
+       if (bus->of_offset == -1)
+               return 0;
+
        /*
         * Scan the device tree for devices. This does not probe the PCI bus,
         * as this is not permitted while binding. It just finds devices
@@ -749,6 +759,24 @@ static int pci_uclass_post_probe(struct udevice *bus)
        ret = pci_auto_config_devices(bus);
 #endif
 
+#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
+       /*
+        * Per Intel FSP specification, we should call FSP notify API to
+        * inform FSP that PCI enumeration has been done so that FSP will
+        * do any necessary initialization as required by the chipset's
+        * BIOS Writer's Guide (BWG).
+        *
+        * Unfortunately we have to put this call here as with driver model,
+        * the enumeration is all done on a lazy basis as needed, so until
+        * something is touched on PCI it won't happen.
+        *
+        * Note we only call this 1) after U-Boot is relocated, and 2)
+        * root bus has finished probing.
+        */
+       if ((gd->flags & GD_FLG_RELOC) && (bus->seq == 0))
+               ret = fsp_init_phase_pci();
+#endif
+
        return ret < 0 ? ret : 0;
 }
 
@@ -773,8 +801,8 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
                if (ret != -ENOENT)
                        return -EINVAL;
        } else {
-               /* extract the bdf from fdt_pci_addr */
-               pplat->devfn = addr.phys_hi & 0xffff00;
+               /* extract the devfn from fdt_pci_addr */
+               pplat->devfn = addr.phys_hi & 0xff00;
        }
 
        return 0;