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 <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22604
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Markus Stockhausen 2026-03-25 12:22:13 +01:00 committed by Robert Marko
parent c6ccca619c
commit 0cb3d6f39d

View 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;