linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v2, PATCH 0/1] net: stmmac: disable/enable ptp_ref_clk in suspend/resume flow
@ 2019-10-15  3:24 Biao Huang
  2019-10-15  3:24 ` [v2, PATCH] " Biao Huang
  0 siblings, 1 reply; 3+ messages in thread
From: Biao Huang @ 2019-10-15  3:24 UTC (permalink / raw)
  To: davem, Jose Abreu, andrew
  Cc: jakub.kicinski, Giuseppe Cavallaro, Alexandre Torgue,
	Maxime Coquelin, Matthias Brugger, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, linux-mediatek, yt.shen,
	biao.huang, jianguo.zhang, boon.leong.ong

changes in v2:
        1. add Fixes in commit message
        2. replace clk_disable/clk_enable with clk_disable_unprepare/clk_prepare_enable
        to ensure the source pll can be closed/open in suspend/resume for power saving.

Biao Huang (1):
  net: stmmac: disable/enable ptp_ref_clk in suspend/resume flow

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--
2.18.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [v2, PATCH] net: stmmac: disable/enable ptp_ref_clk in suspend/resume flow
  2019-10-15  3:24 [v2, PATCH 0/1] net: stmmac: disable/enable ptp_ref_clk in suspend/resume flow Biao Huang
@ 2019-10-15  3:24 ` Biao Huang
  2019-10-16 20:27   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Biao Huang @ 2019-10-15  3:24 UTC (permalink / raw)
  To: davem, Jose Abreu, andrew
  Cc: jakub.kicinski, Giuseppe Cavallaro, Alexandre Torgue,
	Maxime Coquelin, Matthias Brugger, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, linux-mediatek, yt.shen,
	biao.huang, jianguo.zhang, boon.leong.ong

disable ptp_ref_clk in suspend flow, and enable it in resume flow.

Fixes: f573c0b9c4e0 ("stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure")
Signed-off-by: Biao Huang <biao.huang@mediatek.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index d3232738fb25..d7c12b86b94f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4737,8 +4737,10 @@ int stmmac_suspend(struct device *dev)
 		stmmac_mac_set(priv, priv->ioaddr, false);
 		pinctrl_pm_select_sleep_state(priv->device);
 		/* Disable clock in case of PWM is off */
-		clk_disable(priv->plat->pclk);
-		clk_disable(priv->plat->stmmac_clk);
+		if (priv->plat->clk_ptp_ref)
+			clk_disable_unprepare(priv->plat->clk_ptp_ref);
+		clk_disable_unprepare(priv->plat->pclk);
+		clk_disable_unprepare(priv->plat->stmmac_clk);
 	}
 	mutex_unlock(&priv->lock);
 
@@ -4801,8 +4803,10 @@ int stmmac_resume(struct device *dev)
 	} else {
 		pinctrl_pm_select_default_state(priv->device);
 		/* enable the clk previously disabled */
-		clk_enable(priv->plat->stmmac_clk);
-		clk_enable(priv->plat->pclk);
+		clk_prepare_enable(priv->plat->stmmac_clk);
+		clk_prepare_enable(priv->plat->pclk);
+		if (priv->plat->clk_ptp_ref)
+			clk_prepare_enable(priv->plat->clk_ptp_ref);
 		/* reset the phy so that it's ready */
 		if (priv->mii)
 			stmmac_mdio_reset(priv->mii);
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [v2, PATCH] net: stmmac: disable/enable ptp_ref_clk in suspend/resume flow
  2019-10-15  3:24 ` [v2, PATCH] " Biao Huang
@ 2019-10-16 20:27   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2019-10-16 20:27 UTC (permalink / raw)
  To: biao.huang
  Cc: joabreu, andrew, jakub.kicinski, peppe.cavallaro,
	alexandre.torgue, mcoquelin.stm32, matthias.bgg, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel, linux-mediatek,
	yt.shen, jianguo.zhang, boon.leong.ong

From: Biao Huang <biao.huang@mediatek.com>
Date: Tue, 15 Oct 2019 11:24:44 +0800

> disable ptp_ref_clk in suspend flow, and enable it in resume flow.
> 
> Fixes: f573c0b9c4e0 ("stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure")
> Signed-off-by: Biao Huang <biao.huang@mediatek.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-16 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15  3:24 [v2, PATCH 0/1] net: stmmac: disable/enable ptp_ref_clk in suspend/resume flow Biao Huang
2019-10-15  3:24 ` [v2, PATCH] " Biao Huang
2019-10-16 20:27   ` David Miller

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).