Re: [PATCH v4 3/9] usb: dwc3: Increase timeout for CmdAct cleared by device controller

From: Thinh Nguyen
Date: Fri May 15 2020 - 20:25:23 EST


Hi,

Jun Li wrote:
>> -----Original Message-----
>> From: Felipe Balbi <balbif@xxxxxxxxx> On Behalf Of Felipe Balbi
>> Sent: 2020年5月15日 17:31
>> To: Jun Li <lijun.kernel@xxxxxxxxx>
>> Cc: John Stultz <john.stultz@xxxxxxxxxx>; lkml <linux-kernel@xxxxxxxxxxxxxxx>; Yu
>> Chen <chenyu56@xxxxxxxxxx>; Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; Rob
>> Herring <robh+dt@xxxxxxxxxx>; Mark Rutland <mark.rutland@xxxxxxx>; ShuFan Lee
>> <shufan_lee@xxxxxxxxxxx>; Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>;
>> Suzuki K Poulose <suzuki.poulose@xxxxxxx>; Chunfeng Yun
>> <chunfeng.yun@xxxxxxxxxxxx>; Hans de Goede <hdegoede@xxxxxxxxxx>; Andy Shevchenko
>> <andy.shevchenko@xxxxxxxxx>; Valentin Schneider <valentin.schneider@xxxxxxx>;
>> Jack Pham <jackp@xxxxxxxxxxxxxx>; Linux USB List <linux-usb@xxxxxxxxxxxxxxx>; open
>> list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS <devicetree@xxxxxxxxxxxxxxx>;
>> Peter Chen <peter.chen@xxxxxxx>; Jun Li <jun.li@xxxxxxx>; Thinh Nguyen
>> <Thinh.Nguyen@xxxxxxxxxxxx>
>> Subject: Re: [PATCH v4 3/9] usb: dwc3: Increase timeout for CmdAct cleared by device
>> controller
>>
>>
>> Hi,
>>
>> Jun Li <lijun.kernel@xxxxxxxxx> writes:
>>>> @@ -397,12 +407,18 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned
>> cmd,
>>>> dwc3_gadget_ep_get_transfer_index(dep);
>>>> }
>>>>
>>>> - if (saved_config) {
>>>> + if (saved_hs_config) {
>>>> reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
>>>> - reg |= saved_config;
>>>> + reg |= saved_hs_config;
>>>> dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
>>>> }
>>>>
>>>> + if (saved_ss_config) {
>>>> + reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
>>>> + reg |= saved_ss_config;
>>>> + dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
>>>> + }
>>>> +
>>>> return ret;
>>>> }
>>> Unfortunately this way can't work, once the SS PHY enters P3, disable
>>> suspend_en can't force SS PHY exit P3, unless do this at the very
>>> beginning to prevent SS PHY entering P3(e.g. add "snps,dis_u3_susphy_quirk" for
>> test).
>>
>> It sounds like you have a quirky PHY.
> From what I got from the IC design, the behavior of DWC3_GUSB3PIPECTL_SUSPHY
> bit should be as what I said, not a quirky.
>
> Hi Thinh, could you comment this?

You only need to wake up the usb2 phy when issuing the command while
running in highspeed or below. If you're running in SS or higher,
internally the controller does it for you for usb3 phy. In Jun's case,
it seems like it takes longer for his phy to wake up.

IMO, in this case, I think it's fine to increase the command timeout.

BR,
Thinh