diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2025-02-28 11:11:56 +0000 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2025-04-04 14:39:24 +0100 |
commit | 2e7d12573517272c5c4a0591dfc8afa3ee9a0f78 (patch) | |
tree | f3df6630e872414df63ee5d127a099e55f682630 | |
parent | 632c5b200347b1d9f24d537b339d7ee03cd81d5e (diff) |
net: phylink: add phylink_prepare_resume()
Add a resume preparation function, which will ensure that the receive
clock from the PHY is appropriately configured while resuming.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/net/phy/phylink.c | 24 | ||||
-rw-r--r-- | include/linux/phylink.h | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 10687f50c95c..91506ed192e8 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2657,6 +2657,30 @@ void phylink_suspend(struct phylink *pl, bool mac_wol) EXPORT_SYMBOL_GPL(phylink_suspend); /** + * phylink_prepare_resume() - prepare to resume a network device + * @pl: a pointer to a &struct phylink returned from phylink_create() + * + * Optional, thus must be called prior to phylink_resume(). + * + * Prepare to resume a network device, preparing the PHY as necessary. + */ +void phylink_prepare_resume(struct phylink *pl) +{ + ASSERT_RTNL(); + + /* If the MAC requires the receive clock, but receive clock + * stop was enabled at the PHY, we need to ensure that the + * receive clock is running. Disable receive clock stop. + * phylink_resume() will re-enable it if necessary. + */ + if (pl->mac_supports_eee_ops && pl->phydev && + pl->config->mac_requires_rxc && + pl->config->eee_rx_clk_stop_enable) + phy_eee_rx_clock_stop(pl->phydev, false); +} +EXPORT_SYMBOL_GPL(phylink_prepare_resume); + +/** * phylink_resume() - handle a network device resume event * @pl: a pointer to a &struct phylink returned from phylink_create() * diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 41ab85e591ad..e7059ad47e20 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -701,6 +701,7 @@ void phylink_start(struct phylink *); void phylink_stop(struct phylink *); void phylink_suspend(struct phylink *pl, bool mac_wol); +void phylink_prepare_resume(struct phylink *pl); void phylink_resume(struct phylink *pl); void phylink_ethtool_get_wol(struct phylink *, struct ethtool_wolinfo *); |