netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] net: phylink: add phylink_set_mac_pm() helper
@ 2022-10-10 20:48 Shenwei Wang
  2022-10-10 20:48 ` [PATCH v4 1/2] net: phylink: add mac_managed_pm in phylink_config structure Shenwei Wang
  2022-10-10 20:48 ` [PATCH v4 2/2] net: stmmac: Enable mac_managed_pm phylink config Shenwei Wang
  0 siblings, 2 replies; 5+ messages in thread
From: Shenwei Wang @ 2022-10-10 20:48 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Russell King, Andrew Lunn, Heiner Kallweit
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev,
	linux-stm32, linux-arm-kernel, imx, Shenwei Wang

Per Russell's suggestion, the implementation is changed from the helper
function to add an extra property in phylink_config structure because this
change can easily cover SFP usecase too.

Changes in v4:
 - Clean up the codes in phylink.c
 - Continue the version number

Shenwei Wang (2):
  net: phylink: add mac_managed_pm in phylink_config structure
  net: stmmac: Enable mac_managed_pm phylink config

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
 drivers/net/phy/phylink.c                         | 3 +++
 include/linux/phylink.h                           | 2 ++
 3 files changed, 6 insertions(+)

--
2.34.1


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

* [PATCH v4 1/2] net: phylink: add mac_managed_pm in phylink_config structure
  2022-10-10 20:48 [PATCH v4 0/2] net: phylink: add phylink_set_mac_pm() helper Shenwei Wang
@ 2022-10-10 20:48 ` Shenwei Wang
  2022-10-13 10:43   ` Russell King (Oracle)
  2022-10-10 20:48 ` [PATCH v4 2/2] net: stmmac: Enable mac_managed_pm phylink config Shenwei Wang
  1 sibling, 1 reply; 5+ messages in thread
From: Shenwei Wang @ 2022-10-10 20:48 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Russell King, Andrew Lunn, Heiner Kallweit
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev,
	linux-stm32, linux-arm-kernel, imx, Shenwei Wang

The recent commit

'commit 47ac7b2f6a1f ("net: phy: Warn about incorrect
mdio_bus_phy_resume() state")'

requires the MAC driver explicitly tell the phy driver who is
managing the PM, otherwise you will see warning during resume
stage.

Add a boolean property in the phylink_config structure so that
the MAC driver can use it to tell the PHY driver if it wants to
manage the PM.

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 drivers/net/phy/phylink.c | 3 +++
 include/linux/phylink.h   | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index e9d62f9598f9..8d54bbe14b6a 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1439,6 +1439,9 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
 	if (phy_interrupt_is_valid(phy))
 		phy_request_interrupt(phy);
 
+	if (pl->config->mac_managed_pm)
+		phy->mac_managed_pm = true;
+
 	return 0;
 }
 
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 6d06896fc20d..a3adf7fe7eaf 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -88,6 +88,7 @@ enum phylink_op_type {
  *	(See commit 7cceb599d15d ("net: phylink: avoid mac_config calls")
  * @poll_fixed_state: if true, starts link_poll,
  *		      if MAC link is at %MLO_AN_FIXED mode.
+ * @mac_managed_pm: if true, indicate the MAC driver is responsible for PHY PM.
  * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
  * @get_fixed_state: callback to execute to determine the fixed link state,
  *		     if MAC link is at %MLO_AN_FIXED mode.
@@ -100,6 +101,7 @@ struct phylink_config {
 	enum phylink_op_type type;
 	bool legacy_pre_march2020;
 	bool poll_fixed_state;
+	bool mac_managed_pm;
 	bool ovr_an_inband;
 	void (*get_fixed_state)(struct phylink_config *config,
 				struct phylink_link_state *state);
-- 
2.34.1


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

* [PATCH v4 2/2] net: stmmac: Enable mac_managed_pm phylink config
  2022-10-10 20:48 [PATCH v4 0/2] net: phylink: add phylink_set_mac_pm() helper Shenwei Wang
  2022-10-10 20:48 ` [PATCH v4 1/2] net: phylink: add mac_managed_pm in phylink_config structure Shenwei Wang
@ 2022-10-10 20:48 ` Shenwei Wang
  2022-10-13  0:45   ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Shenwei Wang @ 2022-10-10 20:48 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Russell King, Andrew Lunn, Heiner Kallweit
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev,
	linux-stm32, linux-arm-kernel, imx, Shenwei Wang

Enable the mac_managed_pm configuration in the phylink_config
structure to avoid the kernel warning during system resume.

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8418e795cc21..537e8e61bb97 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1214,6 +1214,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
 	if (priv->plat->tx_queues_to_use > 1)
 		priv->phylink_config.mac_capabilities &=
 			~(MAC_10HD | MAC_100HD | MAC_1000HD);
+	priv->phylink_config.mac_managed_pm = true;
 
 	phylink = phylink_create(&priv->phylink_config, fwnode,
 				 mode, &stmmac_phylink_mac_ops);
-- 
2.34.1


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

* Re: [PATCH v4 2/2] net: stmmac: Enable mac_managed_pm phylink config
  2022-10-10 20:48 ` [PATCH v4 2/2] net: stmmac: Enable mac_managed_pm phylink config Shenwei Wang
@ 2022-10-13  0:45   ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-10-13  0:45 UTC (permalink / raw)
  To: Shenwei Wang
  Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	Russell King, Andrew Lunn, Heiner Kallweit, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, netdev, linux-stm32,
	linux-arm-kernel, imx

On Mon, 10 Oct 2022 15:48:27 -0500 Shenwei Wang wrote:
> Enable the mac_managed_pm configuration in the phylink_config
> structure to avoid the kernel warning during system resume.
> 
> Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>

Could you add a Fixes tag pointing to where the warning first appeared?

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

* Re: [PATCH v4 1/2] net: phylink: add mac_managed_pm in phylink_config structure
  2022-10-10 20:48 ` [PATCH v4 1/2] net: phylink: add mac_managed_pm in phylink_config structure Shenwei Wang
@ 2022-10-13 10:43   ` Russell King (Oracle)
  0 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2022-10-13 10:43 UTC (permalink / raw)
  To: Shenwei Wang
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Andrew Lunn, Heiner Kallweit,
	Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev,
	linux-stm32, linux-arm-kernel, imx

On Mon, Oct 10, 2022 at 03:48:26PM -0500, Shenwei Wang wrote:
> The recent commit
> 
> 'commit 47ac7b2f6a1f ("net: phy: Warn about incorrect
> mdio_bus_phy_resume() state")'
> 
> requires the MAC driver explicitly tell the phy driver who is
> managing the PM, otherwise you will see warning during resume
> stage.
> 
> Add a boolean property in the phylink_config structure so that
> the MAC driver can use it to tell the PHY driver if it wants to
> manage the PM.
> 
> Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>

Perfect, thank you!

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

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

end of thread, other threads:[~2022-10-13 10:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 20:48 [PATCH v4 0/2] net: phylink: add phylink_set_mac_pm() helper Shenwei Wang
2022-10-10 20:48 ` [PATCH v4 1/2] net: phylink: add mac_managed_pm in phylink_config structure Shenwei Wang
2022-10-13 10:43   ` Russell King (Oracle)
2022-10-10 20:48 ` [PATCH v4 2/2] net: stmmac: Enable mac_managed_pm phylink config Shenwei Wang
2022-10-13  0:45   ` Jakub Kicinski

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