[PATCH 3/3] RFC: net: dsa: mv88e6xxx: Register mdio-external

From: Linus Walleij
Date: Thu Oct 12 2023 - 18:35:36 EST


Make it legal to have a subnode just named "mdio-external"
and have that be recognized immediately as the external
MDIO bus, register it and return. Only fallback to the
old method with a compatible in the external bus node
if this doesn't work.

This is the result of deprecating the old DT method
of providing a node "mdio1" with a compatible string.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
drivers/net/dsa/mv88e6xxx/chip.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 52a99d8bada0..05f6776885f6 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3676,7 +3676,21 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip)
if (err)
return err;

- /* Walk the device tree, and see if there are any other nodes
+ /* If the optional external bus is explicitly named as such,
+ * just register it and be done with this.
+ */
+ child = of_get_child_by_name(np, "mdio-external");
+ if (child) {
+ err = mv88e6xxx_mdio_register(chip, child, true);
+ of_node_put(child);
+ if (err)
+ return err;
+ return 0;
+ }
+
+ /* Deprecated binding with compatible:
+ *
+ * Walk the device tree, and see if there are any other nodes
* which say they are compatible with the external mdio
* bus.
*/

--
2.41.0