netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: realtek: disable PHY-mode EEE
@ 2025-03-16 12:39 Russell King (Oracle)
  2025-03-17 21:40 ` Andrew Lunn
  2025-03-21 20:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2025-03-16 12:39 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev,
	Paolo Abeni

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.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
This patch isn't the best approach...
---
 drivers/net/phy/realtek/realtek_main.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
index 7a0b19d66aca..893c82479671 100644
--- a/drivers/net/phy/realtek/realtek_main.c
+++ b/drivers/net/phy/realtek/realtek_main.c
@@ -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);
-- 
2.30.2


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

* Re: [PATCH net-next] net: phy: realtek: disable PHY-mode EEE
  2025-03-16 12:39 [PATCH net-next] net: phy: realtek: disable PHY-mode EEE Russell King (Oracle)
@ 2025-03-17 21:40 ` Andrew Lunn
  2025-03-17 22:13   ` Russell King (Oracle)
  2025-03-21 20:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2025-03-17 21:40 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni

On Sun, Mar 16, 2025 at 12:39:54PM +0000, Russell King (Oracle) 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.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> 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.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next] net: phy: realtek: disable PHY-mode EEE
  2025-03-17 21:40 ` Andrew Lunn
@ 2025-03-17 22:13   ` Russell King (Oracle)
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2025-03-17 22:13 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni

On Mon, Mar 17, 2025 at 10:40:38PM +0100, Andrew Lunn wrote:
> On Sun, Mar 16, 2025 at 12:39:54PM +0000, Russell King (Oracle) 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.
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > 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.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

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

* Re: [PATCH net-next] net: phy: realtek: disable PHY-mode EEE
  2025-03-16 12:39 [PATCH net-next] net: phy: realtek: disable PHY-mode EEE Russell King (Oracle)
  2025-03-17 21:40 ` Andrew Lunn
@ 2025-03-21 20:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-21 20:50 UTC (permalink / raw)
  To: Russell King; +Cc: andrew, hkallweit1, davem, edumazet, kuba, netdev, pabeni

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-03-21 20:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-16 12:39 [PATCH net-next] net: phy: realtek: disable PHY-mode EEE Russell King (Oracle)
2025-03-17 21:40 ` Andrew Lunn
2025-03-17 22:13   ` Russell King (Oracle)
2025-03-21 20:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).