* [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested
@ 2026-10-01 13:12 Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 1/4] phy: rockchip: inno-usb2: simplify and unify PHY op debug messages Sebastian Reichel
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Sebastian Reichel @ 2026-10-01 13:12 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Igor Paunovic, kernel, Sebastian Reichel
This was noticed on RK3588 EVB1 when resuming from system suspend. This
is technically a fix, but its unclear when the bug was introduced and
system suspend is broken on RK3588 for quite a while and not just due
to this problem. So I think this fix can be merged the normal way via
linux-next.
Changes in v2:
- Link to v1: https://patch.msgid.link/20260908-phy-rockchip-inno-usb2-clock-fix-v1-1-f7d59c31b908@collabora.com
- Move suspend exit code from rockchip_usb2phy_power_on into a
separate patch and reuse it in the clock prepare function;
move is done in a separate patch
- Updated commit messages with proper rationale
- Added one more patch dropping useless assignment
of rport->suspended directly after calling
rockchip_usb2phy_power_on/off
- Add one more patch unifying and simplifying the debug
messages for phy init/power_on/power_off/exit
---
To: Vinod Koul <vkoul@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.org>
To: Manivannan Sadhasivam <mani@kernel.org>
To: Heiko Stuebner <heiko@sntech.de>
Cc: linux-phy@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Igor Paunovic <royalnet026@gmail.com>
Cc: kernel@collabora.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
Sebastian Reichel (4):
phy: rockchip: inno-usb2: simplify and unify PHY op debug messages
phy: rockchip: inno-usb2: drop duplicated update of rport->suspended
phy: rockchip: inno-usb2: move suspend handling into new function
phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 85 +++++++++++++++++++--------
1 file changed, 59 insertions(+), 26 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260908-phy-rockchip-inno-usb2-clock-fix-edd65b57f884
Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/4] phy: rockchip: inno-usb2: simplify and unify PHY op debug messages
2026-10-01 13:12 [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
@ 2026-10-01 13:12 ` Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 2/4] phy: rockchip: inno-usb2: drop duplicated update of rport->suspended Sebastian Reichel
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Sebastian Reichel @ 2026-10-01 13:12 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Igor Paunovic, kernel, Sebastian Reichel
Add debug message for init/exit in addition to power_on/power_off and
avoid the useless extra dereference in the existing power_on/power_off
to make the prints consistent.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 7d8a533f24ae..0ab054ee84cb 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -508,6 +508,8 @@ static int rockchip_usb2phy_init(struct phy *phy)
struct rockchip_usb2phy *rphy = dev_get_drvdata(phy->dev.parent);
int ret = 0;
+ dev_dbg(&phy->dev, "phy port init\n");
+
mutex_lock(&rport->mutex);
if (rport->port_id == USB2PHY_PORT_OTG) {
@@ -592,7 +594,7 @@ static int rockchip_usb2phy_power_on(struct phy *phy)
struct rockchip_usb2phy *rphy = dev_get_drvdata(phy->dev.parent);
int ret;
- dev_dbg(&rport->phy->dev, "port power on\n");
+ dev_dbg(&phy->dev, "port power on\n");
if (!rport->suspended)
return 0;
@@ -632,7 +634,7 @@ static int rockchip_usb2phy_power_off(struct phy *phy)
struct rockchip_usb2phy *rphy = dev_get_drvdata(phy->dev.parent);
int ret;
- dev_dbg(&rport->phy->dev, "port power off\n");
+ dev_dbg(&phy->dev, "port power off\n");
if (rport->suspended)
return 0;
@@ -651,6 +653,8 @@ static int rockchip_usb2phy_exit(struct phy *phy)
{
struct rockchip_usb2phy_port *rport = phy_get_drvdata(phy);
+ dev_dbg(&phy->dev, "phy port exit\n");
+
if (rport->port_id == USB2PHY_PORT_OTG &&
rport->mode != USB_DR_MODE_HOST &&
rport->mode != USB_DR_MODE_UNKNOWN) {
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/4] phy: rockchip: inno-usb2: drop duplicated update of rport->suspended
2026-10-01 13:12 [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 1/4] phy: rockchip: inno-usb2: simplify and unify PHY op debug messages Sebastian Reichel
@ 2026-10-01 13:12 ` Sebastian Reichel
2026-10-01 13:23 ` sashiko-bot
2026-10-01 13:12 ` [PATCH v2 3/4] phy: rockchip: inno-usb2: move suspend handling into new function Sebastian Reichel
` (3 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Sebastian Reichel @ 2026-10-01 13:12 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Igor Paunovic, kernel, Sebastian Reichel
rockchip_usb2phy_power_on and rockchip_usb2phy_power_off already update
rport->suspended in their success path. In case of error it's not
sensible to update rport->suspended. So drop the duplicated update.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 0ab054ee84cb..e4d8abf935c1 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -994,7 +994,6 @@ static void rockchip_usb2phy_sm_work(struct work_struct *work)
if (rport->suspended) {
dev_dbg(&rport->phy->dev, "Connected\n");
rockchip_usb2phy_power_on(rport->phy);
- rport->suspended = false;
} else {
/* D+ line pull-up, D- line pull-down */
dev_dbg(&rport->phy->dev, "FS/LS online\n");
@@ -1004,7 +1003,6 @@ static void rockchip_usb2phy_sm_work(struct work_struct *work)
if (!rport->suspended) {
dev_dbg(&rport->phy->dev, "Disconnected\n");
rockchip_usb2phy_power_off(rport->phy);
- rport->suspended = true;
}
/*
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/4] phy: rockchip: inno-usb2: move suspend handling into new function
2026-10-01 13:12 [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 1/4] phy: rockchip: inno-usb2: simplify and unify PHY op debug messages Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 2/4] phy: rockchip: inno-usb2: drop duplicated update of rport->suspended Sebastian Reichel
@ 2026-10-01 13:12 ` Sebastian Reichel
2026-10-01 13:21 ` sashiko-bot
2026-10-01 13:12 ` [PATCH v2 4/4] phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576 Sebastian Reichel
` (2 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Sebastian Reichel @ 2026-10-01 13:12 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Igor Paunovic, kernel, Sebastian Reichel
Move handling of the PHY suspend handling into its own dedicated
function. No functional changes intended.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 48 +++++++++++++++++----------
1 file changed, 31 insertions(+), 17 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index e4d8abf935c1..925a03fee6bc 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -332,6 +332,35 @@ rockchip_usb2phy_clk480m_clkout_ctl(struct clk_hw *hw, struct regmap **base,
}
}
+static int rockchip_usb2phy_set_suspend(struct rockchip_usb2phy *rphy,
+ struct rockchip_usb2phy_port *rport,
+ bool do_suspend)
+{
+ int ret;
+
+ ret = property_enable(rphy->grf, &rport->port_cfg->phy_sus, !do_suspend);
+ if (ret)
+ return ret;
+
+ if (!do_suspend) {
+ /*
+ * For rk3588, it needs to reset phy when exit from suspend
+ * mode with common_on_n 1'b1(aka REFCLK_LOGIC, Bias, and PLL
+ * blocks are powered down) for lower power consumption. If you
+ * don't want to reset phy, please keep the common_on_n 1'b0 to
+ * set these blocks remain powered.
+ */
+ ret = rockchip_usb2phy_reset(rphy);
+ if (ret)
+ return ret;
+
+ /* waiting for the utmi_clk to become stable */
+ usleep_range(1500, 2000);
+ }
+
+ return 0;
+}
+
static int rockchip_usb2phy_clk480m_prepare(struct clk_hw *hw)
{
const struct usb2phy_reg *clkout_ctl;
@@ -603,27 +632,12 @@ static int rockchip_usb2phy_power_on(struct phy *phy)
if (ret)
return ret;
- ret = property_enable(rphy->grf, &rport->port_cfg->phy_sus, false);
+ ret = rockchip_usb2phy_set_suspend(rphy, rport, false);
if (ret) {
clk_disable_unprepare(rphy->clk480m);
return ret;
}
- /*
- * For rk3588, it needs to reset phy when exit from
- * suspend mode with common_on_n 1'b1(aka REFCLK_LOGIC,
- * Bias, and PLL blocks are powered down) for lower
- * power consumption. If you don't want to reset phy,
- * please keep the common_on_n 1'b0 to set these blocks
- * remain powered.
- */
- ret = rockchip_usb2phy_reset(rphy);
- if (ret)
- return ret;
-
- /* waiting for the utmi_clk to become stable */
- usleep_range(1500, 2000);
-
rport->suspended = false;
return 0;
}
@@ -639,7 +653,7 @@ static int rockchip_usb2phy_power_off(struct phy *phy)
if (rport->suspended)
return 0;
- ret = property_enable(rphy->grf, &rport->port_cfg->phy_sus, true);
+ ret = rockchip_usb2phy_set_suspend(rphy, rport, true);
if (ret)
return ret;
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/4] phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576
2026-10-01 13:12 [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
` (2 preceding siblings ...)
2026-10-01 13:12 ` [PATCH v2 3/4] phy: rockchip: inno-usb2: move suspend handling into new function Sebastian Reichel
@ 2026-10-01 13:12 ` Sebastian Reichel
2026-10-01 13:23 ` sashiko-bot
2026-10-01 21:34 ` [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
2026-10-03 14:33 ` Vinod Koul
5 siblings, 1 reply; 10+ messages in thread
From: Sebastian Reichel @ 2026-10-01 13:12 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Igor Paunovic, kernel, Sebastian Reichel
On RK3588 the 480MHz PHY clock must be running to access registers on
the OHCI and EHCI controllers. This requires that the clock output bit
is configured correctly (already happening) and that the PHY PLL itself
is running. The PHY PLL is only running when the PHY is not suspended.
This is currently handled independently of the clock and thus the clock
might be enabled with the PHY being suspended resulting in a
non-functional clock despite the clock being marked as prepared and
enabled according to the common clock framework.
This is especially a problem with OHCI system resume on RK3588, which
does:
ohci_platform_resume
-> ohci_platform_resume_common
-> deassert resets
-> ohci_platform_power_on -> enable clocks
-> ohci_resume
-> ohci_readl(ohci, &ohci->regs->control); // SError !
-> ...
-> ...
-> root hub resume (this resumes the PHY)
Fix this by fully powering the PHY from the clock prepare function.
This does not work on older platforms, which have multiple ports and
only one 480MHz clock as we do not know which port should be resumed.
But as far as I can tell these platforms do not have the clock
dependency from their USB controllers and thus are not affected.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 31 +++++++++++++++++++++------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 925a03fee6bc..cc923d12ef7b 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -363,6 +363,8 @@ static int rockchip_usb2phy_set_suspend(struct rockchip_usb2phy *rphy,
static int rockchip_usb2phy_clk480m_prepare(struct clk_hw *hw)
{
+ struct rockchip_usb2phy *rphy =
+ container_of(hw, struct rockchip_usb2phy, clk480m_hw);
const struct usb2phy_reg *clkout_ctl;
struct regmap *base;
int ret;
@@ -379,16 +381,27 @@ static int rockchip_usb2phy_clk480m_prepare(struct clk_hw *hw)
usleep_range(1200, 1300);
}
+ if (rphy->phy_cfg->num_ports == 1) {
+ ret = rockchip_usb2phy_set_suspend(rphy, &rphy->ports[0], false);
+ if (ret)
+ return ret;
+ }
+
return 0;
}
static void rockchip_usb2phy_clk480m_unprepare(struct clk_hw *hw)
{
+ struct rockchip_usb2phy *rphy =
+ container_of(hw, struct rockchip_usb2phy, clk480m_hw);
const struct usb2phy_reg *clkout_ctl;
struct regmap *base;
rockchip_usb2phy_clk480m_clkout_ctl(hw, &base, &clkout_ctl);
+ if (rphy->phy_cfg->num_ports == 1)
+ rockchip_usb2phy_set_suspend(rphy, &rphy->ports[0], true);
+
/* turn off 480m clk output */
property_enable(base, clkout_ctl, false);
}
@@ -632,10 +645,12 @@ static int rockchip_usb2phy_power_on(struct phy *phy)
if (ret)
return ret;
- ret = rockchip_usb2phy_set_suspend(rphy, rport, false);
- if (ret) {
- clk_disable_unprepare(rphy->clk480m);
- return ret;
+ if (rphy->phy_cfg->num_ports > 1) {
+ ret = rockchip_usb2phy_set_suspend(rphy, rport, false);
+ if (ret) {
+ clk_disable_unprepare(rphy->clk480m);
+ return ret;
+ }
}
rport->suspended = false;
@@ -653,9 +668,11 @@ static int rockchip_usb2phy_power_off(struct phy *phy)
if (rport->suspended)
return 0;
- ret = rockchip_usb2phy_set_suspend(rphy, rport, true);
- if (ret)
- return ret;
+ if (rphy->phy_cfg->num_ports > 1) {
+ ret = rockchip_usb2phy_set_suspend(rphy, rport, true);
+ if (ret)
+ return ret;
+ }
rport->suspended = true;
clk_disable_unprepare(rphy->clk480m);
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/4] phy: rockchip: inno-usb2: move suspend handling into new function
2026-10-01 13:12 ` [PATCH v2 3/4] phy: rockchip: inno-usb2: move suspend handling into new function Sebastian Reichel
@ 2026-10-01 13:21 ` sashiko-bot
0 siblings, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-10-01 13:21 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: olteanv, linux-phy, vkoul, neil.armstrong
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] phy: rockchip: inverted logic in rockchip_usb2phy_set_suspend()
--
commit 559f37e7fcbd18c0d269eb9a711cca723c264b19
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
phy: rockchip: inno-usb2: move suspend handling into new function
This commit refactors the PHY suspend handling into its own dedicated helper
function. It is intended to produce no functional changes to the driver.
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index e4d8abf935c1b..925a03fee6bc5 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> @@ -332,6 +332,35 @@ rockchip_usb2phy_clk480m_clkout_ctl(struct clk_hw *hw, struct regmap **base,
> }
> }
>
> +static int rockchip_usb2phy_set_suspend(struct rockchip_usb2phy *rphy,
> + struct rockchip_usb2phy_port *rport,
> + bool do_suspend)
> +{
> + int ret;
> +
> + ret = property_enable(rphy->grf, &rport->port_cfg->phy_sus, !do_suspend);
[Severity: High]
Does this helper invert the intended logic?
In the original code, rockchip_usb2phy_power_on() called property_enable()
with false to clear the suspend property, and rockchip_usb2phy_power_off()
called it with true to set the property.
By passing !do_suspend here, when callers want to exit suspend and pass
false, we end up passing true to property_enable(). This seems to reverse
the hardware state for suspend and resume operations.
[ ... ]
> @@ -603,27 +632,12 @@ static int rockchip_usb2phy_power_on(struct phy *phy)
> if (ret)
> return ret;
>
> - ret = property_enable(rphy->grf, &rport->port_cfg->phy_sus, false);
> + ret = rockchip_usb2phy_set_suspend(rphy, rport, false);
[Severity: High]
Could this cause the PHY to incorrectly suspend when we're trying to power
it on?
When rockchip_usb2phy_power_on() calls rockchip_usb2phy_set_suspend() with
false, the new helper will execute property_enable(..., true).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001-phy-rockchip-inno-usb2-clock-fix-v2-0-e01bf509359e@collabora.com?part=3
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576
2026-10-01 13:12 ` [PATCH v2 4/4] phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576 Sebastian Reichel
@ 2026-10-01 13:23 ` sashiko-bot
0 siblings, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-10-01 13:23 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: neil.armstrong, vkoul, olteanv, linux-phy
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] usb: phy: rockchip: NULL ptr deref in clk480m_prepare due to early clock registration
- [Medium] usb: phy: rockchip: missing hardware rollback on clk prepare error
--
commit eaaff48582a4fba9285d43555bb9babaac779141
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576
This commit modifies the RK3588/RK3576 USB2 PHY driver to fully power the PHY
during clock prepare operations. It addresses an issue during OHCI system
resume where the PHY must be running to access controller registers, moving the
suspend handling directly into the clock prepare/unprepare hooks.
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 925a03fee6bc5..cc923d12ef7b4 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
[ ... ]
> @@ -379,16 +381,27 @@ static int rockchip_usb2phy_clk480m_prepare(struct clk_hw *hw)
> usleep_range(1200, 1300);
> }
>
> + if (rphy->phy_cfg->num_ports == 1) {
> + ret = rockchip_usb2phy_set_suspend(rphy, &rphy->ports[0], false);
[Severity: High]
Could this lead to a null pointer dereference during probe?
In rockchip_usb2phy_probe(), the clock is registered via
rockchip_usb2phy_clk480m_register() before iterating over child nodes to
initialize the ports array and configurations.
If a concurrent or deferred probe from a clock consumer (such as the OHCI
controller) requests and prepares the clock immediately, this is called before
port initialization finishes.
At this point, rport->port_cfg will be NULL, which leads to a null pointer
dereference when property_enable() attempts to access
&rport->port_cfg->phy_sus.
> + if (ret)
> + return ret;
[Severity: Medium]
If rockchip_usb2phy_set_suspend() fails here, does this leave the clock
output permanently enabled?
Earlier in rockchip_usb2phy_clk480m_prepare(), the clock output is turned on
using property_enable().
Since the Common Clock Framework aborts preparation on error, .unprepare
will never be called to clean it up.
Returning immediately without rolling back the earlier hardware state change
appears to leave the clock output enabled.
> + }
> +
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001-phy-rockchip-inno-usb2-clock-fix-v2-0-e01bf509359e@collabora.com?part=4
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/4] phy: rockchip: inno-usb2: drop duplicated update of rport->suspended
2026-10-01 13:12 ` [PATCH v2 2/4] phy: rockchip: inno-usb2: drop duplicated update of rport->suspended Sebastian Reichel
@ 2026-10-01 13:23 ` sashiko-bot
0 siblings, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-10-01 13:23 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: olteanv, neil.armstrong, vkoul, linux-phy
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] phy: rockchip-inno-usb2: hotplug deadlock if rockchip_usb2phy_power_off() fails
--
commit a2dd4bb2fd5285c3bedf91d080a002423c1e6b40
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
phy: rockchip: inno-usb2: drop duplicated update of rport->suspended
rockchip_usb2phy_power_on and rockchip_usb2phy_power_off already update
rport->suspended in their success path. In case of error it's not
sensible to update rport->suspended. So drop the duplicated update.
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 0ab054ee84cbe..e4d8abf935c1b 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
[ ... ]
> @@ -1004,7 +1003,6 @@ static void rockchip_usb2phy_sm_work(struct work_struct *work)
> if (!rport->suspended) {
> dev_dbg(&rport->phy->dev, "Disconnected\n");
> rockchip_usb2phy_power_off(rport->phy);
> - rport->suspended = true;
[Severity: Medium]
If rockchip_usb2phy_power_off() fails, will rport->suspended remain false?
> }
>
> /*
> * activate the linestate detection to get the next device
> * plug-in irq.
> */
> property_enable(rphy->grf, &rport->port_cfg->ls_det_clr, true);
> property_enable(rphy->grf, &rport->port_cfg->ls_det_en, true);
>
> /*
> * we don't need to rearm the delayed work when the phy port
> * is suspended.
> */
> mutex_unlock(&rport->mutex);
> return;
[Severity: Medium]
Since the state machine exits here without re-arming the delayed work, and
rport->suspended could remain false, does this cause a permanent loss of
hotplug detection?
Looking at rockchip_usb2phy_linestate_irq(), the IRQ handler refuses to
re-arm the state machine if the port is not suspended:
static irqreturn_t rockchip_usb2phy_linestate_irq(int irq, void *data)
{
...
if (rport->suspended && rport->port_id == USB2PHY_PORT_HOST)
rockchip_usb2phy_sm_work(&rport->sm_work.work);
return IRQ_HANDLED;
}
If a USB device is disconnected and the underlying regmap_write() fails due
to local hardware or MMIO failure during rockchip_usb2phy_power_off(),
could this result in a hotplug deadlock for the USB host port?
While the code appears intended to handle this error path gracefully, it
seems to inadvertently break the state machine's re-arming condition. This
issue also appears to persist in the final commit of the series.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001-phy-rockchip-inno-usb2-clock-fix-v2-0-e01bf509359e@collabora.com?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested
2026-10-01 13:12 [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
` (3 preceding siblings ...)
2026-10-01 13:12 ` [PATCH v2 4/4] phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576 Sebastian Reichel
@ 2026-10-01 21:34 ` Sebastian Reichel
2026-10-03 14:33 ` Vinod Koul
5 siblings, 0 replies; 10+ messages in thread
From: Sebastian Reichel @ 2026-10-01 21:34 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel,
Igor Paunovic, kernel
[-- Attachment #1.1: Type: text/plain, Size: 2565 bytes --]
Hi,
On Thu, Oct 01, 2026 at 03:12:38PM +0200, Sebastian Reichel wrote:
> This was noticed on RK3588 EVB1 when resuming from system suspend. This
> is technically a fix, but its unclear when the bug was introduced and
> system suspend is broken on RK3588 for quite a while and not just due
> to this problem. So I think this fix can be merged the normal way via
> linux-next.
>
> Changes in v2:
> - Link to v1: https://patch.msgid.link/20260908-phy-rockchip-inno-usb2-clock-fix-v1-1-f7d59c31b908@collabora.com
> - Move suspend exit code from rockchip_usb2phy_power_on into a
> separate patch and reuse it in the clock prepare function;
> move is done in a separate patch
> - Updated commit messages with proper rationale
> - Added one more patch dropping useless assignment
> of rport->suspended directly after calling
> rockchip_usb2phy_power_on/off
> - Add one more patch unifying and simplifying the debug
> messages for phy init/power_on/power_off/exit
I was too fast sending this out. While it fixes the problem on
RK3588 EVB1 (used for testing this series), I just noticed it seems
to introduce a new SError in DWC3 on RK3576 boards during boot. This
is quite unexpected. I will investigate after LPC/OSSEU. For now
please ignore this series.
Sorry for the noise.
Greetings,
-- Sebastian
>
> ---
> To: Vinod Koul <vkoul@kernel.org>
> To: Neil Armstrong <neil.armstrong@linaro.org>
> To: Manivannan Sadhasivam <mani@kernel.org>
> To: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-phy@lists.infradead.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-rockchip@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Igor Paunovic <royalnet026@gmail.com>
> Cc: kernel@collabora.com
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>
> ---
> Sebastian Reichel (4):
> phy: rockchip: inno-usb2: simplify and unify PHY op debug messages
> phy: rockchip: inno-usb2: drop duplicated update of rport->suspended
> phy: rockchip: inno-usb2: move suspend handling into new function
> phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576
>
> drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 85 +++++++++++++++++++--------
> 1 file changed, 59 insertions(+), 26 deletions(-)
> ---
> base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
> change-id: 20260908-phy-rockchip-inno-usb2-clock-fix-edd65b57f884
>
> Best regards,
> --
> Sebastian Reichel <sebastian.reichel@collabora.com>
>
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 112 bytes --]
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested
2026-10-01 13:12 [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
` (4 preceding siblings ...)
2026-10-01 21:34 ` [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
@ 2026-10-03 14:33 ` Vinod Koul
5 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2026-10-03 14:33 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner, linux-phy,
linux-arm-kernel, linux-rockchip, linux-kernel, Igor Paunovic,
kernel
On 01-10-26, 15:12, Sebastian Reichel wrote:
> This was noticed on RK3588 EVB1 when resuming from system suspend. This
> is technically a fix, but its unclear when the bug was introduced and
> system suspend is broken on RK3588 for quite a while and not just due
> to this problem. So I think this fix can be merged the normal way via
> linux-next.
This looks fine to me, can you check the sashiko issues reported...
>
> Changes in v2:
> - Link to v1: https://patch.msgid.link/20260908-phy-rockchip-inno-usb2-clock-fix-v1-1-f7d59c31b908@collabora.com
> - Move suspend exit code from rockchip_usb2phy_power_on into a
> separate patch and reuse it in the clock prepare function;
> move is done in a separate patch
> - Updated commit messages with proper rationale
> - Added one more patch dropping useless assignment
> of rport->suspended directly after calling
> rockchip_usb2phy_power_on/off
> - Add one more patch unifying and simplifying the debug
> messages for phy init/power_on/power_off/exit
>
> ---
> To: Vinod Koul <vkoul@kernel.org>
> To: Neil Armstrong <neil.armstrong@linaro.org>
> To: Manivannan Sadhasivam <mani@kernel.org>
> To: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-phy@lists.infradead.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-rockchip@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Igor Paunovic <royalnet026@gmail.com>
> Cc: kernel@collabora.com
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>
> ---
> Sebastian Reichel (4):
> phy: rockchip: inno-usb2: simplify and unify PHY op debug messages
> phy: rockchip: inno-usb2: drop duplicated update of rport->suspended
> phy: rockchip: inno-usb2: move suspend handling into new function
> phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576
>
> drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 85 +++++++++++++++++++--------
> 1 file changed, 59 insertions(+), 26 deletions(-)
> ---
> base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
> change-id: 20260908-phy-rockchip-inno-usb2-clock-fix-edd65b57f884
>
> Best regards,
> --
> Sebastian Reichel <sebastian.reichel@collabora.com>
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-10-03 14:34 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-01 13:12 [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 1/4] phy: rockchip: inno-usb2: simplify and unify PHY op debug messages Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 2/4] phy: rockchip: inno-usb2: drop duplicated update of rport->suspended Sebastian Reichel
2026-10-01 13:23 ` sashiko-bot
2026-10-01 13:12 ` [PATCH v2 3/4] phy: rockchip: inno-usb2: move suspend handling into new function Sebastian Reichel
2026-10-01 13:21 ` sashiko-bot
2026-10-01 13:12 ` [PATCH v2 4/4] phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576 Sebastian Reichel
2026-10-01 13:23 ` sashiko-bot
2026-10-01 21:34 ` [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
2026-10-03 14:33 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox