]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: only call stmmac_pcs_ctrl_ane() for integrated SGMII PCS
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 16 Oct 2025 14:37:42 +0000 (15:37 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 21 Oct 2025 00:17:15 +0000 (17:17 -0700)
The internal PCS registers only exist if the core is synthesized with
SGMII, TBI or RTBI support. They have no relevance for RGMII.

However, priv->hw->pcs contains a STMMAC_PCS_RGMII flag, which is set
if a PCS has been synthesized but we are operating in RGMII mode. As
the register has no effect for RGMII, there is no point calling
stmmac_pcs_ctrl_ane() in this case. Add a comment describing this
and make it conditional on STMMAC_PCS_SGMII.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/E1v9P6s-0000000AomE-2pAa@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index c643817f30da69843210723ecc01d259ef6c787f..02dcbfa7d23e80465af420219fdd816645a44010 100644 (file)
@@ -3487,7 +3487,11 @@ static int stmmac_hw_setup(struct net_device *dev)
                }
        }
 
-       if (priv->hw->pcs)
+       /* The PCS control register is only relevant for SGMII, TBI and RTBI
+        * modes. We no longer support TBI or RTBI, so only configure this
+        * register when operating in SGMII mode with the integrated PCS.
+        */
+       if (priv->hw->pcs & STMMAC_PCS_SGMII)
                stmmac_pcs_ctrl_ane(priv, 1, priv->hw->reverse_sgmii_enable);
 
        /* set TX and RX rings length */