From: Manuel Stocker Date: Wed, 3 Jun 2026 17:59:24 +0000 (+0200) Subject: net: mdio: realtek-rtl9300: Correctly handle ethernet-phy-package X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=50b682a5aed70847e0746db7f723d22bef1801d1;p=thirdparty%2Flinux.git net: mdio: realtek-rtl9300: Correctly handle ethernet-phy-package 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 Signed-off-by: Markus Stockhausen Link: https://patch.msgid.link/20260603175924.123019-8-markus.stockhausen@gmx.de Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/mdio/mdio-realtek-rtl9300.c b/drivers/net/mdio/mdio-realtek-rtl9300.c index bd361aa19739..92c8f2512476 100644 --- a/drivers/net/mdio/mdio-realtek-rtl9300.c +++ b/drivers/net/mdio/mdio-realtek-rtl9300.c @@ -432,6 +432,21 @@ static int otto_emdio_probe_one(struct device *dev, struct otto_emdio_priv *priv 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. @@ -457,7 +472,7 @@ static int otto_emdio_map_ports(struct device *dev) 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;