usb: ehci: Fix db410c usb reset not working

Marek Vasut marex at denx.de
Mon Aug 19 13:21:22 CEST 2024


On 8/19/24 4:05 AM, JianfengA.Zhu at sony.com wrote:
> usb reset not working error log
> ====================================================================
> dragonboard410c => usb reset
> resetting USB...
> Bus usb at 78d9000: Port not available.
> dragonboard410c =>
> ====================================================================
> 
> After commit ed8fbd2889fc ("dts: msm8916: replace with upstream DTS")
> msm8916_usbphy will be defined as a child device of usb at 78d9000. usb reset
> will first call usb_stop, and msm8916_usbphy as child dev will be unbind
> in usb_stop, and there is no bind operation in do_usb_start afterwards, so
> the msm8916_usbphy uclass cannot be found. This causes ehci_msm probe to
> fail.
> 
> Detailed calling process
> ====================================================================
> usb reset:
> |-> usb_stop (drivers/usb/host/usb-uclass.c)
> .|-> device_find_first_child
> . |-> device_unbind(rh); <== (unbind msm8916_usbphy)
> |-> do_usb_start
>   |-> usb_init (drivers/usb/host/usb-uclass.c)
>    |-> device_probe(bus);
>     |-> ehci_usb_probe
>      |-> generic_setup_phy <== err couldn't find msm8916_usbphy
> ====================================================================
> 
> Fix: rebind the msm8916_usbphy driver during ehci_usb_probe if the
> msm8916_usbphy uclass has been removed.
> 
> Signed-off-by: Jianfeng Zhu <JianfengA.Zhu at sony.com>
> Reviewed-by: Jacky Cao <Jacky.Cao at sony.com>
> Reviewed-by: Toyama, Yoshihiro <Yoshihiro.Toyama at sony.com>
> ---
>   drivers/usb/host/ehci-msm.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
> index ff336082e3..7cb3ae0849 100644
> --- a/drivers/usb/host/ehci-msm.c
> +++ b/drivers/usb/host/ehci-msm.c
> @@ -47,6 +47,8 @@ static const struct ehci_ops msm_ehci_ops = {
>   	.init_after_reset = msm_init_after_reset
>   };
>   
> +static int ehci_usb_of_bind(struct udevice *dev);
> +
>   static int ehci_usb_probe(struct udevice *dev)
>   {
>   	struct msm_ehci_priv *p = dev_get_priv(dev);
> @@ -54,6 +56,7 @@ static int ehci_usb_probe(struct udevice *dev)
>   	struct usb_plat *plat = dev_get_plat(dev);
>   	struct ehci_hccr *hccr;
>   	struct ehci_hcor *hcor;
> +	struct udevice *phydev;
>   	int ret;
>   
>   	ret = clk_get_by_name(dev, "core", &p->core_clk);
> @@ -80,6 +83,10 @@ static int ehci_usb_probe(struct udevice *dev)
>   	hcor = (struct ehci_hcor *)((phys_addr_t)hccr +
>   			HC_LENGTH(ehci_readl(&(hccr)->cr_capbase)));
>   
> +	ret = uclass_get_device_by_name(UCLASS_PHY, "msm8916_usbphy", &phydev);

Thanks for looking into this.

Caleb, do you know why generic_setup_phy() started failing now ? Can it 
be fixed to handle this platform instead ?


More information about the U-Boot mailing list