[PATCH net 2/2] net: stmmac: qcom-ethqos: advertise supported SerDes interfaces

From: Thomas Karpiniec

Date: Wed Sep 16 2026 - 07:03:33 EST


From: Thomas Karpiniec <tom@xxxxxxxx>

With a QCA8081 PHY and phy-mode = "2500base-x", stmmac reports only
2500BASE-X in phylink's supported_interfaces. Phylink consequently removes
10/100/1000BASE-T modes from the PHY's advertisement, preventing a link
with a gigabit switch.

The QCA8081 uses SGMII for lower copper speeds and 2500BASE-X for 2.5Gbps.
ETHQOS already reconfigures the SerDes in ethqos_mac_finish_serdes() when
the PHY changes interface, but does not advertise this capability.

Provide a get_interfaces() callback for serial interfaces. Add SGMII and
2500BASE-X when the SerDes validates them, allowing phylink to retain the
corresponding copper link modes. Leave the existing stmmac fallback to
the firmware interface in place when no interfaces are reported. RGMII
configurations are unchanged.

Fixes: 61e9be0efbe8 ("net: stmmac: qcom-ethqos: add support for 2.5G BASEX mode")
Cc: stable@xxxxxxxxxxxxxxx # 7.1+
Assisted-by: LLM sparse
Signed-off-by: Thomas Karpiniec <tom@xxxxxxxx>
---
.../stmicro/stmmac/dwmac-qcom-ethqos.c | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index ac7d6d3e205a..3493e090f1a8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2018-19, Linaro Limited

+#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_net.h>
@@ -564,6 +565,26 @@ static void ethqos_pcs_set_inband(struct qcom_ethqos *ethqos, bool enable)
stmmac_pcs_ctrl_ane(priv, enable, 0);
}

+static void ethqos_get_interfaces_serdes(struct stmmac_priv *priv, void *bsp_priv,
+ unsigned long *interfaces)
+{
+ struct qcom_ethqos *ethqos = bsp_priv;
+
+ if (!ethqos->serdes_phy)
+ return;
+
+ /* PHYs such as QCA8081 switch between SGMII and 2500BASE-X with
+ * the negotiated copper speed. mac_finish reconfigures the SerDes
+ * accordingly; let phylink validate all modes that path supports.
+ */
+ if (!phy_validate(ethqos->serdes_phy, PHY_MODE_ETHERNET,
+ PHY_INTERFACE_MODE_SGMII, NULL))
+ __set_bit(PHY_INTERFACE_MODE_SGMII, interfaces);
+ if (!phy_validate(ethqos->serdes_phy, PHY_MODE_ETHERNET,
+ PHY_INTERFACE_MODE_2500BASEX, NULL))
+ __set_bit(PHY_INTERFACE_MODE_2500BASEX, interfaces);
+}
+
/* On interface toggle MAC registers gets reset.
* Configure MAC block for SGMII on ethernet phy link up
*/
@@ -718,6 +739,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
break;
case PHY_INTERFACE_MODE_2500BASEX:
case PHY_INTERFACE_MODE_SGMII:
+ plat_dat->get_interfaces = ethqos_get_interfaces_serdes;
plat_dat->fix_mac_speed = ethqos_fix_mac_speed_sgmii;
plat_dat->mac_finish = ethqos_mac_finish_serdes;
break;
--
2.50.1 (Apple Git-155)