From 0cb3d6f39d2e8ed06438037de5953a78295a4051 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Wed, 25 Mar 2026 12:22:13 +0100 Subject: [PATCH] realtek: mdio: setup topology from control structure The topology setup is bus independent and can be derived completely from the control structure. Adapt the call parameters accordingly. The call location is quite confusing at the moment. Being no longer dependent from the bus call it where it makes most sense. This is directly after the mapping setup in rtmdio_map_ports(). Doing other bus dependent setup between these two functions is not needed any longer. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/22604 Signed-off-by: Robert Marko --- .../realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 ece6094336..75b8b13cd6 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 @@ -567,9 +567,8 @@ static int rtmdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) return 0; } -static void rtmdio_setup_smi_topology(struct mii_bus *bus) +static void rtmdio_setup_smi_topology(struct rtmdio_ctrl *ctrl) { - struct rtmdio_ctrl *ctrl = bus->priv; u32 reg, mask, val, addr; for_each_phy(ctrl, addr) { @@ -926,6 +925,7 @@ static int rtmdio_probe(struct platform_device *pdev) of_node_put(ctrl->port[addr].dn); return ret; } + rtmdio_setup_smi_topology(ctrl); bus->name = "Realtek MDIO bus"; bus->reset = rtmdio_reset; @@ -939,7 +939,6 @@ static int rtmdio_probe(struct platform_device *pdev) device_set_node(&bus->dev, of_fwnode_handle(dev->of_node)); - rtmdio_setup_smi_topology(bus); ret = devm_mdiobus_register(dev, bus); if (ret) return ret;