mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
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>
This commit is contained in:
parent
56b4864150
commit
50b682a5ae
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user