Realtek Otto switches usually make use of multiport PHYs (e.g. 8 port
1G RTL8218D or 4 port 2.5G RTL8224). The device tree can describe this
fact via an "ethernet-phy-package" node that resides between the bus
and the PHY node.
When looking up the device tree bus node via the chain port->phy->parent
the driver totally ignores the existence of a PHY package. Enhance the
lookup to take care of this feature.
Link: https://github.com/openwrt/openwrt/pull/23591
Signed-off-by: Manuel Stocker <mensi@mensi.ch>
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://patch.msgid.link/20260603175924.123019-8-markus.stockhausen@gmx.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
return 0;
}
+static struct device_node *otto_emdio_get_bus_node(struct device_node *dn)
+{
+ struct device_node *parent = of_get_parent(dn);
+ struct device_node *grandparent;
+
+ if (parent && of_node_name_eq(parent, "ethernet-phy-package")) {
+ grandparent = of_get_parent(parent);
+ of_node_put(parent);
+
+ return grandparent;
+ }
+
+ return parent;
+}
+
/* The mdio-controller is part of a switch block so we parse the sibling
* ethernet-ports node and build a mapping of the switch port to MDIO bus/addr
* based on the phy-handle.
if (!phy_dn)
continue;
- bus_dn = of_get_parent(phy_dn);
+ bus_dn = otto_emdio_get_bus_node(phy_dn);
if (!bus_dn)
goto put_nodes;