Skip to content

Commit 0a1c7a7

Browse files
Johan JonkerPaolo Abeni
authored andcommitted
net: arc: rockchip: fix emac mdio node support
The binding emac_rockchip.txt is converted to YAML. Changed against the original binding is an added MDIO subnode. This make the driver failed to find the PHY, and given the 'mdio has invalid PHY address' it is probably looking in the wrong node. Fix emac_mdio.c so that it can handle both old and new device trees. Fixes: 1dabb74 ("ARM: dts: rockchip: restyle emac nodes") Signed-off-by: Johan Jonker <[email protected]> Tested-by: Andy Yan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andy Yan <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 71803c1 commit 0a1c7a7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/net/ethernet/arc/emac_mdio.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv)
133133
struct arc_emac_mdio_bus_data *data = &priv->bus_data;
134134
struct device_node *np = priv->dev->of_node;
135135
const char *name = "Synopsys MII Bus";
136+
struct device_node *mdio_node;
136137
struct mii_bus *bus;
137138
int error;
138139

@@ -164,7 +165,13 @@ int arc_mdio_probe(struct arc_emac_priv *priv)
164165

165166
snprintf(bus->id, MII_BUS_ID_SIZE, "%s", bus->name);
166167

167-
error = of_mdiobus_register(bus, priv->dev->of_node);
168+
/* Backwards compatibility for EMAC nodes without MDIO subnode. */
169+
mdio_node = of_get_child_by_name(np, "mdio");
170+
if (!mdio_node)
171+
mdio_node = of_node_get(np);
172+
173+
error = of_mdiobus_register(bus, mdio_node);
174+
of_node_put(mdio_node);
168175
if (error) {
169176
mdiobus_free(bus);
170177
return dev_err_probe(priv->dev, error,

0 commit comments

Comments
 (0)