[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d737b075-ca2f-483e-833f-c8e8a4cbc31d@linaro.org>
Date: Wed, 19 Nov 2025 16:14:20 +0100
From: Neil Armstrong <neil.armstrong@...aro.org>
To: "Thomas Richard (TI.com)" <thomas.richard@...tlin.com>,
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
Subject: Re: [PATCH] phy: cadence-torrent: restore parent clock for refclk
during resume
Hi,
On 11/10/25 15:07, Thomas Richard (TI.com) wrote:
> 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;
Can't this be stored in struct cdns_torrent_refclk_driver ?
> };
>
> 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);
Can't cdns_torrent_refclk_driver_get_parent()/set_parent() be used instead ?
Or even better add cdns_torrent_refclk_driver_suspend/_resume() functions to handle that.
Neil
> +
> 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,
Powered by blists - more mailing lists