diff options
| author | Manuel Stocker <mensi@mensi.ch> | 2026-06-03 20:59:24 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-06-06 04:38:56 +0300 |
| commit | 50b682a5aed70847e0746db7f723d22bef1801d1 (patch) | |
| tree | 1dc5903db852d474b644b8d835b280dbefcf9313 | |
| parent | 56b4864150970ba834367fe74b37ce250419347e (diff) | |
| download | linux-50b682a5aed70847e0746db7f723d22bef1801d1.tar.xz | |
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 <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>
| -rw-r--r-- | drivers/net/mdio/mdio-realtek-rtl9300.c | 17 |
1 files changed, 16 insertions, 1 deletions
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; |
