[openwrt/openwrt] realtek: mdio: prevent WARN_ONCE() during bus scan

LEDE Commits lede-commits at lists.infradead.org
Fri Feb 13 03:53:52 PST 2026


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/df939b3316167b74b07a92816b641b67d7ecea75

commit df939b3316167b74b07a92816b641b67d7ecea75
Author: Markus Stockhausen <markus.stockhausen at gmx.de>
AuthorDate: Tue Feb 10 19:49:44 2026 +0100

    realtek: mdio: prevent WARN_ONCE() during bus scan
    
    The mdio bus detection will be changed from DTS based detection to
    autoscan. To avoid spurious WARN_ONCE() messages return -EIO for
    reads to register 2 during C22 scan when phy is on a c45 based bus.
    The C45 rescan afterwards will detect the phy normally.
    
    Signed-off-by: Markus Stockhausen <markus.stockhausen at gmx.de>
    Link: https://github.com/openwrt/openwrt/pull/21968
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c b/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c
index 2387b91994..e846c00b60 100644
--- a/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c
+++ b/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c
@@ -504,6 +504,10 @@ static int rtmdio_read(struct mii_bus *bus, int addr, int regnum)
 	if (addr >= ctrl->cfg->cpu_port)
 		return -ENODEV;
 
+	/* prevent WARN_ONCE() during scan */
+	if (ctrl->smi_bus[addr] >=0 && ctrl->smi_bus_isc45[ctrl->smi_bus[addr]] && regnum == 2)
+		return -EIO;
+
 	if (regnum == RTMDIO_PAGE_SELECT && ctrl->page[addr] != ctrl->cfg->raw_page)
 		return ctrl->page[addr];
 




More information about the lede-commits mailing list