[PATCH net-next v13 17/18] net: phy: dp83822: Add SFP support through the phy_port interface

Maxime Chevallier
2025-09-21T16:08:39Z

The DP83822 can support 100BaseFX. This mode was only accessible through
custom DT properties, but there also exist SFP modules that support
these modes. As this only requires setting the relevant supported
interface in the driver, expose the port capability with the new
phy_port API, allowing SFP support.

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
drivers/net/phy/dp83822.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
index c6e5b7244658..94036e5af242 100644
--- a/drivers/net/phy/dp83822.c
+++ b/drivers/net/phy/dp83822.c
@@ -980,6 +980,13 @@ static int dp83822_attach_mdi_port(struct phy_device *phydev,
}
}

+ /* If attached from SFP, is_mii is set, but not the mediums. */
+ if (port->is_mii)
+ dp83822->fx_enabled = true;
+
+ if (dp83822->fx_enabled)
+ __set_bit(PHY_INTERFACE_MODE_100BASEX, port->interfaces);
+
return 0;
}

--
2.49.0