]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
amd-xgbe: fix MAC_AUTO_SW handling in CL37 AN
authorPrashanth Kumar KR <PrashanthKumar.K.R@amd.com>
Thu, 9 Jul 2026 09:50:06 +0000 (15:20 +0530)
committerJakub Kicinski <kuba@kernel.org>
Tue, 21 Jul 2026 16:12:36 +0000 (09:12 -0700)
MAC_AUTO_SW (VR_MII_DIG_CTRL1 bit 9) enables automatic XPCS speed
mode switching after CL37 auto-negotiation and is only meaningful in
SGMII MAC mode. The original code unconditionally set this bit on
every call to xgbe_an37_set(), including when called from
xgbe_an37_disable() with enable=false. This left MAC_AUTO_SW=1 after
AN was disabled, causing the XPCS to autonomously switch speed from
stale AN state during subsequent mode changes, breaking SGMII speed
negotiation on 1G copper SFP modules.

Patrick: This was breaking negotiation for all 1G SFP modules,
not just copper modules.

Fixes: 42fd432fe6d3 ("amd-xgbe: align CL37 AN sequence as per databook")
Reported-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Link: https://lore.kernel.org/netdev/CAEg67GmFS0Q4oSZkz8zWdOzckSth9_vBPiOy6a7-d697C2w2Xg@mail.gmail.com
Signed-off-by: Prashanth Kumar KR <PrashanthKumar.K.R@amd.com>
Tested-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Link: https://patch.msgid.link/20260709095006.3683940-1-prashanthkumar.k.r@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c

index fa0df61812076a758f1f3c0b05cff80506610c07..12770af031eb8bf35eee71832af5d9bde85a39a7 100644 (file)
@@ -267,9 +267,14 @@ static void xgbe_an37_set(struct xgbe_prv_data *pdata, bool enable,
 
        XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_CTRL1, reg);
 
-       reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
-       reg |= XGBE_VEND2_MAC_AUTO_SW;
-       XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
+       if (pdata->an_mode == XGBE_AN_MODE_CL37_SGMII) {
+               reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
+               if (enable)
+                       reg |= XGBE_VEND2_MAC_AUTO_SW;
+               else
+                       reg &= ~XGBE_VEND2_MAC_AUTO_SW;
+               XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
+       }
 }
 
 static void xgbe_an37_restart(struct xgbe_prv_data *pdata)