linux-phy.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: "Thomas Richard (TI.com)" <thomas.richard@bootlin.com>,
	Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@kernel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Gregory CLEMENT <gregory.clement@bootlin.com>,
	Udit Kumar <u-kumar1@ti.com>, Prasanth Mantena <p-mantena@ti.com>,
	Abhash Kumar <a-kumar2@ti.com>,
	linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] phy: cadence-torrent: restore parent clock for refclk during resume
Date: Wed, 19 Nov 2025 16:14:20 +0100	[thread overview]
Message-ID: <d737b075-ca2f-483e-833f-c8e8a4cbc31d@linaro.org> (raw)
In-Reply-To: <20251110-phy-cadence-torrent-resume-restore-refclk-parent-v1-1-1be87af7d19e@bootlin.com>

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@bootlin.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,


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

      reply	other threads:[~2025-11-19 15:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 14:07 [PATCH] phy: cadence-torrent: restore parent clock for refclk during resume Thomas Richard (TI.com)
2025-11-19 15:14 ` Neil Armstrong [this message]

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=d737b075-ca2f-483e-833f-c8e8a4cbc31d@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=a-kumar2@ti.com \
    --cc=gregory.clement@bootlin.com \
    --cc=kishon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=p-mantena@ti.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=thomas.richard@bootlin.com \
    --cc=u-kumar1@ti.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;
as well as URLs for NNTP newsgroup(s).