lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251110-phy-cadence-torrent-resume-restore-refclk-parent-v1-1-1be87af7d19e@bootlin.com>
Date: Mon, 10 Nov 2025 15:07:57 +0100
From: "Thomas Richard (TI.com)" <thomas.richard@...tlin.com>
To: Vinod Koul <vkoul@...nel.org>, 
 Kishon Vijay Abraham I <kishon@...nel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@...tlin.com>, 
 Gregory CLEMENT <gregory.clement@...tlin.com>, Udit Kumar <u-kumar1@...com>, 
 Prasanth Mantena <p-mantena@...com>, Abhash Kumar <a-kumar2@...com>, 
 linux-phy@...ts.infradead.org, linux-kernel@...r.kernel.org, 
 "Thomas Richard (TI.com)" <thomas.richard@...tlin.com>
Subject: [PATCH] phy: cadence-torrent: restore parent clock for refclk
 during resume

While suspend and resume, parent clock config for refclk was getting lost.
So save and restore it in suspend and resume operations.

Signed-off-by: Thomas Richard (TI.com) <thomas.richard@...tlin.com>
---
 drivers/phy/cadence/phy-cadence-torrent.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index 37fa4bad6bd7..17d09e7d866d 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -384,6 +384,7 @@ struct cdns_torrent_phy {
 	struct regmap_field *phy_reset_ctrl;
 	struct regmap_field *phy_pcs_iso_link_ctrl_1[MAX_NUM_LANES];
 	struct clk_hw_onecell_data *clk_hw_data;
+	int refclk_parent;
 };
 
 enum phy_powerstate {
@@ -3329,8 +3330,13 @@ static const struct cdns_torrent_vals sgmii_qsgmii_xcvr_diag_ln_vals = {
 static int cdns_torrent_phy_suspend_noirq(struct device *dev)
 {
 	struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(dev);
+	struct clk_hw *refclk_hw = cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER];
+	struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(refclk_hw);
 	int i;
 
+	regmap_field_read(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4],
+			  &cdns_phy->refclk_parent);
+
 	reset_control_assert(cdns_phy->phy_rst);
 	reset_control_assert(cdns_phy->apb_rst);
 	for (i = 0; i < cdns_phy->nsubnodes; i++)
@@ -3349,9 +3355,14 @@ static int cdns_torrent_phy_suspend_noirq(struct device *dev)
 static int cdns_torrent_phy_resume_noirq(struct device *dev)
 {
 	struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(dev);
+	struct clk_hw *refclk_hw = cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER];
+	struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(refclk_hw);
 	int node = cdns_phy->nsubnodes;
 	int ret, i;
 
+	regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4],
+			   cdns_phy->refclk_parent);
+
 	ret = cdns_torrent_clk(cdns_phy);
 	if (ret)
 		return ret;

---
base-commit: 415559c31bd4f19fde440f759d529a448743fc8c
change-id: 20251110-phy-cadence-torrent-resume-restore-refclk-parent-f59fb5fc69fa

Best regards,
-- 
Thomas Richard (TI.com) <thomas.richard@...tlin.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ