On 8/19/24 4:05 AM, jianfenga....@sony.com wrote:
usb reset not working error log
====================================================================
dragonboard410c => usb reset
resetting USB...
Bus usb@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@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....@sony.com>
Reviewed-by: Jacky Cao <jacky....@sony.com>
Reviewed-by: Toyama, Yoshihiro <yoshihiro.toy...@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 ?

Reply via email to