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

Jan Kiszka jan.kiszka at siemens.com
Mon Apr 25 12:05:53 CEST 2022


On 25.04.22 11:56, Michal Simek wrote:
> Hi Jan,
> 
> On 4/25/22 11:47, Jan Kiszka wrote:
>> On 09.03.22 10:05, 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>
>>> ---
>>>
>>> Changes in v3:
>>> - Add cover letter
>>>
>>> Changes in v2:
>>> - Add missing header
>>>
>>>   drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++
>>>   1 file changed, 18 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc3/dwc3-generic.c
>>> b/drivers/usb/dwc3/dwc3-generic.c
>>> index 01bd0ca190e3..2c5205df62cd 100644
>>> --- a/drivers/usb/dwc3/dwc3-generic.c
>>> +++ b/drivers/usb/dwc3/dwc3-generic.c
>>> @@ -14,6 +14,7 @@
>>>   #include <dm/device-internal.h>
>>>   #include <dm/lists.h>
>>>   #include <dwc3-uboot.h>
>>> +#include <generic-phy.h>
>>>   #include <linux/bitops.h>
>>>   #include <linux/delay.h>
>>>   #include <linux/usb/ch9.h>
>>> @@ -409,6 +410,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 +432,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;
>>
>> Breaks USB on the iot2050-pg1 (am65x) - this one has NO usb3-phy:
>>
>> ...
>> starting USB...
>> Bus usb at 10000: probe failed, error -61
>> Bus usb at 10000: probe failed, error -61
>> No working controllers found
>> USB is stopped. Please issue 'usb start' first.
>> starting USB...
>> Bus usb at 10000: probe failed, error -61
>> Bus usb at 10000: probe failed, error -61
>> No working controllers found
>> USB is stopped. Please issue 'usb start' first.
>> starting USB...
>> Bus usb at 10000: probe failed, error -61
>> Bus usb at 10000: probe failed, error -61
>> No working controllers found
>> USB is stopped. Please issue 'usb start' first.
>>
>> Is there anything that boards need to consider now?
> 
> -61 is ENODATA. I have looked at DT and there is no usb3-phy property.
> That's why generic_phy_get_by_name() can't return 0. Does it return
> -ENOENT?
> 
> Maybe it returns ENODATA and it should be also handled in else part.
> 
> Can you please enable debug and see?
> 

#define DEBUG in the patched file or where?

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


More information about the U-Boot mailing list