net: stmmac: Turn off EEE on MAC link down
Subsystems (6)
PATCH 1/2 net: pcs: xpcs: fix incorrect steps on disable EEE
In reply to Wong Vee KheeWhen Energy-Efficient Ethernet(EEE) is disable from the MAC side, we need to clear the DW_VR_MII_EEE_TRN_LPI bit of DW_VR_MII_EEE_MCTRL1 register.
--- drivers/net/pcs/pcs-xpcs.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/pcs/pcs-xpcs.c +9 -4
@@ -666,6 +666,10 @@ int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable) {int ret; + ret =xpcs_read (xpcs,MDIO_MMD_VEND2 ,DW_VR_MII_EEE_MCTRL0 ); +if (ret <0 ) +return ret; +if (enable) {/* Enable EEE */ ret = DW_VR_MII_EEE_LTX_EN | DW_VR_MII_EEE_LRX_EN |
@@ -673,9 +677,6 @@ int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)DW_VR_MII_EEE_TX_EN_CTRL |DW_VR_MII_EEE_RX_EN_CTRL | mult_fact_100ns <<DW_VR_MII_EEE_MULT_FACT_100NS_SHIFT ; }else { - ret =xpcs_read (xpcs,MDIO_MMD_VEND2 ,DW_VR_MII_EEE_MCTRL0 ); -if (ret <0 ) -return ret; ret &= ~(DW_VR_MII_EEE_LTX_EN | DW_VR_MII_EEE_LRX_EN | DW_VR_MII_EEE_TX_QUIET_EN | DW_VR_MII_EEE_RX_QUIET_EN | DW_VR_MII_EEE_TX_EN_CTRL | DW_VR_MII_EEE_RX_EN_CTRL |
@@ -690,7 +691,11 @@ int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)if (ret <0 )return ret; - ret |=DW_VR_MII_EEE_TRN_LPI ; +if (enable) + ret |=DW_VR_MII_EEE_TRN_LPI ; +else + ret &= ~DW_VR_MII_EEE_TRN_LPI ; +return xpcs_write (xpcs,MDIO_MMD_VEND2 ,DW_VR_MII_EEE_MCTRL1 , ret); }EXPORT_SYMBOL_GPL (xpcs_config_eee);
Signature · 1 line
2.25.1
PATCH 2/2 net: stmmac: trigger PCS EEE to turn off on link down
In reply to Wong Vee KheeThe current implementation enable PCS EEE feature in the event of link up, but PCS EEE feature is not disabled on link down.
This patch makes sure PCE EEE feature is disabled on link down.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -1
@@ -477,6 +477,10 @@ bool stmmac_eee_init(struct stmmac_priv *priv)stmmac_lpi_entry_timer_config (priv,0 );del_timer_sync (&priv->eee_ctrl_timer);stmmac_set_eee_timer (priv, priv->hw,0 , eee_tw_timer); +if (priv->hw->xpcs) +xpcs_config_eee (priv->hw->xpcs, + priv->plat->mult_fact_100ns, + false); }mutex_unlock (&priv->lock);return false;
@@ -1038,7 +1042,7 @@ static void stmmac_mac_link_down(struct phylink_config *config,stmmac_mac_set (priv, priv->ioaddr, false); priv->eee_active = false; priv->tx_lpi_enabled = false; -stmmac_eee_init (priv); + priv->eee_enabled =stmmac_eee_init (priv);stmmac_set_eee_pls (priv, priv->hw, false);if (priv->dma_cap.fpesel)
Signature · 1 line
2.25.1
cover net: stmmac: Turn off EEE on MAC link down
This patch series ensure PCS EEE is turned off on the event of MAC link down.
Tested on Intel AlderLake-S (STMMAC + MaxLinear GPY211 PHY).
Wong Vee Khee (2):
net: pcs: xpcs: fix incorrect steps on disable EEE
net: stmmac: trigger PCS EEE to turn off on link down
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++++- drivers/net/pcs/pcs-xpcs.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
This series was applied to netdev/net.git (refs/heads/master):
Hello:
This series was applied to netdev/net.git (refs/heads/master):
Quoted 10 lines · On Tue, 5 Oct 2021 19:50:58 +0800 you wrote:
This patch series ensure PCS EEE is turned off on the event of MAC link down.
Tested on Intel AlderLake-S (STMMAC + MaxLinear GPY211 PHY).
Wong Vee Khee (2):
net: pcs: xpcs: fix incorrect steps on disable EEE
net: stmmac: trigger PCS EEE to turn off on link down[...]
Here is the summary with links:
- [net,1/2] net: pcs: xpcs: fix incorrect steps on disable EEE
https://git.kernel.org/netdev/net/c/590df78bc7d1 - [net,2/2] net: stmmac: trigger PCS EEE to turn off on link down https://git.kernel.org/netdev/net/c/d4aeaed80b0e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html