From nobody Mon Dec 1 22:37:31 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBAA033A00A for ; Wed, 26 Nov 2025 15:33:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764171235; cv=none; b=mOPQxhVu2k0KSryOJ1SDz1VQJKY6u2ds0BkgDKRBcOvPm9CgmOg2wkPTgrXeFwaeC1CVCjkOWzS0VGaWXHssLMy3m7z6edGlIlE6WiyzMr8hyYWr0r1ZHP2VtKMn1Q5MrE6uvqmBJ24VditYnfOCQYAoj6XWYVCZSRsffY98FxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764171235; c=relaxed/simple; bh=g8CqGlkbjjjzU+D/2zBZMciDrLZFP4WolgdD0xy04XY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=uTz9MoQPUjAoZukZ4d0Zx8fCX1mWG2FYnrMLnxERDgM9FcFUpBKSjfDIM7AeT9I18RWqJJ+4L+fGj+umQTYMJOW1Wq8bmnAQ0MWTXrQwStOLC1VLmCd2PezFxoZVXL/Cgs4g00TCxTVjxN2d5muCRnpvcQpRcBMa3H44KTDO1Ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=HLYw/BQS; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="HLYw/BQS" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 25A481A1D83; Wed, 26 Nov 2025 15:33:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E710B60721; Wed, 26 Nov 2025 15:33:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8166D102F1B84; Wed, 26 Nov 2025 16:33:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1764171224; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding; bh=lsp+NJNBTPSySlUe7BHmxpBQDMNBrZS8TeTFL/zK5No=; b=HLYw/BQSdsL+LQRm985OiJHaD7YVi4TXpLl1L3FK/qmSm5d4kmukfWQq75vqVSJj7mKiRQ RgMKdN8CJG1srErTMLjDYaXigkRD8WKNhWpV2qPpOHhvbGrmH6G4XjtGR324QdobGovNEo Uxe/qjb/8niE2EjCzmHnkCPpVta46+wb0J4RyUGHyUKwTPGg8ApVjYBbkU3jU8Vba8A5+Q LJhfWzp2NqxaJjqNPJrYC3qdD1/ex66rCFtMvNDkzxjFlbjFfnR4Hn7GhfMWh+ai9bYjs3 o3eVc+5AtSL4soSZbXBcINX7yFAXHuVTuM++JU0YFQk6qaid20sxNdF6TdRUMg== From: "Thomas Richard (TI.com)" Date: Wed, 26 Nov 2025 16:33:37 +0100 Subject: [PATCH v2] phy: cadence-torrent: restore parent clock for refclk during resume Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251126-phy-cadence-torrent-resume-restore-refclk-parent-v2-1-5d2eaa958b06@bootlin.com> X-B4-Tracking: v=1; b=H4sIANAdJ2kC/6WOQQ6DMAwEv4J8riuCRCk99R+IQwhOsQoJSigqQ vy9Dl+ofFjNruz1DpECU4RHtkOglSN7J1BcMjCDdi9C7oWhyItSKZXjPGxodE/OEC4+BHILBoq fiZKIk9Sa8Y2zPkNb1rYrrbnVVoOcnSXm71nZtMIDp63t/GBVyf2jbFUo09G90rbqVU3PzvtlZ Hc1foL2OI4fj35gk/IAAAA= X-Change-ID: 20251110-phy-cadence-torrent-resume-restore-refclk-parent-f59fb5fc69fa To: Vinod Koul , Kishon Vijay Abraham I Cc: Thomas Petazzoni , Gregory CLEMENT , Udit Kumar , Prasanth Mantena , Abhash Kumar , linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, "Thomas Richard (TI.com)" X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 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) Reviewed-by: Neil Armstrong --- Changes in v2: - store parent configuration in cdns_torrent_refclk_driver. - add cdns_torrent_refclk_driver_suspend/_resume() functions. - use get_parent() and set_parent() operations to save and restore the configuration. - Link to v1: https://lore.kernel.org/r/20251110-phy-cadence-torrent-resume= -restore-refclk-parent-v1-1-1be87af7d19e@bootlin.com --- drivers/phy/cadence/phy-cadence-torrent.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadenc= e/phy-cadence-torrent.c index 37fa4bad6bd72..877f22177c699 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -397,6 +397,7 @@ struct cdns_torrent_refclk_driver { struct clk_hw hw; struct regmap_field *cmn_fields[REFCLK_OUT_NUM_CMN_CONFIG]; struct clk_init_data clk_data; + u8 parent_index; }; =20 #define to_cdns_torrent_refclk_driver(_hw) \ @@ -3326,11 +3327,29 @@ static const struct cdns_torrent_vals sgmii_qsgmii_= xcvr_diag_ln_vals =3D { .num_regs =3D ARRAY_SIZE(sgmii_qsgmii_xcvr_diag_ln_regs), }; =20 +static void cdns_torrent_refclk_driver_suspend(struct cdns_torrent_phy *cd= ns_phy) +{ + struct clk_hw *hw =3D cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIV= ER]; + struct cdns_torrent_refclk_driver *refclk_driver =3D to_cdns_torrent_refc= lk_driver(hw); + + refclk_driver->parent_index =3D cdns_torrent_refclk_driver_get_parent(hw); +} + +static int cdns_torrent_refclk_driver_resume(struct cdns_torrent_phy *cdns= _phy) +{ + struct clk_hw *hw =3D cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIV= ER]; + struct cdns_torrent_refclk_driver *refclk_driver =3D to_cdns_torrent_refc= lk_driver(hw); + + return cdns_torrent_refclk_driver_set_parent(hw, refclk_driver->parent_in= dex); +} + static int cdns_torrent_phy_suspend_noirq(struct device *dev) { struct cdns_torrent_phy *cdns_phy =3D dev_get_drvdata(dev); int i; =20 + cdns_torrent_refclk_driver_suspend(cdns_phy); + reset_control_assert(cdns_phy->phy_rst); reset_control_assert(cdns_phy->apb_rst); for (i =3D 0; i < cdns_phy->nsubnodes; i++) @@ -3352,6 +3371,10 @@ static int cdns_torrent_phy_resume_noirq(struct devi= ce *dev) int node =3D cdns_phy->nsubnodes; int ret, i; =20 + ret =3D cdns_torrent_refclk_driver_resume(cdns_phy); + if (ret) + return ret; + ret =3D cdns_torrent_clk(cdns_phy); if (ret) return ret; --- base-commit: c0ea2ae3b2d7fb9eb4bc14400e39d8fb4f510714 change-id: 20251110-phy-cadence-torrent-resume-restore-refclk-parent-f59fb5= fc69fa Best regards, --=20 Thomas Richard (TI.com)