All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: stmmac: Turn off EEE on MAC link down
@ 2021-10-05 11:50 ` Wong Vee Khee
  0 siblings, 0 replies; 8+ messages in thread
From: Wong Vee Khee @ 2021-10-05 11:50 UTC (permalink / raw)
  To: David S . Miller, Jose Abreu, Andrew Lunn, Heiner Kallweit,
	Russell King, Jakub Kicinski, Giuseppe Cavallaro,
	Alexandre Torgue, Maxime Coquelin
  Cc: Michael Sit Wei Hong, Wong Vee Khee, Wong Vee Khee, netdev,
	linux-kernel, linux-stm32, linux-arm-kernel

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

-- 
2.25.1


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

* [PATCH net 0/2] net: stmmac: Turn off EEE on MAC link down
@ 2021-10-05 11:50 ` Wong Vee Khee
  0 siblings, 0 replies; 8+ messages in thread
From: Wong Vee Khee @ 2021-10-05 11:50 UTC (permalink / raw)
  To: David S . Miller, Jose Abreu, Andrew Lunn, Heiner Kallweit,
	Russell King, Jakub Kicinski, Giuseppe Cavallaro,
	Alexandre Torgue, Maxime Coquelin
  Cc: Michael Sit Wei Hong, Wong Vee Khee, Wong Vee Khee, netdev,
	linux-kernel, linux-stm32, linux-arm-kernel

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

-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net 1/2] net: pcs: xpcs: fix incorrect steps on disable EEE
  2021-10-05 11:50 ` Wong Vee Khee
@ 2021-10-05 11:50   ` Wong Vee Khee
  -1 siblings, 0 replies; 8+ messages in thread
From: Wong Vee Khee @ 2021-10-05 11:50 UTC (permalink / raw)
  To: David S . Miller, Jose Abreu, Andrew Lunn, Heiner Kallweit,
	Russell King, Jakub Kicinski, Giuseppe Cavallaro,
	Alexandre Torgue, Maxime Coquelin
  Cc: Michael Sit Wei Hong, Wong Vee Khee, Wong Vee Khee, netdev,
	linux-kernel, linux-stm32, linux-arm-kernel

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

Fixes: 7617af3d1a5e ("net: pcs: Introducing support for DWC xpcs Energy Efficient Ethernet")
Cc: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
---
 drivers/net/pcs/pcs-xpcs.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index fb0a83dc09ac..59ebb0c0d86f 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -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);
-- 
2.25.1


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

* [PATCH net 1/2] net: pcs: xpcs: fix incorrect steps on disable EEE
@ 2021-10-05 11:50   ` Wong Vee Khee
  0 siblings, 0 replies; 8+ messages in thread
From: Wong Vee Khee @ 2021-10-05 11:50 UTC (permalink / raw)
  To: David S . Miller, Jose Abreu, Andrew Lunn, Heiner Kallweit,
	Russell King, Jakub Kicinski, Giuseppe Cavallaro,
	Alexandre Torgue, Maxime Coquelin
  Cc: Michael Sit Wei Hong, Wong Vee Khee, Wong Vee Khee, netdev,
	linux-kernel, linux-stm32, linux-arm-kernel

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

Fixes: 7617af3d1a5e ("net: pcs: Introducing support for DWC xpcs Energy Efficient Ethernet")
Cc: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
---
 drivers/net/pcs/pcs-xpcs.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index fb0a83dc09ac..59ebb0c0d86f 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -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);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net 2/2] net: stmmac: trigger PCS EEE to turn off on link down
  2021-10-05 11:50 ` Wong Vee Khee
@ 2021-10-05 11:51   ` Wong Vee Khee
  -1 siblings, 0 replies; 8+ messages in thread
From: Wong Vee Khee @ 2021-10-05 11:51 UTC (permalink / raw)
  To: David S . Miller, Jose Abreu, Andrew Lunn, Heiner Kallweit,
	Russell King, Jakub Kicinski, Giuseppe Cavallaro,
	Alexandre Torgue, Maxime Coquelin
  Cc: Michael Sit Wei Hong, Wong Vee Khee, Wong Vee Khee, netdev,
	linux-kernel, linux-stm32, linux-arm-kernel

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

Fixes: 656ed8b015f1 ("net: stmmac: fix EEE init issue when paired with EEE capable PHYs")
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 981ccf47dcea..eb3b7bf771d7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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)
-- 
2.25.1


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

* [PATCH net 2/2] net: stmmac: trigger PCS EEE to turn off on link down
@ 2021-10-05 11:51   ` Wong Vee Khee
  0 siblings, 0 replies; 8+ messages in thread
From: Wong Vee Khee @ 2021-10-05 11:51 UTC (permalink / raw)
  To: David S . Miller, Jose Abreu, Andrew Lunn, Heiner Kallweit,
	Russell King, Jakub Kicinski, Giuseppe Cavallaro,
	Alexandre Torgue, Maxime Coquelin
  Cc: Michael Sit Wei Hong, Wong Vee Khee, Wong Vee Khee, netdev,
	linux-kernel, linux-stm32, linux-arm-kernel

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

Fixes: 656ed8b015f1 ("net: stmmac: fix EEE init issue when paired with EEE capable PHYs")
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 981ccf47dcea..eb3b7bf771d7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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)
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net 0/2] net: stmmac: Turn off EEE on MAC link down
  2021-10-05 11:50 ` Wong Vee Khee
@ 2021-10-06 10:20   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-06 10:20 UTC (permalink / raw)
  To: Wong Vee Khee
  Cc: davem, Jose.Abreu, andrew, hkallweit1, linux, kuba,
	peppe.cavallaro, alexandre.torgue, mcoquelin.stm32,
	michael.wei.hong.sit, veekhee, netdev, linux-kernel, linux-stm32,
	linux-arm-kernel

Hello:

This series was applied to netdev/net.git (refs/heads/master):

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



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

* Re: [PATCH net 0/2] net: stmmac: Turn off EEE on MAC link down
@ 2021-10-06 10:20   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-06 10:20 UTC (permalink / raw)
  To: Wong Vee Khee
  Cc: davem, Jose.Abreu, andrew, hkallweit1, linux, kuba,
	peppe.cavallaro, alexandre.torgue, mcoquelin.stm32,
	michael.wei.hong.sit, veekhee, netdev, linux-kernel, linux-stm32,
	linux-arm-kernel

Hello:

This series was applied to netdev/net.git (refs/heads/master):

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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-10-06 10:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 11:50 [PATCH net 0/2] net: stmmac: Turn off EEE on MAC link down Wong Vee Khee
2021-10-05 11:50 ` Wong Vee Khee
2021-10-05 11:50 ` [PATCH net 1/2] net: pcs: xpcs: fix incorrect steps on disable EEE Wong Vee Khee
2021-10-05 11:50   ` Wong Vee Khee
2021-10-05 11:51 ` [PATCH net 2/2] net: stmmac: trigger PCS EEE to turn off on link down Wong Vee Khee
2021-10-05 11:51   ` Wong Vee Khee
2021-10-06 10:20 ` [PATCH net 0/2] net: stmmac: Turn off EEE on MAC " patchwork-bot+netdevbpf
2021-10-06 10:20   ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.