[openwrt/openwrt] realtek: mdio: use bus auto registration
LEDE Commits
lede-commits at lists.infradead.org
Fri Feb 13 03:53:53 PST 2026
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/4e003062f7373d081532ae5d48e7c7c82c64d279
commit 4e003062f7373d081532ae5d48e7c7c82c64d279
Author: Markus Stockhausen <markus.stockhausen at gmx.de>
AuthorDate: Tue Feb 10 12:55:15 2026 +0100
realtek: mdio: use bus auto registration
Let the mdio bus autodetect the attached phys by providing a proper
scan mask. Although this breaks the linkage to the DTS it is better
than adding phys manually.
Signed-off-by: Markus Stockhausen <markus.stockhausen at gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21968
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
.../files-6.12/drivers/net/mdio/mdio-realtek-otto.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 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 e846c00b60..dc97176c93 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
@@ -177,7 +177,6 @@ struct rtmdio_ctrl {
bool raw[RTMDIO_MAX_PORT];
int smi_bus[RTMDIO_MAX_PORT];
int smi_addr[RTMDIO_MAX_PORT];
- struct device_node *dn[RTMDIO_MAX_PORT];
bool smi_bus_isc45[RTMDIO_MAX_SMI_BUS];
};
@@ -931,6 +930,7 @@ static int rtmdio_probe(struct platform_device *pdev)
struct rtmdio_ctrl *ctrl;
struct device_node *dn;
struct mii_bus *bus;
+ u64 mask = 0ULL;
int ret, addr;
bus = devm_mdiobus_alloc_size(dev, sizeof(*ctrl));
@@ -967,7 +967,7 @@ static int rtmdio_probe(struct platform_device *pdev)
if (of_device_is_compatible(dn, "ethernet-phy-ieee802.3-c45"))
ctrl->smi_bus_isc45[ctrl->smi_bus[addr]] = true;
- ctrl->dn[addr] = dn;
+ mask |= BIT_ULL(addr);
}
bus->name = "Realtek MDIO bus";
@@ -977,7 +977,7 @@ static int rtmdio_probe(struct platform_device *pdev)
bus->read_c45 = rtmdio_read_c45;
bus->write_c45 = rtmdio_write_c45;
bus->parent = dev;
- bus->phy_mask = ~0;
+ bus->phy_mask = ~mask;
snprintf(bus->id, MII_BUS_ID_SIZE, "realtek-mdio");
device_set_node(&bus->dev, of_fwnode_handle(dev->of_node));
@@ -988,14 +988,6 @@ static int rtmdio_probe(struct platform_device *pdev)
if (ctrl->cfg->setup_polling)
ctrl->cfg->setup_polling(bus);
- for (addr = 0; addr < ctrl->cfg->cpu_port; addr++) {
- if (ctrl->dn[addr]) {
- ret = fwnode_mdiobus_register_phy(bus, of_fwnode_handle(ctrl->dn[addr]), addr);
- if (ret)
- return ret;
- }
- }
-
return 0;
}
More information about the lede-commits
mailing list