From fafe10fd257963531a3c8b8d38a0ab911c849312 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Tue, 7 Apr 2026 18:22:07 +0200 Subject: [PATCH] realtek: mdio: provide bidirectional bus lookup Add two attributes to the central control and the channel structure. chan->smi_bus: The index of the selected channel. ctrl->bus[].mii_bus: Links to all busses With this ctrl/chan can lookup each others data more easily. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/22830 Signed-off-by: Robert Marko --- .../realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c | 5 +++++ 1 file changed, 5 insertions(+) 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 d604185d10..338118faea 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 @@ -185,6 +185,7 @@ struct rtmdio_port { struct rtmdio_bus { bool is_c45; + struct mii_bus *mii_bus; }; struct rtmdio_ctrl { @@ -198,6 +199,7 @@ struct rtmdio_ctrl { struct rtmdio_chan { struct rtmdio_ctrl *ctrl; + u8 smi_bus; }; struct rtmdio_config { @@ -947,6 +949,9 @@ static int rtmdio_probe_one(struct device *dev, struct rtmdio_ctrl *ctrl) chan = bus->priv; chan->ctrl = ctrl; + chan->smi_bus = 0; + ctrl->bus[0].mii_bus = bus; + bus->name = "Realtek MDIO bus"; bus->reset = rtmdio_reset; bus->read = rtmdio_read;