[PATCH net-next v2 2/9] net: phy: ncn26000: bugfixes/improvements to NCN26000 PHY driver
From: Selvamani Rajagopal <hidden>
Date: 2026-05-11 18:19:25
Also in:
lkml
Subsystem:
ethernet phy library, networking drivers, onsemi ethernet phy drivers, the rest · Maintainers:
Andrew Lunn, Heiner Kallweit, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Piergiorgio Beruto, Linus Torvalds
Proprietary, noise immunity bit is set when PLCA is enabled Link status bit was wrong. Fixed now MAINTAINER's new email ID updated Signed-off-by: Selvamani Rajagopal <redacted> --- MAINTAINERS | 3 ++- drivers/net/phy/ncn26000.c | 52 +++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 5bbbbde6b..6ed1e1e5f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS@@ -19940,7 +19940,8 @@ S: Maintained F: arch/mips/boot/dts/ralink/omega2p.dts ONSEMI ETHERNET PHY DRIVERS -M: Piergiorgio Beruto <piergiorgio.beruto@gmail.com> +M: Piergiorgio Beruto <pier.beruto@onsemi.com> +M: Selva Rajagopal <selvamani.rajagopal@onsemi.com> L: netdev@vger.kernel.org S: Supported W: http://www.onsemi.com
diff --git a/drivers/net/phy/ncn26000.c b/drivers/net/phy/ncn26000.c
index cabdd83c6..68b0e4647 100644
--- a/drivers/net/phy/ncn26000.c
+++ b/drivers/net/phy/ncn26000.c@@ -2,7 +2,7 @@ /* * Driver for the onsemi 10BASE-T1S NCN26000 PHYs family. * - * Copyright 2022 onsemi + * Copyright 2026 onsemi */ #include <linux/kernel.h> #include <linux/bitfield.h>
@@ -35,6 +35,10 @@ #define TO_TMR_DEFAULT 32 +#define NCN26000_REG_PHYCFG1 0x8001 +#define NCN26000_PHYCFG1_ENI BIT(7) +#define NCN26000_PHYCFG1_ENI_MASK BIT(7) + static int ncn26000_config_init(struct phy_device *phydev) { /* HW bug workaround: the default value of the PLCA TO_TIMER should be
@@ -100,6 +104,24 @@ static int ncn26000_read_status(struct phy_device *phydev) return 0; } +/* Intercept PLCA enable/disable request to + * set the proprietary, ENI mode accordingly + */ +static int ncn26000_plca_set_cfg(struct phy_device *phydev, + const struct phy_plca_cfg *plca_cfg) +{ + int ret = genphy_c45_plca_set_cfg(phydev, plca_cfg); + u16 eni_cfg = 0; + + if (ret || plca_cfg->enabled < 0) + return ret; + + eni_cfg = (plca_cfg->enabled) ? NCN26000_PHYCFG1_ENI : 0; + return phy_modify_mmd(phydev, MDIO_MMD_VEND2, + NCN26000_REG_PHYCFG1, + NCN26000_PHYCFG1_ENI_MASK, eni_cfg); +} + static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev) { int ret;
@@ -108,7 +130,7 @@ static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev) ret = phy_read(phydev, NCN26000_REG_IRQ_STATUS); // check only link status changes - if (ret < 0 || (ret & NCN26000_REG_IRQ_STATUS) == 0) + if (ret < 0 || (ret & NCN26000_IRQ_LINKST_BIT) == 0) return IRQ_NONE; phy_trigger_machine(phydev);
@@ -117,8 +139,8 @@ static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev) static int ncn26000_config_intr(struct phy_device *phydev) { - int ret; u16 irqe; + int ret; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { // acknowledge IRQs
@@ -143,17 +165,17 @@ static int ncn26000_config_intr(struct phy_device *phydev) static struct phy_driver ncn26000_driver[] = { { PHY_ID_MATCH_MODEL(PHY_ID_NCN26000), - .name = "NCN26000", - .features = PHY_BASIC_T1S_P2MP_FEATURES, - .config_init = ncn26000_config_init, - .config_intr = ncn26000_config_intr, - .config_aneg = ncn26000_config_aneg, - .read_status = ncn26000_read_status, - .handle_interrupt = ncn26000_handle_interrupt, - .get_plca_cfg = genphy_c45_plca_get_cfg, - .set_plca_cfg = genphy_c45_plca_set_cfg, - .get_plca_status = genphy_c45_plca_get_status, - .soft_reset = genphy_soft_reset, + .name = "NCN26000", + .features = PHY_BASIC_T1S_P2MP_FEATURES, + .config_init = ncn26000_config_init, + .config_intr = ncn26000_config_intr, + .config_aneg = ncn26000_config_aneg, + .read_status = ncn26000_read_status, + .handle_interrupt = ncn26000_handle_interrupt, + .get_plca_cfg = genphy_c45_plca_get_cfg, + .set_plca_cfg = ncn26000_plca_set_cfg, + .get_plca_status = genphy_c45_plca_get_status, + .soft_reset = genphy_soft_reset, }, };
@@ -166,6 +188,6 @@ static const struct mdio_device_id __maybe_unused ncn26000_tbl[] = { MODULE_DEVICE_TABLE(mdio, ncn26000_tbl); -MODULE_AUTHOR("Piergiorgio Beruto"); +MODULE_AUTHOR("Piergiorgio Beruto <Pier.Beruto@onsemi.com>"); MODULE_DESCRIPTION("onsemi 10BASE-T1S PHY driver"); MODULE_LICENSE("Dual BSD/GPL");
--
2.43.0