mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
dm: pci: Extract vendor/device id in child_post_bind()
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.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -987,19 +987,18 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
|
|||||||
if (!dev_of_valid(dev))
|
if (!dev_of_valid(dev))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
|
||||||
* We could read vendor, device, class if available. But for now we
|
|
||||||
* just check the address.
|
|
||||||
*/
|
|
||||||
pplat = dev_get_parent_platdata(dev);
|
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",
|
ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG, "reg",
|
||||||
&addr);
|
&addr);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (ret != -ENOENT)
|
if (ret != -ENOENT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
/* extract the devfn from fdt_pci_addr */
|
|
||||||
pplat->devfn = addr.phys_hi & 0xff00;
|
pplat->devfn = addr.phys_hi & 0xff00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user