struct fdt_pci_addr addr;
int ret;
- int ret;
+ /* 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;
+ }
+
+ return addr.phys_hi & 0xff00;
+ }
+
+ static int pci_uclass_child_post_bind(struct udevice *dev)
+ {
+ struct pci_child_platdata *pplat;
+
if (!dev_of_valid(dev))
return 0;
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 {
- pplat->devfn = addr.phys_hi & 0xff00;
- }
+ pplat->devfn = pci_get_devfn(dev);
- if (ret < 0)
- return ret;
return 0;
}