Currently only devfn is extracted in child_post_bind(). Now that
we have the live-tree version API to look up PCI vendor and device
id from the compatible string, let's extract and save them too.

Signed-off-by: Bin Meng <bmeng...@gmail.com>
---

Changes in v2: None

 drivers/pci/pci-uclass.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 46e9c71..b2909a3 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -987,19 +987,18 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
        if (!dev_of_valid(dev))
                return 0;
 
-       /*
-        * We could read vendor, device, class if available. But for now we
-        * just check the address.
-        */
        pplat = dev_get_parent_platdata(dev);
+
+       /* Extract vendor id and device id if available */
+       ofnode_read_pci_vendev(dev_ofnode(dev), &pplat->vendor, &pplat->device);
+
+       /* Extract the devfn from fdt_pci_addr */
        ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG, "reg",
                                   &addr);
-
        if (ret) {
                if (ret != -ENOENT)
                        return -EINVAL;
        } else {
-               /* extract the devfn from fdt_pci_addr */
                pplat->devfn = addr.phys_hi & 0xff00;
        }
 
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to