Skip to contentSkip to conversation

net: phy: realtek: disable PHY-mode EEE

PATCH Applied Russell King (Oracle) 4 participants 4 messages Mar 16, 2025 – Mar 21, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: realtek: disable PHY-mode EEE

Realtek RTL8211F has a "PHY-mode" EEE support which interferes with an IEEE 802.3 compliant implementation. This mode defaults to enabled, and results in the MAC receive path not seeing the link transition to LPI state.

Fix this by disabling PHY-mode EEE.

---
This patch isn't the best approach...

---
 drivers/net/phy/realtek/realtek_main.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/phy/realtek/realtek_main.c +9 -2
index 7a0b19d66aca..893c82479671 100644
@@ -33,6 +33,9 @@
 
 #define RTL8211F_PHYCR1				0x18
 #define RTL8211F_PHYCR2				0x19
+#define RTL8211F_CLKOUT_EN			BIT(0)
+#define RTL8211F_PHYCR2_PHY_EEE_ENABLE		BIT(5)
+
 #define RTL8211F_INSR				0x1d
 
 #define RTL8211F_LEDCR				0x10
@@ -55,8 +58,6 @@
 #define RTL8211E_TX_DELAY			BIT(12)
 #define RTL8211E_RX_DELAY			BIT(11)
 
-#define RTL8211F_CLKOUT_EN			BIT(0)
-
 #define RTL8201F_ISR				0x1e
 #define RTL8201F_ISR_ANERR			BIT(15)
 #define RTL8201F_ISR_DUPLEX			BIT(13)
@@ -453,6 +454,12 @@ static int rtl8211f_config_init(struct phy_device *phydev)
 			str_enabled_disabled(val_rxdly));
 	}
 
+	/* Disable PHY-mode EEE so LPI is passed to the MAC */
+	ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
+			       RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0);
+	if (ret)
+		return ret;
+
 	if (priv->has_phycr2) {
 		ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
 				       RTL8211F_CLKOUT_EN, priv->phycr2);
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Russell King (Oracle)

Realtek RTL8211F has a "PHY-mode" EEE support which interferes with an IEEE 802.3 compliant implementation. This mode defaults to enabled, and results in the MAC receive path not seeing the link transition to LPI state.

Fix this by disabling PHY-mode EEE.

---
This patch isn't the best approach...

But i guess a better approach requires we have support for PHY-mode EEE? Which at the moment we do not have.

Andrew

#2 lore raw
Quoted 6 lines · Andrew Lunn
Quoted 5 lines · Russell King (Oracle)

Realtek RTL8211F has a "PHY-mode" EEE support which interferes with an IEEE 802.3 compliant implementation. This mode defaults to enabled, and results in the MAC receive path not seeing the link transition to LPI state.

Quoted 8 lines
Quoted 5 lines

Fix this by disabling PHY-mode EEE.

---
This patch isn't the best approach...

But i guess a better approach requires we have support for PHY-mode EEE? Which at the moment we do not have.

I'm not sure what this "PHY-mode" is - the datasheet for the PHY doesn't mention the mode in its functional description, it only exists as a simple description in the register documentation!

What I do know is that with this bit set, a MAC behind it never sees the LPI signalled from the remote end, but 'scope shows that the physical link has quietened down except for what I'd call the chirps to keep both ends synchronised.

With the bit clear, then everything works as expected - as tested with the stmmac driver on a Tegra platform. The stmmac MAC sees LPI on its receive side, and all the nice juicy stmmac bugs requiring RXC to be running can then be reproduced. :)

Not sure whether it would be better to fix stmmac first before this is merged, but in order to develop and test, it needs to be fixed first so the bug(s) can be reproduced. Given the netdev backlog, it is unlikely that I'll get the stmmac patches out before the merge window opens and net-next closes - so the "regression" that nvidia reported is not going to get fixed in this cycle.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#3 lore raw
In reply to Russell King (Oracle)
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Sun, 16 Mar 2025 12:39:54 +0000 you wrote:

Realtek RTL8211F has a "PHY-mode" EEE support which interferes with an IEEE 802.3 compliant implementation. This mode defaults to enabled, and results in the MAC receive path not seeing the link transition to LPI state.

Fix this by disabling PHY-mode EEE.

[...]

Here is the summary with links:
- [net-next] net: phy: realtek: disable PHY-mode EEE

    https://git.kernel.org/netdev/net-next/c/bfc17c165835

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html