Hi Marek, On 11 September 2018 at 14:58, Marek Vasut <marek.va...@gmail.com> wrote: > The PCI controller can have DT subnodes describing extra properties > of particular PCI devices, ie. a PHY attached to an EHCI controller > on a PCI bus. This patch parses those DT subnodes and assigns a node > to the PCI device instance, so that the driver can extract details > from that node and ie. configure the PHY using the PHY subsystem. > > Signed-off-by: Marek Vasut <marek.vasut+rene...@gmail.com> > Cc: Simon Glass <s...@chromium.org> > Cc: Tom Rini <tr...@konsulko.com> > --- > V3: Reword the comment > V2: Move the whole machinery to pci_bind_bus_devices(), right after > the driver instance platform data are updated. This reduces the > number of times the DT is traversed and works for both DT nodes > with and without compat string. > --- > drivers/pci/pci-uclass.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c > index e9671d9b76..ab8818280d 100644 > --- a/drivers/pci/pci-uclass.c > +++ b/drivers/pci/pci-uclass.c > @@ -733,6 +733,7 @@ int pci_bind_bus_devices(struct udevice *bus) > ulong vendor, device; > ulong header_type; > pci_dev_t bdf, end; > + ofnode node; > bool found_multi; > int ret; > > @@ -803,6 +804,20 @@ int pci_bind_bus_devices(struct udevice *bus) > pplat->vendor = vendor; > pplat->device = device; > pplat->class = class; > + > + /* Associate optional OF node */ > + dev_for_each_subnode(node, bus) { > + phys_addr_t df, size; > + df = ofnode_get_addr_size(node, "reg", &size); > + if (df == FDT_ADDR_T_NONE) > + continue; > + > + if (PCI_FUNC(df) == PCI_FUNC(bdf) && > + PCI_DEV(df) == PCI_DEV(bdf)) { > + dev->node = node; > + break; > + } > + } > }
You should only need to do this if dev->node is not already valid. How about: if (!ofnode_valid(dev->node)) find_ofnode_for_dev(dev); then put your code in that fnuction... Regards, Simon _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot