]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: mdio: setup topology from control structure
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Wed, 25 Mar 2026 11:22:13 +0000 (12:22 +0100)
committerRobert Marko <robimarko@gmail.com>
Fri, 27 Mar 2026 19:51:43 +0000 (20:51 +0100)
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 <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22604
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c

index ece609433640ab09f64663f74f01657fc82a9d86..75b8b13cd6c24cda0762a2762b11ee291ee82c13 100644 (file)
@@ -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;