[PATCH net-next v3 11/14] net: phy: ncn26000: Support for loopback support

From: Selvamani Rajagopal

Date: Fri May 29 2026 - 14:57:51 EST


Adding loopback support for S2500 internal PHY to help running
loopback test through ethtool

Signed-off-by: Selvamani Rajagopal <Selvamani.Rajagopal@xxxxxxxxxx>
---
drivers/net/phy/ncn26000.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/net/phy/ncn26000.c b/drivers/net/phy/ncn26000.c
index c3a34b2c524d..f7ece92a8fab 100644
--- a/drivers/net/phy/ncn26000.c
+++ b/drivers/net/phy/ncn26000.c
@@ -168,6 +168,17 @@ static int ncn26000_config_intr(struct phy_device *phydev)
return 0;
}

+static int ncn26000_loopback(struct phy_device *phydev, bool enable,
+ int speed)
+{
+ u16 mask = BMCR_LOOPBACK;
+ u16 ctl = 0;
+
+ if (enable)
+ ctl = BMCR_LOOPBACK;
+ return phy_modify(phydev, MII_BMCR, mask, ctl);
+}
+
static struct phy_driver ncn26000_driver[] = {
{
PHY_ID_MATCH_MODEL(PHY_ID_S2500),
@@ -178,6 +189,7 @@ static struct phy_driver ncn26000_driver[] = {
.config_aneg = ncn26000_config_aneg,
.read_status = ncn26000_read_status,
.handle_interrupt = ncn26000_handle_interrupt,
+ .set_loopback = ncn26000_loopback,
.set_plca_cfg = ncn26000_c45_plca_set_cfg,
.get_plca_cfg = genphy_c45_plca_get_cfg,
.get_plca_status = genphy_c45_plca_get_status,
--
2.43.0