From 924db123146fb2585722063fe8e09d2499b41d9f Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Tue, 7 Apr 2026 18:22:07 +0200 Subject: [PATCH] realtek: mdio: derive phy info from control structure For polling setup the driver looks up the atached phy ids with function rtmdio_get_phy_info(). This derives the data from a given bus and a port number. While this works for a single bus the combination of port and bus makes no sense. One is the global view the other the bus individual view. Change the signature so the lookup is done globally via ctrl/port. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/22830 Signed-off-by: Robert Marko --- .../files-6.18/drivers/net/mdio/mdio-realtek-otto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c b/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c index 338118faea..e2131ee08f 100644 --- a/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c +++ b/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c @@ -640,9 +640,9 @@ static u32 rtmdio_get_phy_id(struct phy_device *phydev) return phydev->phy_id; } -static int rtmdio_get_phy_info(struct mii_bus *bus, int addr, struct rtmdio_phy_info *phyinfo) +static int rtmdio_get_phy_info(struct rtmdio_ctrl *ctrl, int pn, struct rtmdio_phy_info *phyinfo) { - struct phy_device *phydev = mdiobus_get_phy(bus, addr); + struct phy_device *phydev = mdiobus_get_phy(ctrl->bus[0].mii_bus, pn); u32 phyid = rtmdio_get_phy_id(phydev); int ret = 0; @@ -683,7 +683,7 @@ static int rtmdio_get_phy_info(struct mii_bus *bus, int addr, struct rtmdio_phy_ phyinfo->has_res_reg = true; break; default: - pr_warn("skip polling setup for unknown PHY %08x on address %d\n", phyid, addr); + pr_warn("skip polling setup for unknown PHY %08x on port %d\n", phyid, pn); ret = -EINVAL; break; } @@ -767,7 +767,7 @@ static void rtmdio_930x_setup_polling(struct mii_bus *bus) /* Define PHY specific polling parameters */ for_each_port(ctrl, pn) { - if (rtmdio_get_phy_info(bus, pn, &phyinfo)) + if (rtmdio_get_phy_info(ctrl, pn, &phyinfo)) continue; /* set to "PHY driven" */ @@ -830,7 +830,7 @@ static void rtmdio_931x_setup_polling(struct mii_bus *bus) u8 smi = ctrl->port[pn].smi_bus; unsigned int mask, val; - if (rtmdio_get_phy_info(bus, pn, &phyinfo)) + if (rtmdio_get_phy_info(ctrl, pn, &phyinfo)) continue; /* set to "PHY driven" */