* [PATCH v2 0/3] phy: exynos5-usbdrd: fix HS phy init count on Exynos2200
@ 2026-11-11 3:23 Soheyb
2026-11-11 3:23 ` [PATCH v2 1/3] phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails Soheyb
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Soheyb @ 2026-11-11 3:23 UTC (permalink / raw)
To: Vinod Koul, Krzysztof Kozlowski
Cc: Neil Armstrong, Manivannan Sadhasivam, Peter Griffin, Alim Akhtar,
Ivaylo Ivanov, linux-phy, linux-arm-kernel, linux-samsung-soc,
linux-kernel, Soheyb
The UTMI phy of Exynos2200 initializes the high-speed (eUSB2) phy but
never exits it, so the high-speed phy is not set up again after it lost
power in system sleep (patch 3, v1 [1]).
Sashiko's review of v1 [2] found two error paths that v1 leaves wrong: a
failed init of the high-speed phy is ignored, so the exit that follows
takes its init count below zero; and the high-speed phy exits before
the steps of the UTMI exit that can fail, so a failed exit leaves the
UTMI phy initialized and the high-speed phy not. Patch 2 returns the
init error, and patch 3 exits the high-speed phy last. Patch 1 undoes
the UTMI init when it fails, which its clocks path already lacks and
which patch 2 makes reachable from the high-speed phy.
Changes in v2:
- patch 1, new: undo the init on failure
- patch 2, new: return the init error of the high-speed phy
- patch 3: exit the high-speed phy last, once the rest of the exit has
succeeded; drop the comment (Ivaylo); his Acked-by of v1 is left
out, since the exit has moved
Tested on a Google Pixel 9 (Tensor G4), an out-of-tree port on 7.3-rc7
that uses the Exynos2200 phy ops and powers USB off in system sleep:
USB comes back after each sleep, and with each error path forced by a
test-only switch, both init counts stay balanced. Not tested on
Exynos2200 hardware, nor built in linux-phy next as a whole.
[1] https://lore.kernel.org/all/20261109221522.2796426-1-soheyb_boulaa@proton.me/
[2] https://lore.kernel.org/linux-phy/sashiko-outbox-205724@kernel.org/
Soheyb (3):
phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails
phy: exynos5-usbdrd: return the Exynos2200 high-speed phy init error
phy: exynos5-usbdrd: fix HS phy init count imbalance on Exynos2200
drivers/phy/samsung/phy-exynos5-usbdrd.c | 28 +++++++++++++++++++-----
1 file changed, 22 insertions(+), 6 deletions(-)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.56.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails
2026-11-11 3:23 [PATCH v2 0/3] phy: exynos5-usbdrd: fix HS phy init count on Exynos2200 Soheyb
@ 2026-11-11 3:23 ` Soheyb
2026-11-11 3:32 ` sashiko-bot
2026-11-11 3:23 ` [PATCH v2 2/3] phy: exynos5-usbdrd: return the Exynos2200 high-speed phy init error Soheyb
2026-11-11 3:23 ` [PATCH v2 3/3] phy: exynos5-usbdrd: fix HS phy init count imbalance on Exynos2200 Soheyb
2 siblings, 1 reply; 6+ messages in thread
From: Soheyb @ 2026-11-11 3:23 UTC (permalink / raw)
To: Vinod Koul, Krzysztof Kozlowski
Cc: Neil Armstrong, Manivannan Sadhasivam, Peter Griffin, Alim Akhtar,
Ivaylo Ivanov, linux-phy, linux-arm-kernel, linux-samsung-soc,
linux-kernel, Soheyb, stable
exynos2200_usbdrd_phy_init() enables the regulators of the UTMI phy and
takes the phy out of isolation in the PMU before it enables the clocks.
When clk_bulk_prepare_enable() fails, it returns without undoing
either. The phy core does not count a failed init, so no exit undoes
them later: the phy stays out of isolation, and its supplies stay
enabled, until an init and an exit succeed.
Isolate the phy again and disable the UTMI regulators when the clocks
or the phy-specific init fail. The phy-specific init does not fail yet;
the next patch makes the UTMI init return the result of the init of the
high-speed phy.
Fixes: cc52a697f87e ("phy: exynos5-usbdrd: support Exynos USBDRD 3.2 4nm controller")
Cc: stable@vger.kernel.org
Signed-off-by: Soheyb <soheyb_boulaa@proton.me>
---
v2: new patch.
drivers/phy/samsung/phy-exynos5-usbdrd.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
index 087d552..a6fe779 100644
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
@@ -1462,7 +1462,7 @@ static int exynos2200_usbdrd_phy_init(struct phy *phy)
ret = clk_bulk_prepare_enable(phy_drd->drv_data->n_clks, phy_drd->clks);
if (ret)
- return ret;
+ goto power_down;
/* Set up the link controller */
exynos2200_usbdrd_link_init(phy_drd);
@@ -1475,6 +1475,17 @@ static int exynos2200_usbdrd_phy_init(struct phy *phy)
clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks);
+ if (ret)
+ goto power_down;
+
+ return 0;
+
+power_down:
+ exynos5_usbdrd_phy_isol(inst, true);
+ if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI)
+ regulator_bulk_disable(phy_drd->drv_data->n_regulators,
+ phy_drd->regulators);
+
return ret;
}
--
2.56.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] phy: exynos5-usbdrd: return the Exynos2200 high-speed phy init error
2026-11-11 3:23 [PATCH v2 0/3] phy: exynos5-usbdrd: fix HS phy init count on Exynos2200 Soheyb
2026-11-11 3:23 ` [PATCH v2 1/3] phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails Soheyb
@ 2026-11-11 3:23 ` Soheyb
2026-11-11 3:23 ` [PATCH v2 3/3] phy: exynos5-usbdrd: fix HS phy init count imbalance on Exynos2200 Soheyb
2 siblings, 0 replies; 6+ messages in thread
From: Soheyb @ 2026-11-11 3:23 UTC (permalink / raw)
To: Vinod Koul, Krzysztof Kozlowski
Cc: Neil Armstrong, Manivannan Sadhasivam, Peter Griffin, Alim Akhtar,
Ivaylo Ivanov, linux-phy, linux-arm-kernel, linux-samsung-soc,
linux-kernel, Soheyb, Sashiko, stable
exynos2200_usbdrd_utmi_init() ignores the result of phy_init() on the
high-speed phy and returns 0. When the high-speed phy fails to
initialize, the UTMI phy thus counts as initialized, and the controller
goes on with a high-speed phy that is not set up.
Return the result of phy_init(), so that a failed init of the
high-speed phy fails the init of the UTMI phy. The next patch, which
exits the high-speed phy with the UTMI phy, relies on it: an exit after
a failed init would otherwise take the init count of the high-speed
phy below zero.
Fixes: cc52a697f87e ("phy: exynos5-usbdrd: support Exynos USBDRD 3.2 4nm controller")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-phy/sashiko-outbox-205724@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Soheyb <soheyb_boulaa@proton.me>
---
v2: new patch, after Sashiko's review of v1.
drivers/phy/samsung/phy-exynos5-usbdrd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
index a6fe779..cf0597a 100644
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
@@ -1369,9 +1369,7 @@ static const struct phy_ops exynos7870_usbdrd_phy_ops = {
static int exynos2200_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
{
/* Configure non-Samsung IP PHY, responsible for UTMI */
- phy_init(phy_drd->hs_phy);
-
- return 0;
+ return phy_init(phy_drd->hs_phy);
}
static void exynos2200_usbdrd_link_init(struct exynos5_usbdrd_phy *phy_drd)
--
2.56.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] phy: exynos5-usbdrd: fix HS phy init count imbalance on Exynos2200
2026-11-11 3:23 [PATCH v2 0/3] phy: exynos5-usbdrd: fix HS phy init count on Exynos2200 Soheyb
2026-11-11 3:23 ` [PATCH v2 1/3] phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails Soheyb
2026-11-11 3:23 ` [PATCH v2 2/3] phy: exynos5-usbdrd: return the Exynos2200 high-speed phy init error Soheyb
@ 2026-11-11 3:23 ` Soheyb
2026-11-11 3:39 ` sashiko-bot
2 siblings, 1 reply; 6+ messages in thread
From: Soheyb @ 2026-11-11 3:23 UTC (permalink / raw)
To: Vinod Koul, Krzysztof Kozlowski
Cc: Neil Armstrong, Manivannan Sadhasivam, Peter Griffin, Alim Akhtar,
Ivaylo Ivanov, linux-phy, linux-arm-kernel, linux-samsung-soc,
linux-kernel, Soheyb, stable
exynos2200_usbdrd_utmi_init() calls phy_init() on the high-speed phy,
but exynos2200_usbdrd_phy_exit() never calls phy_exit() on it. The init
count of the high-speed phy therefore never drops back to zero: after
the first init, every later phy_init() of it returns early, and its
clocks and supplies stay enabled across an exit of the UTMI phy.
When the high-speed phy loses power while the controller is suspended,
it is thus not set up again on resume, and the DWC3 core soft reset
times out:
dwc3 11210000.usb: DWC3 controller soft reset failed
Exit the high-speed phy when the UTMI phy exits, last, once the rest of
the exit has succeeded: the phy core counts a failed exit as no exit,
so the high-speed phy has to stay initialized along with the UTMI phy.
Fixes: cc52a697f87e ("phy: exynos5-usbdrd: support Exynos USBDRD 3.2 4nm controller")
Cc: stable@vger.kernel.org
Signed-off-by: Soheyb <soheyb_boulaa@proton.me>
---
v2: the high-speed phy exits last, once the rest of the exit has
succeeded, after Sashiko's review of v1; v1 exited it first. The comment
is dropped, after Ivaylo's review of v1. His Acked-by of v1 is left
out, since the exit has moved.
drivers/phy/samsung/phy-exynos5-usbdrd.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
index cf0597a..041a555 100644
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
@@ -1510,8 +1510,15 @@ static int exynos2200_usbdrd_phy_exit(struct phy *phy)
clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks);
exynos5_usbdrd_phy_isol(inst, true);
- return regulator_bulk_disable(phy_drd->drv_data->n_regulators,
- phy_drd->regulators);
+ ret = regulator_bulk_disable(phy_drd->drv_data->n_regulators,
+ phy_drd->regulators);
+ if (ret)
+ return ret;
+
+ if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI)
+ return phy_exit(phy_drd->hs_phy);
+
+ return 0;
}
static const struct phy_ops exynos2200_usbdrd_phy_ops = {
--
2.56.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails
2026-11-11 3:23 ` [PATCH v2 1/3] phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails Soheyb
@ 2026-11-11 3:32 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-11 3:32 UTC (permalink / raw)
To: Soheyb; +Cc: linux-phy, vkoul, neil.armstrong, olteanv
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] phy: exynos5-usbdrd: single-word name in Signed-off-by and
Author trailers
--
commit ea360718642a10fc523396c37cb054fd6d6668fb
Author: Soheyb <soheyb_boulaa@proton.me>
> phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails
>
> exynos2200_usbdrd_phy_init() enables the regulators of the UTMI phy and
> takes the phy out of isolation in the PMU before it enables the clocks.
> When clk_bulk_prepare_enable() fails, it returns without undoing
> either. The phy core does not count a failed init, so no exit undoes
> them later: the phy stays out of isolation, and its supplies stay
> enabled, until an init and an exit succeed.
>
> Isolate the phy again and disable the UTMI regulators when the clocks
> or the phy-specific init fail. The phy-specific init does not fail yet;
> the next patch makes the UTMI init return the result of the init of the
> high-speed phy.
>
> Fixes: cc52a697f87e ("phy: exynos5-usbdrd: support Exynos USBDRD 3.2 4nm controller")
> Cc: stable@vger.kernel.org
> Signed-off-by: Soheyb <soheyb_boulaa@proton.me>
[Severity: High]
Could the Author header and Signed-off-by tag use a full real name (for
example, Soheyb Boulaa) instead of a single-word name, as required by
Documentation/process/submitting-patches.rst for the Developer's
Certificate of Origin?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111032309.3365794-1-soheyb_boulaa@proton.me?part=1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] phy: exynos5-usbdrd: fix HS phy init count imbalance on Exynos2200
2026-11-11 3:23 ` [PATCH v2 3/3] phy: exynos5-usbdrd: fix HS phy init count imbalance on Exynos2200 Soheyb
@ 2026-11-11 3:39 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-11 3:39 UTC (permalink / raw)
To: Soheyb; +Cc: linux-phy, vkoul, neil.armstrong, olteanv
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] phy: exynos5-usbdrd: single-word name in Author and
Signed-off-by
--
commit 8e448a4a6f56e4e83d90a527a88032755a420671
Author: Soheyb <soheyb_boulaa@proton.me>
> phy: exynos5-usbdrd: fix HS phy init count imbalance on Exynos2200
>
> exynos2200_usbdrd_utmi_init() calls phy_init() on the high-speed phy,
> but exynos2200_usbdrd_phy_exit() never calls phy_exit() on it. The init
> count of the high-speed phy therefore never drops back to zero: after
> the first init, every later phy_init() of it returns early, and its
> clocks and supplies stay enabled across an exit of the UTMI phy.
>
> When the high-speed phy loses power while the controller is suspended,
> it is thus not set up again on resume, and the DWC3 core soft reset
> times out:
>
> dwc3 11210000.usb: DWC3 controller soft reset failed
>
> Exit the high-speed phy when the UTMI phy exits, last, once the rest of
> the exit has succeeded: the phy core counts a failed exit as no exit,
> so the high-speed phy has to stay initialized along with the UTMI phy.
>
> Fixes: cc52a697f87e ("phy: exynos5-usbdrd: support Exynos USBDRD 3.2 4nm controller")
> Cc: stable@vger.kernel.org
> Signed-off-by: Soheyb <soheyb_boulaa@proton.me>
[Severity: High]
Documentation/process/submitting-patches.rst requires a full real name
in the Author header and Signed-off-by tag rather than a single-word
name. Could this use your full name (for example, Soheyb Boulaa)?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111032309.3365794-1-soheyb_boulaa@proton.me?part=3
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-11 3:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11 3:23 [PATCH v2 0/3] phy: exynos5-usbdrd: fix HS phy init count on Exynos2200 Soheyb
2026-11-11 3:23 ` [PATCH v2 1/3] phy: exynos5-usbdrd: power the Exynos2200 phy down when its init fails Soheyb
2026-11-11 3:32 ` sashiko-bot
2026-11-11 3:23 ` [PATCH v2 2/3] phy: exynos5-usbdrd: return the Exynos2200 high-speed phy init error Soheyb
2026-11-11 3:23 ` [PATCH v2 3/3] phy: exynos5-usbdrd: fix HS phy init count imbalance on Exynos2200 Soheyb
2026-11-11 3:39 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox