net: phylink: add phylink_set_mac_pm() helper
Subsystems (7)
v4 cover net: phylink: add phylink_set_mac_pm() helper
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
PATCH v4 1/2 net: phylink: add mac_managed_pm in phylink_config structure
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.
--- drivers/net/phy/phylink.c | 3 +++ include/linux/phylink.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/net/phy/phylink.c +3 -0
@@ -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 ; }
include/linux/phylink.h +2 -0
@@ -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);
Signature · 1 line
2.34.1
Re: [PATCH v4 1/2] net: phylink: add mac_managed_pm in phylink_config structure
Quoted 9 lines · Shenwei Wang
The recent commit
'commit
47ac7b2f6a1f("net: phy: Warn about incorrectmdio_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.
Quoted 5 lines
Add a boolean property in the
phylink_configstructure 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 <[email protected]>
Perfect, thank you!
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
PATCH v4 2/2 net: stmmac: Enable mac_managed_pm phylink config
In reply to Shenwei WangEnable the mac_managed_pm configuration in the phylink_config structure to avoid the kernel warning during system resume.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -0
@@ -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);
Signature · 1 line
2.34.1
Jakub Kicinski
maintainerRe: [PATCH v4 2/2] net: stmmac: Enable mac_managed_pm phylink config
Quoted 4 lines · On Mon, 10 Oct 2022 15:48:27 -0500 Shenwei Wang wrote:
Enable the
mac_managed_pmconfiguration in thephylink_configstructure to avoid the kernel warning during system resume.Signed-off-by Shenwei Wang <[email protected]>
Could you add a Fixes tag pointing to where the warning first appeared?