]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: clear half-duplex caps where unsupported
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 30 Jan 2026 11:10:26 +0000 (11:10 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Feb 2026 03:16:02 +0000 (19:16 -0800)
Where a core supports hardware features, but does not indicate support
for half-duplex, clear phylink's half-duplex 1G, 100M and 10M
capability bits to disallow half-duplex operation and advertisement of
these link modes.

This will avoid the need for special code in the PCS driver to do this
based on the ESTATUS register bits, as the support in the PCS is
dependent on the same synthesis choice as the MAC core.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Link: https://patch.msgid.link/E1vlmOQ-00000006zuz-0ffN@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index ca81bb1cae39f47fc44c66b1c60008e1493441b6..49893b9fb88c4d0e9774395e6efb6e9b87c1988b 100644 (file)
@@ -46,8 +46,6 @@ static void dwxgmac2_update_caps(struct stmmac_priv *priv)
 {
        if (!priv->dma_cap.mbps_10_100)
                priv->hw->link.caps &= ~(MAC_10 | MAC_100);
-       else if (!priv->dma_cap.half_duplex)
-               priv->hw->link.caps &= ~(MAC_10HD | MAC_100HD);
 }
 
 static void dwxgmac2_set_mac(void __iomem *ioaddr, bool enable)
index 7a451ae19f5043114a0b06b94884126ee7a8745b..fee5804e75c064c407af6aac7522e6323c40a9dd 100644 (file)
@@ -906,6 +906,9 @@ static unsigned long stmmac_mac_get_caps(struct phylink_config *config,
        /* Refresh the MAC-specific capabilities */
        stmmac_mac_update_caps(priv);
 
+       if (priv->hw_cap_support && !priv->dma_cap.half_duplex)
+               priv->hw->link.caps &= ~(MAC_1000HD | MAC_100HD | MAC_10HD);
+
        config->mac_capabilities = priv->hw->link.caps;
 
        if (priv->plat->max_speed)