[PATCH net 3/6] net: dsa: b53: constrain SerDes interfaces to initialized PCSes
From: Florian Fainelli
Date: Wed Oct 21 2026 - 15:19:21 EST
Publish the supported interface bitmap on each successfully discovered
PCS and use it for capability reporting and PCS selection. Clear the
parallel interfaces inherited from the common switch code on ports whose
mux selects a SerDes. A failed discovery must not leave a usable serial
interface advertised without its PCS.
Stop advertising 2500BASE-X: the driver neither selects its baud rate nor
supports 2.5G in the MAC override code. The downstream robo SerDes speed
setter likewise only implements 10/100/1000. Keep SGMII and 1000BASE-X on
both lanes until a complete 2.5G programming path is available.
Report discovery failures at the SRAB port to make missing capabilities
diagnosable.
Fixes: 0e01491de646 ("net: dsa: b53: Add SerDes support")
Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
---
drivers/net/dsa/b53/b53_serdes.c | 28 ++++++++--------------------
drivers/net/dsa/b53/b53_srab.c | 9 +++++++--
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_serdes.c b/drivers/net/dsa/b53/b53_serdes.c
index 87771e3788f7..d521050d7c8f 100644
--- a/drivers/net/dsa/b53/b53_serdes.c
+++ b/drivers/net/dsa/b53/b53_serdes.c
@@ -273,24 +273,11 @@ void b53_serdes_phylink_get_caps(struct b53_device *dev, int port,
if (lane == B53_INVALID_LANE)
return;
- switch (lane) {
- case 0:
- /* It appears lane 0 supports 2500base-X and 1000base-X */
- __set_bit(PHY_INTERFACE_MODE_2500BASEX,
- config->supported_interfaces);
- config->mac_capabilities |= MAC_2500FD;
- fallthrough;
- case 1:
- /* It appears lane 1 only supports 1000base-X and SGMII */
- __set_bit(PHY_INTERFACE_MODE_1000BASEX,
- config->supported_interfaces);
- __set_bit(PHY_INTERFACE_MODE_SGMII,
- config->supported_interfaces);
- config->mac_capabilities |= MAC_1000FD;
- break;
- default:
- break;
- }
+ if (lane >= B53_N_PCS || !dev->pcs[lane].dev)
+ return;
+
+ phy_interface_copy(config->supported_interfaces,
+ dev->pcs[lane].pcs.supported_interfaces);
}
EXPORT_SYMBOL(b53_serdes_phylink_get_caps);
@@ -304,8 +291,7 @@ struct phylink_pcs *b53_serdes_phylink_mac_select_pcs(struct b53_device *dev,
!dev->pcs[lane].dev)
return NULL;
- if (!phy_interface_mode_is_8023z(interface) &&
- interface != PHY_INTERFACE_MODE_SGMII)
+ if (!test_bit(interface, dev->pcs[lane].pcs.supported_interfaces))
return NULL;
return &dev->pcs[lane].pcs;
@@ -351,6 +337,8 @@ int b53_serdes_init(struct b53_device *dev, int port)
pcs->dev = dev;
pcs->lane = lane;
pcs->pcs.ops = &b53_pcs_ops;
+ __set_bit(PHY_INTERFACE_MODE_SGMII, pcs->pcs.supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_1000BASEX, pcs->pcs.supported_interfaces);
return 0;
}
diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c
index 9988a83fa7b7..77e81e1a414a 100644
--- a/drivers/net/dsa/b53/b53_srab.c
+++ b/drivers/net/dsa/b53/b53_srab.c
@@ -451,9 +451,11 @@ static void b53_srab_phylink_get_caps(struct b53_device *dev, int port,
switch (p->mode) {
case PHY_INTERFACE_MODE_SGMII:
+ /* The mux connects this port to a SerDes, not a parallel bus. */
+ phy_interface_zero(config->supported_interfaces);
#if IS_ENABLED(CONFIG_B53_SERDES)
/* If p->mode indicates SGMII mode, that essentially means we
- * are using a serdes. As the serdes for the capabilities.
+ * are using a SerDes. Ask it for the supported interfaces.
*/
b53_serdes_phylink_get_caps(dev, port, config);
#endif
@@ -588,8 +590,11 @@ static void b53_srab_mux_init(struct platform_device *pdev)
case MUX_CONFIG_SGMII:
p->mode = PHY_INTERFACE_MODE_SGMII;
ret = b53_serdes_init(dev, port);
- if (ret)
+ if (ret) {
+ dev_err(dev->dev, "port %d SerDes unavailable: %pe\n",
+ port, ERR_PTR(ret));
continue;
+ }
break;
case MUX_CONFIG_MII_LITE:
p->mode = PHY_INTERFACE_MODE_MII;
--
2.53.0