RE: rcar_gen3_phy_usb2: unbalanced disables for USB20_VBUS0

From: Yoshihiro Shimoda
Date: Wed Jun 05 2019 - 00:10:57 EST

Hi Geert-san,

Thank you very much for your report!

> From: Geert Uytterhoeven, Sent: Wednesday, June 5, 2019 3:06 AM
> Hi Shimoda-san,
> Using a tree based on renesas-drivers-2019-06-04-v5.2-rc3, I started seeing
> the following warning during a second system suspend (s2idle):
> So far I've seen this on Salvator-X with R-Car H3 ES1.0 or M3-W, and
> on Salvator-XS with R-Car M3-N, but not (yet?) on H3 ES2.0.

I could reproduce this issue on R-Car H3 ES3.0 with Suspend-to-RAM.
# I'm silly but I could not use s2idle that didn't wake up by ravb.

> Unfortunately the issue seems to be fairly timing-sensitive, so I failed
> to bisect it.
> I have added some debug. While this didn't help me finding the cause
> of the above warning, it did discover another imbalance:

Thank you for trying it. I have investigated this issue and then I found the root cause.

After the following patch was applied, multiple phy devices are generated.

But, on the power_on function, it should set the "powered" flag for any other phys anyway.
Otherwise, such a strange imbalance behavior happened.
The powered flag is needed to avoid multiple "PLL_RST" register setting.
# I think regulator_{en,dis}able() don't need such a condition though.

I'll submit a bugfix patch with your Reported-by tag later.

Best regards,
Yoshihiro Shimoda