[U-Boot] [PATCH V2 1/2] pci: Support parsing PCI controller DT subnodes

Marek Vasut marek.vasut at gmail.com
Wed Aug 29 14:21:51 UTC 2018


On 08/24/2018 08:27 PM, Marek Vasut 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+renesas at gmail.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>

Well, bump ?

This is the only missing patch to get my hardware working properly.

> ---
> 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..cf3e38a6f2 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 potention 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;
> +			}
> +		}
>  	}
>  
>  	return 0;
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list