From: Russell King (Oracle) Date: Fri, 30 Jan 2026 11:10:26 +0000 (+0000) Subject: net: stmmac: clear half-duplex caps where unsupported X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83957d6cae5b93849babf75f112bdc069871dc34;p=thirdparty%2Fkernel%2Flinux.git net: stmmac: clear half-duplex caps where unsupported 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) Tested-by: Maxime Chevallier Reviewed-by: Maxime Chevallier Tested-by: Mohd Ayaan Anwar Link: https://patch.msgid.link/E1vlmOQ-00000006zuz-0ffN@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index ca81bb1cae39..49893b9fb88c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -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) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7a451ae19f50..fee5804e75c0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -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)