[PATCH] usb: dwc3: Add support for usb3-phy PHY configuration

Marek Vasut marex at denx.de
Wed Feb 23 18:31:18 CET 2022


On 2/23/22 15:56, Michal Simek wrote:
> When usb3-phy label is found, PHY driver is called and serdes line is
> initialized. This is preparation for serdes/psgtr driver to configure GT
> lines based on description in DT.
> 
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> ---
> 
>   drivers/usb/dwc3/dwc3-generic.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
> index 01bd0ca190e3..b1e019b5b91a 100644
> --- a/drivers/usb/dwc3/dwc3-generic.c
> +++ b/drivers/usb/dwc3/dwc3-generic.c
> @@ -409,6 +409,17 @@ static int dwc3_glue_probe(struct udevice *dev)
>   	struct udevice *child = NULL;
>   	int index = 0;
>   	int ret;
> +	struct phy phy;
> +
> +	ret = generic_phy_get_by_name(dev, "usb3-phy", &phy);
> +	if (!ret) {
> +		ret = generic_phy_init(&phy);
> +		if (ret)
> +			return ret;
> +	} else if (ret != -ENOENT) {
> +		debug("could not get phy (err %d)\n", ret);
> +		return ret;
> +	}
>   
>   	glue->regs = dev_read_addr(dev);
>   
> @@ -420,6 +431,12 @@ static int dwc3_glue_probe(struct udevice *dev)
>   	if (ret)
>   		return ret;
>   
> +	if (phy.dev) {
> +		ret = generic_phy_power_on(&phy);
> +		if (ret)
> +			return ret;
> +	}
> +
>   	ret = device_find_first_child(dev, &child);
>   	if (ret)
>   		return ret;


CC Bin please.


More information about the U-Boot mailing list