]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: phy: smsc: Fix Auto-MDIX configuration when disabled by strap
authorOleksij Rempel <o.rempel@pengutronix.de>
Thu, 3 Jul 2025 11:49:39 +0000 (13:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:30:47 +0000 (18:30 +0200)
[ Upstream commit a141af8eb2272ab0f677a7f2653874840bc9b214 ]

Correct the Auto-MDIX configuration to ensure userspace settings are
respected when the feature is disabled by the AUTOMDIX_EN hardware strap.

The LAN9500 PHY allows its default MDI-X mode to be configured via a
hardware strap. If this strap sets the default to "MDI-X off", the
driver was previously unable to enable Auto-MDIX from userspace.

When handling the ETH_TP_MDI_AUTO case, the driver would set the
SPECIAL_CTRL_STS_AMDIX_ENABLE_ bit but neglected to set the required
SPECIAL_CTRL_STS_OVRRD_AMDIX_ bit. Without the override flag, the PHY
falls back to its hardware strap default, ignoring the software request.

This patch corrects the behavior by also setting the override bit when
enabling Auto-MDIX. This ensures that the userspace configuration takes
precedence over the hardware strap, allowing Auto-MDIX to be enabled
correctly in all scenarios.

Fixes: 05b35e7eb9a1 ("smsc95xx: add phylib support")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Andre Edich <andre.edich@microchip.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20250703114941.3243890-2-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/phy/smsc.c

index 36dcf6c7f445d0fb1d0932c31d92513e57b3c97d..6d9069a53db1d61e6fb7817b6734ccb2dcb33b50 100644 (file)
@@ -155,7 +155,8 @@ static int lan87xx_config_aneg(struct phy_device *phydev)
                        SPECIAL_CTRL_STS_AMDIX_STATE_;
                break;
        case ETH_TP_MDI_AUTO:
-               val = SPECIAL_CTRL_STS_AMDIX_ENABLE_;
+               val = SPECIAL_CTRL_STS_OVRRD_AMDIX_ |
+                       SPECIAL_CTRL_STS_AMDIX_ENABLE_;
                break;
        default:
                return genphy_config_aneg(phydev);