From: Andre Przywara <andre.przywara@arm.com>
To: Xu Rao <raoxu@uniontech.com>
Cc: jernej.skrabec@gmail.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org,
linux-sunxi@lists.linux.dev, marco.crivellari@suse.com,
neil.armstrong@linaro.org, samuel@sholland.org, vkoul@kernel.org,
wens@kernel.org
Subject: Re: [PATCH] phy: allwinner: sun4i-usb: disable the PHY2 PMU clock after SIDDQ setup
Date: Thu, 13 Aug 2026 14:33:10 +0200 [thread overview]
Message-ID: <6f70366a-227a-49e2-85d7-186bf47077e5@arm.com> (raw)
In-Reply-To: <8976A02CE2417DF2+20260707032106.985208-1-raoxu@uniontech.com>
Hi,
On 7/7/26 05:21, Xu Rao wrote:
> Hi Andre,
>
>>> - clk_disable_unprepare(phy->clk2);
>>> + clk_disable_unprepare(phy2->clk2);
>>
>> Interesting, this looks about right, and matches the comment above,
>> noting that phy2->clk2 is just temporarily needed. I don't remember
>> further details, only that this workaround was quite annoying and messy ;-)
I checked it again, and indeed we need this clock to access the PMU for
PHY2, otherwise those PMU registers are RAZ/WI. Interestingly this only
applies to PHY2, the other PHY's PMU area can be accessed without any
extra clocks. And also this extra clock is actually CLK_BUS_EHCI2, so
it's already enabled by the EHCI driver (if this port is enabled).
>> However I am wondering how this worked so far: This should sabotage the
>> access to the local REG_HCI_PHY_CTL access in the next few lines ...
>> Any idea why this worked nevertheless?
>
> Yes, the current code is wrong, but the visible effect is limited.
>
> In sun4i_usb_phy_init(), the auxiliary SIDDQ path explicitly enables
> phy2->clk2 and then accesses phy2->pmu + REG_HCI_PHY_CTL. So the clock
> that has to be disabled at the end of that block is phy2->clk2.
>
> The current code disables phy->clk2 instead, which is a different object.
> That does not undo the temporary phy2->clk2 enable.
>
> The reason this has not shown up as an obvious functional failure is that
> phy->clk2 is an optional PMU clock. On systems where the non-PHY2 PMU
> clock is not provided, the wrong clk_disable_unprepare(phy->clk2) does
> not actually disable a local PMU clock.
To be more precise: it's only PHY2 on the H616 that has this "clk2", for
everyone else it's NULL and so any clock operations are NOPs. That's why
disabling clk2 of PHY0, PHY1, or PHY3 does not do anything at all.
> In that case, the practical
> visible issue is simply that the temporary phy2->clk2 enable is not
> matched by a corresponding disable.
Yes, it purely a leak of this clock that's happening here. That explains
why it worked before, and makes the fix good to go:
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Can you add a sentence with the explanation of why disabling the wrong
clock did not do any harm? Like: "No other PHY uses a clk2 clock, so the
pointer was NULL, and disabling the wrong clock did nothing."
Cheers,
Andre.
> So the failure is not that the following local REG_HCI_PHY_CTL access is
> known to break today. The concrete bug is that the auxiliary path enables
> one clock and disables another one.
>
> Thanks,
> Xu Rao
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
prev parent reply other threads:[~2026-08-13 12:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 9:35 [PATCH] phy: allwinner: sun4i-usb: disable the PHY2 PMU clock after SIDDQ setup raoxu
2026-07-06 9:51 ` sashiko-bot
2026-07-06 10:13 ` Andre Przywara
2026-07-07 3:21 ` Xu Rao
2026-08-13 12:33 ` Andre Przywara [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6f70366a-227a-49e2-85d7-186bf47077e5@arm.com \
--to=andre.przywara@arm.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=marco.crivellari@suse.com \
--cc=neil.armstrong@linaro.org \
--cc=raoxu@uniontech.com \
--cc=samuel@sholland.org \
--cc=vkoul@kernel.org \
--cc=wens@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox