[PATCH] usb: onboard-hub: Update the bind function based on "peer_hub" property

Patrice CHOTARD patrice.chotard at foss.st.com
Tue Dec 3 15:51:05 CET 2024



On 12/3/24 05:49, Venkatesh Yadav Abbarapu wrote:
> Add the bool variable "peer_hub" and set this only for the
> hubs which have the "peer-hub" property in their DT nodes.
> Skip the bind function for usb hubs which don't have "peer-hub"
> property.
> 
> Fixes: 57e30b09fc ("usb: onboard-hub: Bail out if peer hub is already probed")
> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu at amd.com>
> ---
>  common/usb_onboard_hub.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/common/usb_onboard_hub.c b/common/usb_onboard_hub.c
> index 6f28036e09..0a8fac38ee 100644
> --- a/common/usb_onboard_hub.c
> +++ b/common/usb_onboard_hub.c
> @@ -26,6 +26,7 @@ struct onboard_hub {
>  
>  struct onboard_hub_data {
>  	unsigned long reset_us;
> +	bool peer_hub;
>  	unsigned long power_on_delay_us;
>  	int (*init)(struct udevice *dev);
>  };
> @@ -178,10 +179,15 @@ err:
>  
>  static int usb_onboard_hub_bind(struct udevice *dev)
>  {
> +	struct onboard_hub_data *data =
> +		(struct onboard_hub_data *)dev_get_driver_data(dev);
>  	struct ofnode_phandle_args phandle;
>  	const void *fdt = gd->fdt_blob;
>  	int ret, off;
>  
> +	if (!data->peer_hub)
> +		return 0;
> +
>  	ret = dev_read_phandle_with_args(dev, "peer-hub", NULL, 0, 0, &phandle);
>  	if (ret)  {
>  		dev_err(dev, "peer-hub not specified\n");
> @@ -212,12 +218,14 @@ static int usb_onboard_hub_remove(struct udevice *dev)
>  }
>  
>  static const struct onboard_hub_data usb2514_data = {
> +	.peer_hub = false,
>  	.power_on_delay_us = 500,
>  	.reset_us = 1,
>  };
>  
>  static const struct onboard_hub_data usb5744_data = {
>  	.init = usb5744_i2c_init,
> +	.peer_hub = true,
>  	.power_on_delay_us = 1000,
>  	.reset_us = 5,
>  };

Tested on STM32MP157c-DK2 board

Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard at foss.st.com>

Thanks
Patrice


More information about the U-Boot mailing list