diff options
author | Luiz Angelo Daros de Luca <luizluca@gmail.com> | 2022-05-22 22:32:34 -0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-05-23 12:27:53 +0100 |
commit | fe7324b932222574a0721b80e72c6c5fe57960d1 (patch) | |
tree | 6e7a2ce62f34b721402696e9c0992fc566588059 /net/dsa | |
parent | 32c53420d2a0c2c3a691edb895d90d9d028ca3e0 (diff) | |
download | linux-stable-fe7324b932222574a0721b80e72c6c5fe57960d1.tar.gz linux-stable-fe7324b932222574a0721b80e72c6c5fe57960d1.tar.bz2 linux-stable-fe7324b932222574a0721b80e72c6c5fe57960d1.zip |
net: dsa: OF-ware slave_mii_bus
If found, register the DSA internally allocated slave_mii_bus with an OF
"mdio" child object. It can save some drivers from creating their
custom internal MDIO bus.
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa2.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index d0a2452a1e24..cac48a741f27 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -13,6 +13,7 @@ #include <linux/slab.h> #include <linux/rtnetlink.h> #include <linux/of.h> +#include <linux/of_mdio.h> #include <linux/of_net.h> #include <net/devlink.h> #include <net/sch_generic.h> @@ -852,6 +853,7 @@ disconnect: static int dsa_switch_setup(struct dsa_switch *ds) { struct dsa_devlink_priv *dl_priv; + struct device_node *dn; struct dsa_port *dp; int err; @@ -907,7 +909,10 @@ static int dsa_switch_setup(struct dsa_switch *ds) dsa_slave_mii_bus_init(ds); - err = mdiobus_register(ds->slave_mii_bus); + dn = of_get_child_by_name(ds->dev->of_node, "mdio"); + + err = of_mdiobus_register(ds->slave_mii_bus, dn); + of_node_put(dn); if (err < 0) goto free_slave_mii_bus; } |