Re: [PATCH v2 1/5] usb: dwc2: bus suspend/resume for hosts with DWC2_POWER_DOWN_PARAM_NONE

From: Artur Petrosyan
Date: Tue May 07 2019 - 03:06:42 EST


Hi,

On 5/3/2019 19:08, Doug Anderson wrote:
> Hi,
>
> On Fri, May 3, 2019 at 1:25 AM Artur Petrosyan
> <Arthur.Petrosyan@xxxxxxxxxxxx> wrote:
>>
>> On 5/2/2019 03:58, Doug Anderson wrote:
>>> Hi,
>>>
>>>
>>> On Wed, Apr 17, 2019 at 5:15 PM Douglas Anderson <dianders@xxxxxxxxxxxx> wrote:
>>>>
>>>> This is an attempt to rehash commit 0cf884e819e0 ("usb: dwc2: add bus
>>>> suspend/resume for dwc2") on ToT. That commit was reverted in commit
>>>> b0bb9bb6ce01 ("Revert "usb: dwc2: add bus suspend/resume for dwc2"")
>>>> because apparently it broke the Altera SOCFPGA.
>>>>
>>>> With all the changes that have happened to dwc2 in the meantime, it's
>>>> possible that the Altera SOCFPGA will just magically work with this
>>>> change now. ...and it would be good to get bus suspend/resume
>>>> implemented.
>>>>
>>>> This change is a forward port of one that's been living in the Chrome
>>>> OS 3.14 kernel tree.
>>>>
>>>> Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
>>>> ---
>>>> This patch was last posted at:
>>>>
>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lkml.kernel.org_r_1446237173-2D15263-2D1-2Dgit-2Dsend-2Demail-2Ddianders-40chromium.org&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=9hPBFKCJ_nBjJhGVrrlYOeOQjP_HlVzYqrC_D7niMJI&m=7rxT8EFX9mqUDtTL4P7iuzYNsYROe9rxHGCresSKPTg&s=lTaNUA2XIYPat417fkd1A4Zpvb5eyYtTc1H_NIfW8Vw&e=
>>>>
>>>> ...and appears to have died the death of silence. Maybe it could get
>>>> some bake time in linuxnext if we can't find any proactive testing?
>>>>
>>>> I will also freely admit that I don't know tons about the theory
>>>> behind this patch. I'm mostly just re-hashing the original commit
>>>> from Kever that was reverted since:
>>>> * Turning on partial power down on rk3288 doesn't "just work". I
>>>> don't get hotplug events. This is despite dwc2 auto-detecting that
>>>> we are power optimized.
>>>> * If we don't do something like this commit we don't get into as low
>>>> of a power mode.
>>>
>>> OK, I spent the day digging more into this patch to confirm that it's
>>> really the right thing to do. ...and it still seems to be.
>>>
>>> First off: I'm pretty sure the above sentence "If we don't do
>>> something like this commit we don't get into as low of a power mode."
>>> is totally wrong. Luckily it's "after the cut" and not part of the
>>> commit message. Specifically I did a bunch of power testing and I
>>> couldn't find any instance saving power after this patch.
>>>
>>> ...but, then I looked more carefully at all the history of this
>>> commit. I ended up at:
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__chromium-2Dreview.googlesource.com_c_chromiumos_third-5Fparty_kernel_-2B_306265_&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=9hPBFKCJ_nBjJhGVrrlYOeOQjP_HlVzYqrC_D7niMJI&m=7rxT8EFX9mqUDtTL4P7iuzYNsYROe9rxHGCresSKPTg&s=LiyyIyaCPmr88nJeI7TCGtoJBFLRWir_reikYtAHHDw&e=
>> Looking at this code review I see that this patch fixes whatever issues
>> you have on Chrome OS 3.14. But your patch has landed on the top of
>> latest Kernel version. With the latest version I think you would not
>> have the regression issue.
>> So you are fixing Chrome OS 3.14.
>
> I'm confused why you ignored the rest of my email where I said I also
> ported it to 4.19 (which, from a dwc2 host point of view, is pretty
> much mainline) and saw that the patch was still needed.
I didn't ignore it just I had to perform testes and reply to it with
another email.
>
> -Doug
>
I spent yesterday debugging and performing testes with Linux Mainline.
So when we don't have any of power saving modes supported and the
power_down is DWC2_POWER_DOWN_PARAM_NONE. We can set "PCGCTL_STOPPCLK"
bit whenever there is suspend ( Checked the programming guide and data
book). I have not seen any case that this affects the flow. I have not
been able to see if after setting "PCGCTL_STOPPCLK" bit there is any
power saved or driver behaved differently. Maybe it is platform depended
. However, there is a possibility that this might save power.

So as this is not breaking anything. I am ok with this patch.

--
Regards,
Artur