From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Heiko Stuebner <heiko@sntech.de>
Cc: linux-phy@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org,
Igor Paunovic <royalnet026@gmail.com>,
kernel@collabora.com,
Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: [PATCH v2 3/4] phy: rockchip: inno-usb2: move suspend handling into new function
Date: Thu, 01 Oct 2026 15:12:41 +0200 [thread overview]
Message-ID: <20261001-phy-rockchip-inno-usb2-clock-fix-v2-3-e01bf509359e@collabora.com> (raw)
In-Reply-To: <20261001-phy-rockchip-inno-usb2-clock-fix-v2-0-e01bf509359e@collabora.com>
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
next prev parent reply other threads:[~2026-10-01 13:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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 ` [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
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=20261001-phy-rockchip-inno-usb2-clock-fix-v2-3-e01bf509359e@collabora.com \
--to=sebastian.reichel@collabora.com \
--cc=heiko@sntech.de \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mani@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=royalnet026@gmail.com \
--cc=vkoul@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
all inboxes | Powered by JetHome®