net: phy: microchip: limit 100M workaround to link-down events on LAN88xx
authorOleksij Rempel <o.rempel@pengutronix.de>
Wed, 9 Jul 2025 13:07:53 +0000 (15:07 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 11 Jul 2025 01:08:16 +0000 (18:08 -0700)
Restrict the 100Mbit forced-mode workaround to link-down transitions
only, to prevent repeated link reset cycles in certain configurations.

The workaround was originally introduced to improve signal reliability
when switching cables between long and short distances. It temporarily
forces the PHY into 10 Mbps before returning to 100 Mbps.

However, when used with autonegotiating link partners (e.g., Intel i350),
executing this workaround on every link change can confuse the partner
and cause constant renegotiation loops. This results in repeated link
down/up transitions and the PHY never reaching a stable state.

Limit the workaround to only run during the PHY_NOLINK state. This ensures
it is triggered only once per link drop, avoiding disruptive toggling
while still preserving its intended effect.

Note: I am not able to reproduce the original issue that this workaround
addresses. I can only confirm that 100 Mbit mode works correctly in my
test setup. Based on code inspection, I assume the workaround aims to
reset some internal state machine or signal block by toggling speeds.
However, a PHY reset is already performed earlier in the function via
phy_init_hw(), which may achieve a similar effect. Without a reproducer,
I conservatively keep the workaround but restrict its conditions.

Fixes: e57cf3639c32 ("net: lan78xx: fix accessing the LAN7800's internal phy specific registers from the MAC driver")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250709130753.3994461-3-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/microchip.c

index 5e590b0a75e56b98288dff911494ce7e5035c70d..dc8634e7bcbe71cee0b4d7da14a9b61abc640acb 100644 (file)
@@ -332,7 +332,7 @@ static void lan88xx_link_change_notify(struct phy_device *phydev)
         * As workaround, set to 10 before setting to 100
         * at forced 100 F/H mode.
         */
-       if (!phydev->autoneg && phydev->speed == 100) {
+       if (phydev->state == PHY_NOLINK && !phydev->autoneg && phydev->speed == 100) {
                /* disable phy interrupt */
                temp = phy_read(phydev, LAN88XX_INT_MASK);
                temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;