net: mdio-mt7531-mmio: fix switch regs initialization

mdio is a child node of the switch, so to get switch base address
we need to lookup for a parent node

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
This commit is contained in:
Mikhail Kshevetskiy
2026-01-31 01:06:25 +03:00
committed by Jerome Forissier
parent caa62920e3
commit 3aabc0dae0

View File

@@ -151,8 +151,13 @@ static const struct mdio_ops mt7531_mdio_ops = {
static int mt7531_mdio_probe(struct udevice *dev)
{
struct mt7531_mdio_priv *priv = dev_get_priv(dev);
ofnode switch_node;
priv->switch_regs = dev_read_addr(dev);
switch_node = ofnode_get_parent(dev_ofnode(dev));
if (!ofnode_valid(switch_node))
return -EINVAL;
priv->switch_regs = ofnode_get_addr(switch_node);
if (priv->switch_regs == FDT_ADDR_T_NONE)
return -EINVAL;