diff mbox series

[net-next,v4,13/15] net: phy: dp83822: Add SFP support through the phy_port interface

Message ID 20250213101606.1154014-14-maxime.chevallier@bootlin.com (mailing list archive)
State Not Applicable
Headers show
Series Introduce an ethernet port representation | expand

Commit Message

Maxime Chevallier Feb. 13, 2025, 10:16 a.m. UTC
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.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
V4: no changes

 drivers/net/phy/dp83822.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
index af535b0a3914..873ba467cd57 100644
--- a/drivers/net/phy/dp83822.c
+++ b/drivers/net/phy/dp83822.c
@@ -908,6 +908,13 @@  static int dp83822_attach_port(struct phy_device *phydev, struct phy_port *port)
 		}
 	}
 
+	/* If attached from SFP, is_serdes is set, but not the mediums. */
+	if (port->is_serdes)
+		dp83822->fx_enabled = true;
+
+	if (dp83822->fx_enabled)
+		__set_bit(PHY_INTERFACE_MODE_100BASEFX, interfaces);
+
 	return 0;
 }