[PATCH v3 1/7] usb: onboard-hub: Add reset-gpio support

Marek Vasut marex at denx.de
Tue Oct 1 13:57:01 CEST 2024


On 10/1/24 7:05 AM, Venkatesh Yadav Abbarapu wrote:

[...]

> @@ -30,7 +40,24 @@ static int usb_onboard_hub_probe(struct udevice *dev)
>   	if (ret)
>   		dev_err(dev, "can't enable vdd-supply: %d\n", ret);
>   
> -	return ret;
> +	hub->reset_gpio = devm_gpiod_get_optional(dev, "reset",
> +						  GPIOD_IS_OUT | GPIOD_ACTIVE_LOW);
> +	/* property is optional, don't return error! */
> +	if (hub->reset_gpio) {

if (!hub->reset_gpio)
   return 0;

to reduce indent .

> +		ret = dm_gpio_set_value(hub->reset_gpio, 1);
> +		if (ret)
> +			return ret;
> +
> +		udelay(data->reset_us);
> +
> +		ret = dm_gpio_set_value(hub->reset_gpio, 0);
> +		if (ret)
> +			return ret;
> +
> +		udelay(data->power_on_delay_us);
> +	}
> +
> +	return 0;
>   }
[...]


More information about the U-Boot mailing list