net/axgbe: Add external PHY read/write functions
PATCH 1/3 net/axgbe: Add external PHY read/write functions
Introduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
This patch does not implement Clause 45 transactions; support for C45 access can be added in future updates as needed.
No functional changes are introduced for existing drivers. The new helpers will be used by subsequent patches that require external PHY management.
--- .mailmap | 1 + drivers/net/axgbe/axgbe_ethdev.h | 3 +++ drivers/net/axgbe/axgbe_phy_impl.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+)
.mailmap +1 -0
@@ -165,6 +165,7 @@ Ashish Paul <[email protected]> Ashish Sadanandan <[email protected]> Ashish Shah <[email protected]> Ashok Kaladi <[email protected]> +Ashok Kumar Natarajan <[email protected]> Ashwin Sekhar T K <[email protected]> <[email protected]> Asim Jamshed <[email protected]> Atul Patel <[email protected]>
drivers/net/axgbe/axgbe_ethdev.h +3 -0
@@ -398,6 +398,9 @@ struct axgbe_phy_impl_if {/* Pre/Post KR training enablement support */ void (*kr_training_pre)(struct axgbe_port *);void (*kr_training_post)(struct axgbe_port *); + +int (*read)(struct axgbe_port *port,int addr,int reg); +int (*write)(struct axgbe_port *port,int addr,int reg,u16 val); };struct axgbe_phy_if {
drivers/net/axgbe/axgbe_phy_impl.c +29 -0
@@ -251,6 +251,8 @@ static void axgbe_phy_perform_ratechange(struct axgbe_port *pdata, enum axgbe_mb_cmd cmd, enum axgbe_mb_subcmd sub_cmd);static void axgbe_phy_rrc (struct axgbe_port *pdata); +static int axgbe_phy_get_comm_ownership (struct axgbe_port *pdata); +static void axgbe_phy_put_comm_ownership (struct axgbe_port *pdata);static int axgbe_phy_i2c_xfer (struct axgbe_port *pdata,struct axgbe_i2c_op *i2c_op)
@@ -258,6 +260,30 @@ static int axgbe_phy_i2c_xfer(struct axgbe_port *pdata,return pdata->i2c_if.i2c_xfer (pdata, i2c_op); } +static int axgbe_phy_mii_read_c22 (struct axgbe_port *pdata,int addr,int reg) +{ +int ret, regval; + ret =axgbe_phy_get_comm_ownership (pdata); +if (ret) +return -1 ; + regval = pdata->hw_if.read_ext_mii_regs_c22 (pdata, addr, reg); +axgbe_phy_put_comm_ownership (pdata); +return regval; +} + +static int axgbe_phy_mii_write_c22 (struct axgbe_port *pdata,int addr, +int reg,u16 val) +{ +int ret, regval; + ret =axgbe_phy_get_comm_ownership (pdata); +if (ret) +return -1 ; + regval = pdata->hw_if.write_ext_mii_regs_c22 (pdata, addr, reg, val); +axgbe_phy_put_comm_ownership (pdata); +return regval; +} + +static int axgbe_phy_redrv_write (struct axgbe_port *pdata,unsigned int reg,unsigned int val) {
@@ -2542,4 +2568,7 @@ void axgbe_init_function_ptrs_phy_v2(struct axgbe_phy_if *phy_if) phy_impl->kr_training_pre = axgbe_phy_kr_training_pre; phy_impl->kr_training_post = axgbe_phy_kr_training_post; + + phy_impl->read = axgbe_phy_mii_read_c22; + phy_impl->write = axgbe_phy_mii_write_c22; }
Signature · 1 line
2.34.1
PATCH 2/3 net/axgbe: Add support for Marvell M88E1512 PHY
Add support for the Marvell M88E1512 PHY in the axgbe driver. This patch implements device identification and basic initialization required to operate with this PHY. Only the M88E1512 model is supported in this update.
--- drivers/net/axgbe/axgbe_ethdev.h | 1 + drivers/net/axgbe/axgbe_phy.h | 32 ++++ drivers/net/axgbe/axgbe_phy_impl.c | 261 ++++++++++++++++++++++++++++- 3 files changed, 290 insertions(+), 4 deletions(-)
drivers/net/axgbe/axgbe_ethdev.h +1 -0
@@ -276,6 +276,7 @@ struct axgbe_phy {int pause_autoneg;int tx_pause;int rx_pause; +int id; };enum axgbe_i2c_cmd {
drivers/net/axgbe/axgbe_phy.h +32 -0
@@ -63,6 +63,29 @@#define BMCR_RESET 0x8000/* Reset to default state */ #define BMCR_SPEED10 0x0000/* Select 10Mbps */ +/* Advertisement control register. */ +#define ADVERTISE_SLCT 0x001f/* Selector bits */ +#define ADVERTISE_CSMA 0x0001/* Only selector supported */ +#define ADVERTISE_10HALF 0x0020/* Try for 10mbps half-duplex */ +#define ADVERTISE_1000XFULL 0x0020/* Try for 1000BASE-X full-duplex */ +#define ADVERTISE_10FULL 0x0040/* Try for 10mbps full-duplex */ +#define ADVERTISE_1000XHALF 0x0040/* Try for 1000BASE-X half-duplex */ +#define ADVERTISE_100HALF 0x0080/* Try for 100mbps half-duplex */ +#define ADVERTISE_1000XPAUSE 0x0080/* Try for 1000BASE-X pause */ +#define ADVERTISE_100FULL 0x0100/* Try for 100mbps full-duplex */ +#define ADVERTISE_1000XPSE_ASYM 0x0100/* Try for 1000BASE-X asym pause */ +#define ADVERTISE_100BASE4 0x0200/* Try for 100mbps 4k packets */ +#define ADVERTISE_PAUSE_CAP 0x0400/* Try for pause */ +#define ADVERTISE_PAUSE_ASYM 0x0800/* Try for asymmetric pause */ +#define ADVERTISE_RESV 0x1000/* Unused... */ +#define ADVERTISE_RFAULT 0x2000/* Say we can detect faults */ +#define ADVERTISE_LPACK 0x4000/* Ack link partners response */ +#define ADVERTISE_NPAGE 0x8000/* Next page bit */ + +#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ + ADVERTISE_CSMA) +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ + ADVERTISE_100HALF | ADVERTISE_100FULL)/* MDIO Manageable Devices (MMDs). */ #define MDIO_MMD_PMAPMD 1/* Physical Medium Attachment
@@ -114,6 +137,15 @@#define MDIO_AN_10GBT_CTRL 32/* 10GBASE-T auto-negotiation control */ #define MDIO_AN_10GBT_STAT 33/* 10GBASE-T auto-negotiation status */ +#define AXGBE_M88E1512_PAGE_ADDR 0x0016 +#define AXGBE_M88E1512_CFG_REG_1 0x0010 +#define AXGBE_M88E1512_CFG_REG_2 0x0011 +#define AXGBE_M88E1512_CFG_REG_3 0x0007 +#define AXGBE_M88E1512_MODE 0x0014 + +#define AXGBE_M88E1512_SCR 0x10 + +/* Control register 1. */ /* Enable extended speed selection */ #define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
drivers/net/axgbe/axgbe_phy_impl.c +257 -4
308 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH 2/3] net/axgbe: Add support for Marvell M88E1512 PHY
drivers/net/axgbe/axgbe_ethdev.h struct axgbe_phy { · line 281
Quoted 11 lines · On Mon, 16 Feb 2026 18:22:04 +0530 Ashok Kumar Natarajan…
drivers/net/axgbe/axgbe_ethdev.h +1
-0@@ -276,6 +276,7 @@ struct axgbe_phy {int pause_autoneg;int tx_pause;int rx_pause; +int id; };
These really shouldn't be "int".
This looks like legacy era K&R code style.
The driver has this in lots of places.
The flags should be bool, but that is another issue.
PATCH v2 2/3 net/axgbe: add support for marvell m88e1512 PHY
In reply to Ashok Kumar NatarajanAdd support for the Marvell M88E1512 PHY in the axgbe driver. This patch implements device identification and basic initialization required to operate with this PHY. Only the M88E1512 model is supported in this update.
--- drivers/net/axgbe/axgbe_phy.h | 44 ++++ drivers/net/axgbe/axgbe_phy_impl.c | 387 ++++++++++++++++++++++++++++- 2 files changed, 427 insertions(+), 4 deletions(-)
drivers/net/axgbe/axgbe_phy.h +44 -0
@@ -63,6 +63,29 @@#define BMCR_RESET 0x8000/* Reset to default state */ #define BMCR_SPEED10 0x0000/* Select 10Mbps */ +/* Advertisement control register. */ +#define ADVERTISE_SLCT 0x001f/* Selector bits */ +#define ADVERTISE_CSMA 0x0001/* Only selector supported */ +#define ADVERTISE_10HALF 0x0020/* Try for 10mbps half-duplex */ +#define ADVERTISE_1000XFULL 0x0020/* Try for 1000BASE-X full-duplex */ +#define ADVERTISE_10FULL 0x0040/* Try for 10mbps full-duplex */ +#define ADVERTISE_1000XHALF 0x0040/* Try for 1000BASE-X half-duplex */ +#define ADVERTISE_100HALF 0x0080/* Try for 100mbps half-duplex */ +#define ADVERTISE_1000XPAUSE 0x0080/* Try for 1000BASE-X pause */ +#define ADVERTISE_100FULL 0x0100/* Try for 100mbps full-duplex */ +#define ADVERTISE_1000XPSE_ASYM 0x0100/* Try for 1000BASE-X asym pause */ +#define ADVERTISE_100BASE4 0x0200/* Try for 100mbps 4k packets */ +#define ADVERTISE_PAUSE_CAP 0x0400/* Try for pause */ +#define ADVERTISE_PAUSE_ASYM 0x0800/* Try for asymmetric pause */ +#define ADVERTISE_RESV 0x1000/* Unused... */ +#define ADVERTISE_RFAULT 0x2000/* Say we can detect faults */ +#define ADVERTISE_LPACK 0x4000/* Ack link partners response */ +#define ADVERTISE_NPAGE 0x8000/* Next page bit */ + +#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ + ADVERTISE_CSMA) +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ + ADVERTISE_100HALF | ADVERTISE_100FULL)/* MDIO Manageable Devices (MMDs). */ #define MDIO_MMD_PMAPMD 1/* Physical Medium Attachment
@@ -114,6 +137,26 @@#define MDIO_AN_10GBT_CTRL 32/* 10GBASE-T auto-negotiation control */ #define MDIO_AN_10GBT_STAT 33/* 10GBASE-T auto-negotiation status */ +#define M88E1512_E_PHY_ID 0x01410DD0 +#define AXGBE_M88E1512_PAGE_ADDR 0x0016 +#define AXGBE_M88E1512_CFG_REG_1 0x0010 +#define AXGBE_M88E1512_CFG_REG_2 0x0011 +#define AXGBE_M88E1512_CFG_REG_3 0x0007 +#define AXGBE_M88E1512_MODE 0x0014 + +#define AXGBE_M88E1512_PHY_PAGE 22 +#define AXGBE_M88E1512_COPPER_PAGE 0x00 +#define AXGBE_M88E1512_LED_PAGE 0x03 +#define AXGBE_M88E1512_MODE_PAGE 0x12 + +#define AXGBE_M88E1512_MODE_RGMII_COPPER 0 +#define AXGBE_M88E1512_MODE_SGMII_COPPER 1 +#define AXGBE_M88E1512_MODE_RGMII_1000BX 2 +#define AXGBE_M88E1512_MODE_RGMII_100BFX 3 +#define AXGBE_M88E1512_MODE_RGMII_SGMII 4 +#define AXGBE_M88E1512_MODE_SW_RESET 0x8000 + +/* Control register 1. */ /* Enable extended speed selection */ #define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
@@ -190,5 +233,6 @@#define DUPLEX_FULL 0x01#define DUPLEX_UNKNOWN 0xff +#define AXGBE_PHY_REVISION_MASK 0xfffffff0#endif /* PHY */
drivers/net/axgbe/axgbe_phy_impl.c +383 -4
448 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 2/3 net/axgbe: add support for marvell m88e1512 PHY
Add support for the Marvell M88E1512 PHY in the axgbe driver. This patch implements device identification and basic initialization required to operate with this PHY. Only the M88E1512 model is supported in this update.
--- drivers/net/axgbe/axgbe_phy.h | 44 ++++ drivers/net/axgbe/axgbe_phy_impl.c | 389 ++++++++++++++++++++++++++++- 2 files changed, 429 insertions(+), 4 deletions(-)
drivers/net/axgbe/axgbe_phy.h +44 -0
@@ -63,6 +63,29 @@#define BMCR_RESET 0x8000/* Reset to default state */ #define BMCR_SPEED10 0x0000/* Select 10Mbps */ +/* Advertisement control register. */ +#define ADVERTISE_SLCT 0x001f/* Selector bits */ +#define ADVERTISE_CSMA 0x0001/* Only selector supported */ +#define ADVERTISE_10HALF 0x0020/* Try for 10mbps half-duplex */ +#define ADVERTISE_1000XFULL 0x0020/* Try for 1000BASE-X full-duplex */ +#define ADVERTISE_10FULL 0x0040/* Try for 10mbps full-duplex */ +#define ADVERTISE_1000XHALF 0x0040/* Try for 1000BASE-X half-duplex */ +#define ADVERTISE_100HALF 0x0080/* Try for 100mbps half-duplex */ +#define ADVERTISE_1000XPAUSE 0x0080/* Try for 1000BASE-X pause */ +#define ADVERTISE_100FULL 0x0100/* Try for 100mbps full-duplex */ +#define ADVERTISE_1000XPSE_ASYM 0x0100/* Try for 1000BASE-X asym pause */ +#define ADVERTISE_100BASE4 0x0200/* Try for 100mbps 4k packets */ +#define ADVERTISE_PAUSE_CAP 0x0400/* Try for pause */ +#define ADVERTISE_PAUSE_ASYM 0x0800/* Try for asymmetric pause */ +#define ADVERTISE_RESV 0x1000/* Unused... */ +#define ADVERTISE_RFAULT 0x2000/* Say we can detect faults */ +#define ADVERTISE_LPACK 0x4000/* Ack link partners response */ +#define ADVERTISE_NPAGE 0x8000/* Next page bit */ + +#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ + ADVERTISE_CSMA) +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ + ADVERTISE_100HALF | ADVERTISE_100FULL)/* MDIO Manageable Devices (MMDs). */ #define MDIO_MMD_PMAPMD 1/* Physical Medium Attachment
@@ -114,6 +137,26 @@#define MDIO_AN_10GBT_CTRL 32/* 10GBASE-T auto-negotiation control */ #define MDIO_AN_10GBT_STAT 33/* 10GBASE-T auto-negotiation status */ +#define M88E1512_E_PHY_ID 0x01410DD0 +#define AXGBE_M88E1512_PAGE_ADDR 0x0016 +#define AXGBE_M88E1512_CFG_REG_1 0x0010 +#define AXGBE_M88E1512_CFG_REG_2 0x0011 +#define AXGBE_M88E1512_CFG_REG_3 0x0007 +#define AXGBE_M88E1512_MODE 0x0014 + +#define AXGBE_M88E1512_PHY_PAGE 22 +#define AXGBE_M88E1512_COPPER_PAGE 0x00 +#define AXGBE_M88E1512_LED_PAGE 0x03 +#define AXGBE_M88E1512_MODE_PAGE 0x12 + +#define AXGBE_M88E1512_MODE_RGMII_COPPER 0 +#define AXGBE_M88E1512_MODE_SGMII_COPPER 1 +#define AXGBE_M88E1512_MODE_RGMII_1000BX 2 +#define AXGBE_M88E1512_MODE_RGMII_100BFX 3 +#define AXGBE_M88E1512_MODE_RGMII_SGMII 4 +#define AXGBE_M88E1512_MODE_SW_RESET 0x8000 + +/* Control register 1. */ /* Enable extended speed selection */ #define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
@@ -190,5 +233,6 @@#define DUPLEX_FULL 0x01#define DUPLEX_UNKNOWN 0xff +#define AXGBE_PHY_REVISION_MASK 0xfffffff0#endif /* PHY */
drivers/net/axgbe/axgbe_phy_impl.c +385 -4
453 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v4 2/3 net/axgbe: add support for marvell m88e1512 PHY
Add support for the Marvell M88E1512 PHY in the axgbe driver. This patch implements device identification and basic initialization required to operate with this PHY. Only the M88E1512 model is supported in this update.
--- drivers/net/axgbe/axgbe_phy.h | 44 ++++ drivers/net/axgbe/axgbe_phy_impl.c | 389 ++++++++++++++++++++++++++++- 2 files changed, 429 insertions(+), 4 deletions(-)
drivers/net/axgbe/axgbe_phy.h +44 -0
@@ -63,6 +63,29 @@#define BMCR_RESET 0x8000/* Reset to default state */ #define BMCR_SPEED10 0x0000/* Select 10Mbps */ +/* Advertisement control register. */ +#define ADVERTISE_SLCT 0x001f/* Selector bits */ +#define ADVERTISE_CSMA 0x0001/* Only selector supported */ +#define ADVERTISE_10HALF 0x0020/* Try for 10mbps half-duplex */ +#define ADVERTISE_1000XFULL 0x0020/* Try for 1000BASE-X full-duplex */ +#define ADVERTISE_10FULL 0x0040/* Try for 10mbps full-duplex */ +#define ADVERTISE_1000XHALF 0x0040/* Try for 1000BASE-X half-duplex */ +#define ADVERTISE_100HALF 0x0080/* Try for 100mbps half-duplex */ +#define ADVERTISE_1000XPAUSE 0x0080/* Try for 1000BASE-X pause */ +#define ADVERTISE_100FULL 0x0100/* Try for 100mbps full-duplex */ +#define ADVERTISE_1000XPSE_ASYM 0x0100/* Try for 1000BASE-X asym pause */ +#define ADVERTISE_100BASE4 0x0200/* Try for 100mbps 4k packets */ +#define ADVERTISE_PAUSE_CAP 0x0400/* Try for pause */ +#define ADVERTISE_PAUSE_ASYM 0x0800/* Try for asymmetric pause */ +#define ADVERTISE_RESV 0x1000/* Unused... */ +#define ADVERTISE_RFAULT 0x2000/* Say we can detect faults */ +#define ADVERTISE_LPACK 0x4000/* Ack link partners response */ +#define ADVERTISE_NPAGE 0x8000/* Next page bit */ + +#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ + ADVERTISE_CSMA) +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ + ADVERTISE_100HALF | ADVERTISE_100FULL)/* MDIO Manageable Devices (MMDs). */ #define MDIO_MMD_PMAPMD 1/* Physical Medium Attachment
@@ -114,6 +137,26 @@#define MDIO_AN_10GBT_CTRL 32/* 10GBASE-T auto-negotiation control */ #define MDIO_AN_10GBT_STAT 33/* 10GBASE-T auto-negotiation status */ +#define M88E1512_E_PHY_ID 0x01410DD0 +#define AXGBE_M88E1512_PAGE_ADDR 0x0016 +#define AXGBE_M88E1512_CFG_REG_1 0x0010 +#define AXGBE_M88E1512_CFG_REG_2 0x0011 +#define AXGBE_M88E1512_CFG_REG_3 0x0007 +#define AXGBE_M88E1512_MODE 0x0014 + +#define AXGBE_M88E1512_PHY_PAGE 22 +#define AXGBE_M88E1512_COPPER_PAGE 0x00 +#define AXGBE_M88E1512_LED_PAGE 0x03 +#define AXGBE_M88E1512_MODE_PAGE 0x12 + +#define AXGBE_M88E1512_MODE_RGMII_COPPER 0 +#define AXGBE_M88E1512_MODE_SGMII_COPPER 1 +#define AXGBE_M88E1512_MODE_RGMII_1000BX 2 +#define AXGBE_M88E1512_MODE_RGMII_100BFX 3 +#define AXGBE_M88E1512_MODE_RGMII_SGMII 4 +#define AXGBE_M88E1512_MODE_SW_RESET 0x8000 + +/* Control register 1. */ /* Enable extended speed selection */ #define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
@@ -190,5 +233,6 @@#define DUPLEX_FULL 0x01#define DUPLEX_UNKNOWN 0xff +#define AXGBE_PHY_REVISION_MASK 0xfffffff0#endif /* PHY */
drivers/net/axgbe/axgbe_phy_impl.c +385 -4
453 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v4 2/3] net/axgbe: add support for marvell m88e1512 PHY
Quoted 11 lines · On Fri, 27 Feb 2026 14:14:29 +0530 Ashok Kumar Natarajan…
drivers/net/axgbe/axgbe_phy_impl.c +7
-0@@ -2556,6 +2922,21 @@ static int axgbe_phy_init(struct axgbe_port *pdata) } phy_data->phy_cdr_delay =AXGBE_CDR_DELAY_INIT ; + + ret =axgbe_get_phy_id (pdata); +if (ret) { +PMD_DRV_LOG_LINE (ERR ,"failed to get PHY id" ); +return ret; + } +
drivers/net/axgbe/axgbe_phy_impl.c static int axgbe_phy_init(struct axgbe_port *pdata) · line 2941
Quoted 10 lines
drivers/net/axgbe/axgbe_phy_impl.c +8
-0+PMD_DRV_LOG_LINE (DEBUG ,"PHY ID = 0x%x" , phy_data->phy_id); + +if (phy_data->phy_id ==M88E1512_E_PHY_ID ) { + ret =axgbe_m88e1512_init (pdata); +if (ret) +return ret; + } +return 0 ; }
AI was confused and thinks that there may be an issue here:
Patch 2/3: net/axgbe: add support for marvell m88e1512 PHY
Error — axgbe_get_phy_id() called unconditionally in axgbe_phy_init() (potential regression)
This is the most significant finding in the series. axgbe_get_phy_id() is inserted at the end of axgbe_phy_init() without any guard on port mode:

c
phy_data->phy_cdr_delay = AXGBE_CDR_DELAY_INIT;
+
+ ret = axgbe_get_phy_id(pdata);
+ if (ret) {
+ PMD_DRV_LOG_LINE(ERR, "failed to get PHY id");
+ return ret;
+ }axgbe_phy_init() is called for all port modes — SFP, backplane, 10GBASE-T, etc. For port modes that have no external PHY, axgbe_phy_read() will attempt a Clause 22 MDIO read on phy_data->mdio_addr and likely timeout (-ETIMEDOUT), causing the entire PHY init to fail. This is a regression for devices that previously worked.
The M88E1512-specific init block below already checks phy_data->phy_id, but the axgbe_get_phy_id() call itself must not fail for non-1000BASE-T ports.
Fix: Gate the PHY ID read (and subsequent M88E1512 init) on the port mode:

c
if (phy_data->port_mode == AXGBE_PORT_MODE_1000BASE_T) {
ret = axgbe_get_phy_id(pdata);
if (ret) {
PMD_DRV_LOG_LINE(ERR, "failed to get PHY id");
return ret;
}
if (phy_data->phy_id == M88E1512_E_PHY_ID) {
ret = axgbe_m88e1512_init(pdata);
if (ret)
return ret;
}
}This is consistent with how axgbe_phy_link_status() in the same patch correctly guards the external PHY check with if (phy_data->port_mode == AXGBE_PORT_MODE_1000BASE_T).
Confidence: High (~90%). The MDIO read will go through hardware I/O regardless of whether a PHY exists at the address.
PATCH v5 2/3 net/axgbe: add support for marvell m88e1512 PHY
In reply to Ashok Kumar NatarajanAdd support for the Marvell M88E1512 PHY in the axgbe driver. This patch implements device identification and basic initialization required to operate with this PHY. Only the M88E1512 model is supported in this update.
--- drivers/net/axgbe/axgbe_phy.h | 44 ++++ drivers/net/axgbe/axgbe_phy_impl.c | 391 ++++++++++++++++++++++++++++- 2 files changed, 431 insertions(+), 4 deletions(-)
drivers/net/axgbe/axgbe_phy.h +44 -0
@@ -63,6 +63,29 @@#define BMCR_RESET 0x8000/* Reset to default state */ #define BMCR_SPEED10 0x0000/* Select 10Mbps */ +/* Advertisement control register. */ +#define ADVERTISE_SLCT 0x001f/* Selector bits */ +#define ADVERTISE_CSMA 0x0001/* Only selector supported */ +#define ADVERTISE_10HALF 0x0020/* Try for 10mbps half-duplex */ +#define ADVERTISE_1000XFULL 0x0020/* Try for 1000BASE-X full-duplex */ +#define ADVERTISE_10FULL 0x0040/* Try for 10mbps full-duplex */ +#define ADVERTISE_1000XHALF 0x0040/* Try for 1000BASE-X half-duplex */ +#define ADVERTISE_100HALF 0x0080/* Try for 100mbps half-duplex */ +#define ADVERTISE_1000XPAUSE 0x0080/* Try for 1000BASE-X pause */ +#define ADVERTISE_100FULL 0x0100/* Try for 100mbps full-duplex */ +#define ADVERTISE_1000XPSE_ASYM 0x0100/* Try for 1000BASE-X asym pause */ +#define ADVERTISE_100BASE4 0x0200/* Try for 100mbps 4k packets */ +#define ADVERTISE_PAUSE_CAP 0x0400/* Try for pause */ +#define ADVERTISE_PAUSE_ASYM 0x0800/* Try for asymmetric pause */ +#define ADVERTISE_RESV 0x1000/* Unused... */ +#define ADVERTISE_RFAULT 0x2000/* Say we can detect faults */ +#define ADVERTISE_LPACK 0x4000/* Ack link partners response */ +#define ADVERTISE_NPAGE 0x8000/* Next page bit */ + +#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ + ADVERTISE_CSMA) +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ + ADVERTISE_100HALF | ADVERTISE_100FULL)/* MDIO Manageable Devices (MMDs). */ #define MDIO_MMD_PMAPMD 1/* Physical Medium Attachment
@@ -114,6 +137,26 @@#define MDIO_AN_10GBT_CTRL 32/* 10GBASE-T auto-negotiation control */ #define MDIO_AN_10GBT_STAT 33/* 10GBASE-T auto-negotiation status */ +#define M88E1512_E_PHY_ID 0x01410DD0 +#define AXGBE_M88E1512_PAGE_ADDR 0x0016 +#define AXGBE_M88E1512_CFG_REG_1 0x0010 +#define AXGBE_M88E1512_CFG_REG_2 0x0011 +#define AXGBE_M88E1512_CFG_REG_3 0x0007 +#define AXGBE_M88E1512_MODE 0x0014 + +#define AXGBE_M88E1512_PHY_PAGE 22 +#define AXGBE_M88E1512_COPPER_PAGE 0x00 +#define AXGBE_M88E1512_LED_PAGE 0x03 +#define AXGBE_M88E1512_MODE_PAGE 0x12 + +#define AXGBE_M88E1512_MODE_RGMII_COPPER 0 +#define AXGBE_M88E1512_MODE_SGMII_COPPER 1 +#define AXGBE_M88E1512_MODE_RGMII_1000BX 2 +#define AXGBE_M88E1512_MODE_RGMII_100BFX 3 +#define AXGBE_M88E1512_MODE_RGMII_SGMII 4 +#define AXGBE_M88E1512_MODE_SW_RESET 0x8000 + +/* Control register 1. */ /* Enable extended speed selection */ #define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
@@ -190,5 +233,6 @@#define DUPLEX_FULL 0x01#define DUPLEX_UNKNOWN 0xff +#define AXGBE_PHY_REVISION_MASK 0xfffffff0#endif /* PHY */
drivers/net/axgbe/axgbe_phy_impl.c +387 -4
455 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 3/3 net/axgbe: Add support for 100Mbps link speed
In reply to Ashok Kumar NatarajanAdd 100Mbps link speed support to the axgbe driver. This update enables the MAC and PHY configuration required to operate at 100M, including proper mode selection and link handling.
--- drivers/net/axgbe/axgbe_mdio.c | 4 ++-- drivers/net/axgbe/axgbe_phy_impl.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/axgbe/axgbe_mdio.c +2 -2
@@ -155,8 +155,8 @@ static void axgbe_sgmii_10_mode(struct axgbe_port *pdata)static void axgbe_sgmii_100_mode (struct axgbe_port *pdata) { -/* Set MAC to 1G speed */ - pdata->hw_if.set_speed (pdata,SPEED_1000 ); +/* Set MAC to 100M speed */ + pdata->hw_if.set_speed (pdata,SPEED_100 );/* Call PHY implementation support to complete rate change */ pdata->phy_if.phy_impl.set_mode (pdata,AXGBE_MODE_SGMII_100 );
drivers/net/axgbe/axgbe_phy_impl.c +15 -0
@@ -1534,6 +1534,18 @@ static void axgbe_phy_sgmii_1000_mode(struct axgbe_port *pdata) phy_data->cur_mode =AXGBE_MODE_SGMII_1000 ; } +static void axgbe_phy_sgmii_100_mode (struct axgbe_port *pdata) +{ +struct axgbe_phy_data *phy_data = pdata->phy_data; + +axgbe_phy_set_redrv_mode (pdata); + +/* 100M/SGMII */ +axgbe_phy_perform_ratechange (pdata,AXGBE_MB_CMD_SET_1G ,AXGBE_MB_SUBCMD_100MBITS ); + + phy_data->cur_mode =AXGBE_MODE_SGMII_100 ; +} +static void axgbe_phy_sgmii_10_mode (struct axgbe_port *pdata) {struct axgbe_phy_data *phy_data = pdata->phy_data;
@@ -1731,6 +1743,9 @@ static void axgbe_phy_set_mode(struct axgbe_port *pdata, enum axgbe_mode mode)case AXGBE_MODE_SGMII_1000 :axgbe_phy_sgmii_1000_mode (pdata);break ; +case AXGBE_MODE_SGMII_100 : +axgbe_phy_sgmii_100_mode (pdata); +break ;case AXGBE_MODE_SGMII_10 :axgbe_phy_sgmii_10_mode (pdata);break ;
Signature · 1 line
2.34.1
PATCH v2 3/3 net/axgbe: add support for 100Mbps link speed
Add 100Mbps link speed support to the axgbe driver. This update enables the MAC and PHY configuration required to operate at 100M, including proper mode selection and link handling.
--- drivers/net/axgbe/axgbe_mdio.c | 4 ++-- drivers/net/axgbe/axgbe_phy_impl.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/axgbe/axgbe_mdio.c +2 -2
@@ -155,8 +155,8 @@ static void axgbe_sgmii_10_mode(struct axgbe_port *pdata)static void axgbe_sgmii_100_mode (struct axgbe_port *pdata) { -/* Set MAC to 1G speed */ - pdata->hw_if.set_speed (pdata,SPEED_1000 ); +/* Set MAC to 100M speed */ + pdata->hw_if.set_speed (pdata,SPEED_100 );/* Call PHY implementation support to complete rate change */ pdata->phy_if.phy_impl.set_mode (pdata,AXGBE_MODE_SGMII_100 );
drivers/net/axgbe/axgbe_phy_impl.c +15 -0
@@ -1643,6 +1643,18 @@ static void axgbe_phy_sgmii_1000_mode(struct axgbe_port *pdata) phy_data->cur_mode =AXGBE_MODE_SGMII_1000 ; } +static void axgbe_phy_sgmii_100_mode (struct axgbe_port *pdata) +{ +struct axgbe_phy_data *phy_data = pdata->phy_data; + +axgbe_phy_set_redrv_mode (pdata); + +/* 100M/SGMII */ +axgbe_phy_perform_ratechange (pdata,AXGBE_MB_CMD_SET_1G ,AXGBE_MB_SUBCMD_100MBITS ); + + phy_data->cur_mode =AXGBE_MODE_SGMII_100 ; +} +static void axgbe_phy_sgmii_10_mode (struct axgbe_port *pdata) {struct axgbe_phy_data *phy_data = pdata->phy_data;
@@ -1840,6 +1852,9 @@ static void axgbe_phy_set_mode(struct axgbe_port *pdata, enum axgbe_mode mode)case AXGBE_MODE_SGMII_1000 :axgbe_phy_sgmii_1000_mode (pdata);break ; +case AXGBE_MODE_SGMII_100 : +axgbe_phy_sgmii_100_mode (pdata); +break ;case AXGBE_MODE_SGMII_10 :axgbe_phy_sgmii_10_mode (pdata);break ;
Signature · 1 line
2.34.1
PATCH v3 3/3 net/axgbe: fix 100M SGMII mode
In SGMII 100M mode, set MAC speed to 100M instead of 1G, and add the PHY implementation for SGMII 100 mode.
--- drivers/net/axgbe/axgbe_mdio.c | 4 ++-- drivers/net/axgbe/axgbe_phy_impl.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/axgbe/axgbe_mdio.c +2 -2
@@ -155,8 +155,8 @@ static void axgbe_sgmii_10_mode(struct axgbe_port *pdata)static void axgbe_sgmii_100_mode (struct axgbe_port *pdata) { -/* Set MAC to 1G speed */ - pdata->hw_if.set_speed (pdata,SPEED_1000 ); +/* Set MAC to 100M speed */ + pdata->hw_if.set_speed (pdata,SPEED_100 );/* Call PHY implementation support to complete rate change */ pdata->phy_if.phy_impl.set_mode (pdata,AXGBE_MODE_SGMII_100 );
drivers/net/axgbe/axgbe_phy_impl.c +15 -0
@@ -1643,6 +1643,18 @@ static void axgbe_phy_sgmii_1000_mode(struct axgbe_port *pdata) phy_data->cur_mode =AXGBE_MODE_SGMII_1000 ; } +static void axgbe_phy_sgmii_100_mode (struct axgbe_port *pdata) +{ +struct axgbe_phy_data *phy_data = pdata->phy_data; + +axgbe_phy_set_redrv_mode (pdata); + +/* 100M/SGMII */ +axgbe_phy_perform_ratechange (pdata,AXGBE_MB_CMD_SET_1G ,AXGBE_MB_SUBCMD_100MBITS ); + + phy_data->cur_mode =AXGBE_MODE_SGMII_100 ; +} +static void axgbe_phy_sgmii_10_mode (struct axgbe_port *pdata) {struct axgbe_phy_data *phy_data = pdata->phy_data;
@@ -1840,6 +1852,9 @@ static void axgbe_phy_set_mode(struct axgbe_port *pdata, enum axgbe_mode mode)case AXGBE_MODE_SGMII_1000 :axgbe_phy_sgmii_1000_mode (pdata);break ; +case AXGBE_MODE_SGMII_100 : +axgbe_phy_sgmii_100_mode (pdata); +break ;case AXGBE_MODE_SGMII_10 :axgbe_phy_sgmii_10_mode (pdata);break ;
Signature · 1 line
2.34.1
PATCH v4 3/3 net/axgbe: fix 100M SGMII mode
In SGMII 100M mode, set MAC speed to 100M instead of 1G, and add the PHY implementation for SGMII 100 mode.
--- drivers/net/axgbe/axgbe_mdio.c | 4 ++-- drivers/net/axgbe/axgbe_phy_impl.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/axgbe/axgbe_mdio.c +2 -2
@@ -155,8 +155,8 @@ static void axgbe_sgmii_10_mode(struct axgbe_port *pdata)static void axgbe_sgmii_100_mode (struct axgbe_port *pdata) { -/* Set MAC to 1G speed */ - pdata->hw_if.set_speed (pdata,SPEED_1000 ); +/* Set MAC to 100M speed */ + pdata->hw_if.set_speed (pdata,SPEED_100 );/* Call PHY implementation support to complete rate change */ pdata->phy_if.phy_impl.set_mode (pdata,AXGBE_MODE_SGMII_100 );
drivers/net/axgbe/axgbe_phy_impl.c +15 -0
@@ -1643,6 +1643,18 @@ static void axgbe_phy_sgmii_1000_mode(struct axgbe_port *pdata) phy_data->cur_mode =AXGBE_MODE_SGMII_1000 ; } +static void axgbe_phy_sgmii_100_mode (struct axgbe_port *pdata) +{ +struct axgbe_phy_data *phy_data = pdata->phy_data; + +axgbe_phy_set_redrv_mode (pdata); + +/* 100M/SGMII */ +axgbe_phy_perform_ratechange (pdata,AXGBE_MB_CMD_SET_1G ,AXGBE_MB_SUBCMD_100MBITS ); + + phy_data->cur_mode =AXGBE_MODE_SGMII_100 ; +} +static void axgbe_phy_sgmii_10_mode (struct axgbe_port *pdata) {struct axgbe_phy_data *phy_data = pdata->phy_data;
@@ -1840,6 +1852,9 @@ static void axgbe_phy_set_mode(struct axgbe_port *pdata, enum axgbe_mode mode)case AXGBE_MODE_SGMII_1000 :axgbe_phy_sgmii_1000_mode (pdata);break ; +case AXGBE_MODE_SGMII_100 : +axgbe_phy_sgmii_100_mode (pdata); +break ;case AXGBE_MODE_SGMII_10 :axgbe_phy_sgmii_10_mode (pdata);break ;
Signature · 1 line
2.34.1
PATCH v5 3/3 net/axgbe: fix 100M SGMII mode
In SGMII 100M mode, set MAC speed to 100M instead of 1G, and add the PHY implementation for SGMII 100 mode.
--- drivers/net/axgbe/axgbe_mdio.c | 4 ++-- drivers/net/axgbe/axgbe_phy_impl.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/axgbe/axgbe_mdio.c +2 -2
@@ -155,8 +155,8 @@ static void axgbe_sgmii_10_mode(struct axgbe_port *pdata)static void axgbe_sgmii_100_mode (struct axgbe_port *pdata) { -/* Set MAC to 1G speed */ - pdata->hw_if.set_speed (pdata,SPEED_1000 ); +/* Set MAC to 100M speed */ + pdata->hw_if.set_speed (pdata,SPEED_100 );/* Call PHY implementation support to complete rate change */ pdata->phy_if.phy_impl.set_mode (pdata,AXGBE_MODE_SGMII_100 );
drivers/net/axgbe/axgbe_phy_impl.c +15 -0
@@ -1643,6 +1643,18 @@ static void axgbe_phy_sgmii_1000_mode(struct axgbe_port *pdata) phy_data->cur_mode =AXGBE_MODE_SGMII_1000 ; } +static void axgbe_phy_sgmii_100_mode (struct axgbe_port *pdata) +{ +struct axgbe_phy_data *phy_data = pdata->phy_data; + +axgbe_phy_set_redrv_mode (pdata); + +/* 100M/SGMII */ +axgbe_phy_perform_ratechange (pdata,AXGBE_MB_CMD_SET_1G ,AXGBE_MB_SUBCMD_100MBITS ); + + phy_data->cur_mode =AXGBE_MODE_SGMII_100 ; +} +static void axgbe_phy_sgmii_10_mode (struct axgbe_port *pdata) {struct axgbe_phy_data *phy_data = pdata->phy_data;
@@ -1840,6 +1852,9 @@ static void axgbe_phy_set_mode(struct axgbe_port *pdata, enum axgbe_mode mode)case AXGBE_MODE_SGMII_1000 :axgbe_phy_sgmii_1000_mode (pdata);break ; +case AXGBE_MODE_SGMII_100 : +axgbe_phy_sgmii_100_mode (pdata); +break ;case AXGBE_MODE_SGMII_10 :axgbe_phy_sgmii_10_mode (pdata);break ;
Signature · 1 line
2.34.1
Quoted 8 lines · On Mon, 16 Feb 2026 18:22:03 +0530 Ashok Kumar Natarajan…
Introduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
This patch does not implement Clause 45 transactions; support for C45 access can be added in future updates as needed.
Quoted 6 lines
No functional changes are introduced for existing drivers. The new helpers will be used by subsequent patches that require external PHY management.
Signed-off-by Ashok Kumar Natarajan <[email protected]>---
The result of AI review feedback reports some issues that need resolution. All AI feedback can be wrong, so use this is inspiration.
Correctness issues (must fix):
1. axgbe_get_phy_id() uses the return value of read() directly in bit-shift arithmetic without checking for errors. If either MDIO read fails (returns negative), the resulting PHY ID is garbage and could accidentally match M88E1512_E_PHY_ID, triggering the wrong init sequence. Please add error checks after each read.
2. axgbe_phy_an_config() silently drops the return value of axgbe_m88e1512_config_aneg(). That function can fail at multiple points but the caller always returns 0. Should be: return axgbe_m88e1512_config_aneg(pdata);
3. axgbe_m88e1512_init() switches PHY pages multiple times but never restores page 0 on error paths. If a write fails while on page 0xFF or 0x12, all subsequent MDIO accesses from other code paths will hit the wrong registers. Add an error cleanup label that restores page 0.
4. The read/write helpers (patch 1) don't check the return value of the underlying read_ext_mii_regs_c22/write_ext_mii_regs_c22 calls. Errors from the hardware layer pass through silently.
Other items:
5. Function name typo: axgbe_m88e5112_set_page should be axgbe_m88e1512_set_page to match the actual PHY model.
6. All three subject lines use uppercase "Add" after the colon — should be lowercase per DPDK convention.
7. Missing space: if(ret) should be if (ret) in the init caller in patch 2.
8. The init function blocks for 2 seconds total (two rte_delay_ms(1000) calls). Is polling for reset completion feasible instead?
9. Missing release notes for external PHY support and 100M speed — these are user-visible features.
10. Various magic numbers (0x8001, 0x1177, 0xC00D) written to registers without defines or comments referencing the datasheet.
Please fix at least items 1-4 and resubmit.
PATCH v2 1/3 net/axgbe: add external PHY read/write functions
In reply to Ashok Kumar NatarajanIntroduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
--- .mailmap | 1 + drivers/net/axgbe/axgbe_dev.c | 56 ++++++++++++++++-------------- drivers/net/axgbe/axgbe_ethdev.h | 16 ++++++--- drivers/net/axgbe/axgbe_phy_impl.c | 45 +++++++++++++++++++++++- 4 files changed, 85 insertions(+), 33 deletions(-)
.mailmap +1 -0
@@ -165,6 +165,7 @@ Ashish Paul <[email protected]> Ashish Sadanandan <[email protected]> Ashish Shah <[email protected]> Ashok Kaladi <[email protected]> +Ashok Kumar Natarajan <[email protected]> Ashwin Sekhar T K <[email protected]> <[email protected]> Asim Jamshed <[email protected]> Atul Patel <[email protected]>
drivers/net/axgbe/axgbe_dev.c +29 -27
119 lines not on this page · raw message
drivers/net/axgbe/axgbe_ethdev.h +11 -5
@@ -327,11 +327,14 @@ struct axgbe_hw_if {int (*set_ext_mii_mode)(struct axgbe_port *,unsigned int ,enum axgbe_mdio_mode ); -int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata,int addr,int reg); -int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata,int addr,int reg,uint16_t val); -int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata,int addr,int devad,int reg); -int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata,int addr,int devad, -int reg,uint16_t val); +int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata,u8 phy_addr, +u16 reg,u16 *value); +int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata,u8 phy_addr, +u16 reg,u16 value); +int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata,u8 phy_addr, +u8 dev_addr,u16 reg,u16 *value); +int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata,u8 phy_addr, +u8 dev_addr,u16 reg,u16 value);/* For FLOW ctrl */ int (*config_tx_flow_control)(struct axgbe_port *);
@@ -398,6 +401,9 @@ struct axgbe_phy_impl_if {/* Pre/Post KR training enablement support */ void (*kr_training_pre)(struct axgbe_port *);void (*kr_training_post)(struct axgbe_port *); + +int (*read)(struct axgbe_port *port,u16 reg,u16 *value); +int (*write)(struct axgbe_port *port,u16 reg,u16 value); };struct axgbe_phy_if {
drivers/net/axgbe/axgbe_phy_impl.c +44 -1
67 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 1/3] net/axgbe: add external PHY read/write functions
Quoted 7 lines · On Wed, 25 Feb 2026 18:14:54 +0530 Ashok Kumar Natarajan…
Introduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
Signed-off-by Ashok Kumar Natarajan <[email protected]>---
I didn't see anything here, but AI spotted some things. Please revise and resubmit.
Thanks for the series. A few findings, mostly in patch 2:
Patch 2 (M88E1512 support):
1. axgbe_phy_link_status() always returns 0 (link up) even when the M88E1512 reports link down or the read fails. The goto out path leads to return 0, which means "link up" in this function's contract. The link-down and error paths need to return a non-zero value.
2. Integer shift UB in axgbe_get_phy_id(): (u32)(phy_id_1 << 16) evaluates the shift at int width before widening. If bit 15 of phy_id_1 is set, shifting into the sign bit is undefined behavior. Move the cast before the shift: (u32)phy_id_1 << 16.
3. axgbe_get_ext_phy_link_status() doesn't
set *linkup = false on the BMCR_ANRESTART early-return path. Works today because the caller pre-initializes the variable, but the function should be self-contained.
4. The new out label unconditionally clearsrx_adapt_done on the M88E1512 link-down path — please verify this is intentional and doesn't interfere with the internal SerDes receiver adaptation state machine.
Patch 3 (100Mbps):
5. The SPEED_1000 → SPEED_100 change in axgbe_sgmii_100_mode() is a bug fix in existing code — the 100M mode function was incorrectly configuring the MAC for 1G. This should have its own Fixes: tag and Cc: [email protected] so it gets backported to stable branches.
Item 1 is the most critical — it inverts link status reporting for the M88E1512.
RE: [PATCH v2 1/3] net/axgbe: add external PHY read/write functions
[AMD Official Use Only - AMD Internal Distribution Only]
Thanks for the review.
axgbe_phy_link_status() follows the existing driver convention where it returns 0 when the link is down and 1 when the link is up. The logic in the patch is aligned with this behavior. Added a brief comment in the code(v3) to make this return semantics clearer.
Taken care of the other comments in v3 patches
Could you share which AI tool was used for this review?
Thanks,
Ashok
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, February 26, 2026 4:39 AM
To: Natarajan, Ashok Kumar <[email protected]>
Cc: [email protected]; Sebastian, Selwin <[email protected]>
Subject: Re: [PATCH v2 1/3] net/axgbe: add external PHY read/write functions
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 7 lines · On Wed, 25 Feb 2026 18:14:54 +0530 Ashok Kumar Natarajan…
Introduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
Signed-off-by Ashok Kumar Natarajan <[email protected]>---
I didn't see anything here, but AI spotted some things. Please revise and resubmit.
Thanks for the series. A few findings, mostly in patch 2:
Patch 2 (M88E1512 support):
1. axgbe_phy_link_status() always returns 0 (link up) even when the
M88E1512 reports link down or the read fails. The goto out path leads to return 0, which means "link up" in this function's contract. The link-down and error paths need to return a non-zero value.
2. Integer shift UB in axgbe_get_phy_id(): (u32)(phy_id_1 << 16) evaluates the shift at int width before widening. If bit 15 of phy_id_1 is set, shifting into the sign bit is undefined behavior. Move the cast before the shift: (u32)phy_id_1 << 16.
3. axgbe_get_ext_phy_link_status() doesn't set *linkup = false on the BMCR_ANRESTART early-return path. Works today because the caller pre-initializes the variable, but the function should be self-contained.
4. The new out label unconditionally clears rx_adapt_done on the M88E1512 link-down path — please verify this is intentional and doesn't interfere with the internal SerDes receiver adaptation state machine.
Patch 3 (100Mbps):
5. The SPEED_1000 → SPEED_100 change in axgbe_sgmii_100_mode() is a bug fix in existing code — the 100M mode function was incorrectly configuring the MAC for 1G. This should have its own Fixes: tag and Cc: [email protected] so it gets backported to stable branches.
Item 1 is the most critical — it inverts link status reporting for the M88E1512.
PATCH v3 1/3 net/axgbe: add external PHY read/write functions
In reply to Ashok Kumar NatarajanIntroduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
--- .mailmap | 1 + drivers/net/axgbe/axgbe_dev.c | 56 ++++++++++++++++-------------- drivers/net/axgbe/axgbe_ethdev.h | 16 ++++++--- drivers/net/axgbe/axgbe_phy_impl.c | 45 +++++++++++++++++++++++- 4 files changed, 85 insertions(+), 33 deletions(-)
.mailmap +1 -0
@@ -165,6 +165,7 @@ Ashish Paul <[email protected]> Ashish Sadanandan <[email protected]> Ashish Shah <[email protected]> Ashok Kaladi <[email protected]> +Ashok Kumar Natarajan <[email protected]> Ashwin Sekhar T K <[email protected]> <[email protected]> Asim Jamshed <[email protected]> Atul Patel <[email protected]>
drivers/net/axgbe/axgbe_dev.c +29 -27
119 lines not on this page · raw message
drivers/net/axgbe/axgbe_ethdev.h +11 -5
@@ -327,11 +327,14 @@ struct axgbe_hw_if {int (*set_ext_mii_mode)(struct axgbe_port *,unsigned int ,enum axgbe_mdio_mode ); -int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata,int addr,int reg); -int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata,int addr,int reg,uint16_t val); -int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata,int addr,int devad,int reg); -int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata,int addr,int devad, -int reg,uint16_t val); +int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata,u8 phy_addr, +u16 reg,u16 *value); +int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata,u8 phy_addr, +u16 reg,u16 value); +int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata,u8 phy_addr, +u8 dev_addr,u16 reg,u16 *value); +int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata,u8 phy_addr, +u8 dev_addr,u16 reg,u16 value);/* For FLOW ctrl */ int (*config_tx_flow_control)(struct axgbe_port *);
@@ -398,6 +401,9 @@ struct axgbe_phy_impl_if {/* Pre/Post KR training enablement support */ void (*kr_training_pre)(struct axgbe_port *);void (*kr_training_post)(struct axgbe_port *); + +int (*read)(struct axgbe_port *pdata,u16 reg,u16 *value); +int (*write)(struct axgbe_port *pdata,u16 reg,u16 value); };struct axgbe_phy_if {
drivers/net/axgbe/axgbe_phy_impl.c +44 -1
67 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v3 1/3] net/axgbe: add external PHY read/write functions
drivers/net/axgbe/axgbe_phy_impl.c static int axgbe_phy_i2c_xfer(struct axgbe_port *pdata, · line 276
Quoted 5 lines · On Thu, 26 Feb 2026 22:16:36 +0530 Ashok Kumar Natarajan…
drivers/net/axgbe/axgbe_phy_impl.c +5
-0+ ret = pdata->hw_if.read_ext_mii_regs_c22 (pdata, + phy_data->mdio_addr, reg, value); +if (ret) +PMD_DRV_LOG_LINE (ERR ,"mdio read failed %s" , +strerror (ret));
Shouldn't this be strerror(-ret) here?
It looks like the driver uses the negative errno values to indicate errors.
PATCH v4 1/3 net/axgbe: add external PHY read/write functions
In reply to Ashok Kumar NatarajanIntroduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
--- .mailmap | 1 + drivers/net/axgbe/axgbe_dev.c | 56 ++++++++++++++++-------------- drivers/net/axgbe/axgbe_ethdev.h | 16 ++++++--- drivers/net/axgbe/axgbe_phy_impl.c | 45 +++++++++++++++++++++++- 4 files changed, 85 insertions(+), 33 deletions(-)
.mailmap +1 -0
@@ -165,6 +165,7 @@ Ashish Paul <[email protected]> Ashish Sadanandan <[email protected]> Ashish Shah <[email protected]> Ashok Kaladi <[email protected]> +Ashok Kumar Natarajan <[email protected]> Ashwin Sekhar T K <[email protected]> <[email protected]> Asim Jamshed <[email protected]> Atul Patel <[email protected]>
drivers/net/axgbe/axgbe_dev.c +29 -27
119 lines not on this page · raw message
drivers/net/axgbe/axgbe_ethdev.h +11 -5
@@ -327,11 +327,14 @@ struct axgbe_hw_if {int (*set_ext_mii_mode)(struct axgbe_port *,unsigned int ,enum axgbe_mdio_mode ); -int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata,int addr,int reg); -int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata,int addr,int reg,uint16_t val); -int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata,int addr,int devad,int reg); -int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata,int addr,int devad, -int reg,uint16_t val); +int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata,u8 phy_addr, +u16 reg,u16 *value); +int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata,u8 phy_addr, +u16 reg,u16 value); +int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata,u8 phy_addr, +u8 dev_addr,u16 reg,u16 *value); +int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata,u8 phy_addr, +u8 dev_addr,u16 reg,u16 value);/* For FLOW ctrl */ int (*config_tx_flow_control)(struct axgbe_port *);
@@ -398,6 +401,9 @@ struct axgbe_phy_impl_if {/* Pre/Post KR training enablement support */ void (*kr_training_pre)(struct axgbe_port *);void (*kr_training_post)(struct axgbe_port *); + +int (*read)(struct axgbe_port *pdata,u16 reg,u16 *value); +int (*write)(struct axgbe_port *pdata,u16 reg,u16 value); };struct axgbe_phy_if {
drivers/net/axgbe/axgbe_phy_impl.c +44 -1
67 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v5 1/3 net/axgbe: add external PHY read/write functions
Introduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
--- .mailmap | 1 + drivers/net/axgbe/axgbe_dev.c | 56 ++++++++++++++++-------------- drivers/net/axgbe/axgbe_ethdev.h | 16 ++++++--- drivers/net/axgbe/axgbe_phy_impl.c | 45 +++++++++++++++++++++++- 4 files changed, 85 insertions(+), 33 deletions(-)
.mailmap +1 -0
@@ -165,6 +165,7 @@ Ashish Paul <[email protected]> Ashish Sadanandan <[email protected]> Ashish Shah <[email protected]> Ashok Kaladi <[email protected]> +Ashok Kumar Natarajan <[email protected]> Ashwin Sekhar T K <[email protected]> <[email protected]> Asim Jamshed <[email protected]> Atul Patel <[email protected]>
drivers/net/axgbe/axgbe_dev.c +29 -27
119 lines not on this page · raw message
drivers/net/axgbe/axgbe_ethdev.h +11 -5
@@ -327,11 +327,14 @@ struct axgbe_hw_if {int (*set_ext_mii_mode)(struct axgbe_port *,unsigned int ,enum axgbe_mdio_mode ); -int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata,int addr,int reg); -int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata,int addr,int reg,uint16_t val); -int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata,int addr,int devad,int reg); -int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata,int addr,int devad, -int reg,uint16_t val); +int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata,u8 phy_addr, +u16 reg,u16 *value); +int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata,u8 phy_addr, +u16 reg,u16 value); +int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata,u8 phy_addr, +u8 dev_addr,u16 reg,u16 *value); +int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata,u8 phy_addr, +u8 dev_addr,u16 reg,u16 value);/* For FLOW ctrl */ int (*config_tx_flow_control)(struct axgbe_port *);
@@ -398,6 +401,9 @@ struct axgbe_phy_impl_if {/* Pre/Post KR training enablement support */ void (*kr_training_pre)(struct axgbe_port *);void (*kr_training_post)(struct axgbe_port *); + +int (*read)(struct axgbe_port *pdata,u16 reg,u16 *value); +int (*write)(struct axgbe_port *pdata,u16 reg,u16 value); };struct axgbe_phy_if {
drivers/net/axgbe/axgbe_phy_impl.c +44 -1
67 lines not on this page · raw message
Signature · 1 line
2.34.1
Stephen Hemminger
AppliedRe: [PATCH v5 1/3] net/axgbe: add external PHY read/write functions
Quoted 5 lines · On Sat, 28 Feb 2026 20:07:48 +0530 Ashok Kumar Natarajan…
Introduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
Quoted 7 lines
Signed-off-by Ashok Kumar Natarajan <[email protected]>--- .mailmap | 1 + drivers/net/axgbe/axgbe_dev.c | 56 ++++++++++++++++-------------- drivers/net/axgbe/axgbe_ethdev.h | 16 ++++++--- drivers/net/axgbe/axgbe_phy_impl.c | 45 +++++++++++++++++++++++- 4 files changed, 85 insertions(+), 33 deletions(-)
Applied all three patches to next-net
Natarajan, Ashok Kumar
AppliedRE: [PATCH v5 1/3] net/axgbe: add external PHY read/write functions
[AMD Official Use Only - AMD Internal Distribution Only]
Thanks for applying the patches.
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Saturday, February 28, 2026 10:11 PM
To: Natarajan, Ashok Kumar <[email protected]>
Cc: [email protected]; Sebastian, Selwin <[email protected]>
Subject: Re: [PATCH v5 1/3] net/axgbe: add external PHY read/write functions
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 5 lines · On Sat, 28 Feb 2026 20:07:48 +0530 Ashok Kumar Natarajan…
Introduce helper functions to perform external PHY register read and write operations. These helpers currently support only IEEE Clause 22 PHY access, providing a simple and consistent API for accessing standard 16‑bit MII registers on external PHY devices.
Quoted 7 lines
Signed-off-by Ashok Kumar Natarajan <[email protected]>--- .mailmap | 1 + drivers/net/axgbe/axgbe_dev.c | 56 ++++++++++++++++-------------- drivers/net/axgbe/axgbe_ethdev.h | 16 ++++++--- drivers/net/axgbe/axgbe_phy_impl.c | 45 +++++++++++++++++++++++- 4 files changed, 85 insertions(+), 33 deletions(-)
Applied all three patches to next-net