* [PATCH] phy: cadence-torrent: restore parent clock for refclk during resume
@ 2025-11-10 14:07 Thomas Richard (TI.com)
2025-11-19 15:14 ` Neil Armstrong
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richard (TI.com) @ 2025-11-10 14:07 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I
Cc: Thomas Petazzoni, Gregory CLEMENT, Udit Kumar, Prasanth Mantena,
Abhash Kumar, linux-phy, linux-kernel, Thomas Richard (TI.com)
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;
};
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@bootlin.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] phy: cadence-torrent: restore parent clock for refclk during resume
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
0 siblings, 0 replies; 2+ messages in thread
From: Neil Armstrong @ 2025-11-19 15:14 UTC (permalink / raw)
To: Thomas Richard (TI.com), Vinod Koul, Kishon Vijay Abraham I
Cc: Thomas Petazzoni, Gregory CLEMENT, Udit Kumar, Prasanth Mantena,
Abhash Kumar, linux-phy, linux-kernel
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,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-19 15:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox