[U-Boot] DWC3 USB driver regression

Masahiro Yamada yamada.masahiro at socionext.com
Wed Apr 25 09:09:14 UTC 2018


Hi Neil.


2018-04-25 17:37 GMT+09:00 Neil Armstrong <narmstrong at baylibre.com>:
> Hi,
>
> On 25/04/2018 06:21, Masahiro Yamada wrote:
>> Hi.
>>
>>
>> I found DWC3 usb driver on UniPhier SoC family
>> not working.
>>
>>
>> I did git-bisect, and the first bad commit is
>>
>>
>> 7c839ea70c4991e8d4c322e074359ac5e155d59d is the first bad commit
>> commit 7c839ea70c4991e8d4c322e074359ac5e155d59d
>> Author: Neil Armstrong <narmstrong at baylibre.com>
>> Date:   Wed Apr 11 17:08:01 2018 +0200
>>
>>     usb: host: dwc3: Add support for multiple PHYs
>>
>>     DWC3 Ips can have more than 1 PHY for USB2 and 1 PHY for USB3, add support
>>     for a generic number of PHYs and adapt the code to handle a generic
>>     number of PHYs.
>>
>>     Signed-off-by: Neil Armstrong <narmstrong at baylibre.com>
>>
>>
>>
>>
>> If I revert this commit, I can get the USB on my board working.
>>
>> Any insight about the cause of the problem?
>>
>>
>>
>
> Can you test this ?
>
> ====><=============================
>
> diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
> index c100735..4e6bf5a 100644
> --- a/drivers/usb/host/xhci-dwc3.c
> +++ b/drivers/usb/host/xhci-dwc3.c
> @@ -113,11 +113,15 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val)
>  }
>
>  #ifdef CONFIG_DM_USB
> -static int xhci_dwc3_setup_phy(struct udevice *dev, int count)
> +static int xhci_dwc3_setup_phy(struct udevice *dev)
>  {
>         struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
> -       int i, ret;
> +       int i, ret, count;
> +
> +       if (!dev_read_prop(dev, "phys", NULL))
> +               return 0;
>
> +       count = dev_count_phandle_with_args(dev, "phys", "#phy-cells");
>         if (!count)
>                 return 0;
>
> @@ -136,7 +140,7 @@ static int xhci_dwc3_setup_phy(struct udevice *dev, int count)
>
>                 ++plat->num_phys;
>         }
> -
> +
>         for (i = 0; i < plat->num_phys; i++) {
>                 ret = generic_phy_init(&plat->usb_phys[i]);
>                 if (ret) {
> @@ -145,7 +149,7 @@ static int xhci_dwc3_setup_phy(struct udevice *dev, int count)
>                         goto phys_init_err;
>                 }
>         }
> -
> +
>         for (i = 0; i < plat->num_phys; i++) {
>                 ret = generic_phy_power_on(&plat->usb_phys[i]);
>                 if (ret) {
> @@ -206,8 +210,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
>         hcor = (struct xhci_hcor *)((uintptr_t)hccr +
>                         HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
>
> -       ret = xhci_dwc3_setup_phy(dev, dev_count_phandle_with_args(
> -                                               dev, "phys", "#phy-cells"));
> +       ret = xhci_dwc3_setup_phy(dev);
>         if (ret)
>                 return ret;
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot



Yeah, it fixed the problem.

In my case, the "phy" property is missing in the DWC3 node,
so dev_count_phandle_with_args() returns a negative error code.

Thanks.



-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list