public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mt7530: register OF node for internal MDIO bus
@ 2023-04-30 11:28 David Bauer
  2023-04-30 11:28 ` [PATCH 2/2] dt-bindings: net: dsa: mediatek,mt7530: document MDIO-bus David Bauer
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: David Bauer @ 2023-04-30 11:28 UTC (permalink / raw)
  To: Sean Wang, Landen Chao, DENG Qingfang, Daniel Golle, Andrew Lunn,
	Florian Fainelli, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek

The MT753x switches provide a switch-internal MDIO bus for the embedded
PHYs.

Register a OF sub-node on the switch OF-node for this internal MDIO bus.
This allows to configure the embedded PHYs using device-tree.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 drivers/net/dsa/mt7530.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index c680873819b0..7e8ea5b75c3e 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -2119,10 +2119,13 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
 {
 	struct dsa_switch *ds = priv->ds;
 	struct device *dev = priv->dev;
+	struct device_node *np, *mnp;
 	struct mii_bus *bus;
 	static int idx;
 	int ret;
 
+	np = priv->dev->of_node;
+
 	bus = devm_mdiobus_alloc(dev);
 	if (!bus)
 		return -ENOMEM;
@@ -2141,7 +2144,9 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
 	if (priv->irq)
 		mt7530_setup_mdio_irq(priv);
 
-	ret = devm_mdiobus_register(dev, bus);
+	mnp = of_get_child_by_name(np, "mdio");
+	ret = devm_of_mdiobus_register(dev, bus, mnp);
+	of_node_put(mnp);
 	if (ret) {
 		dev_err(dev, "failed to register MDIO bus: %d\n", ret);
 		if (priv->irq)
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-05-01  9:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-30 11:28 [PATCH 1/2] mt7530: register OF node for internal MDIO bus David Bauer
2023-04-30 11:28 ` [PATCH 2/2] dt-bindings: net: dsa: mediatek,mt7530: document MDIO-bus David Bauer
2023-04-30 12:34   ` Arınç ÜNAL
2023-04-30 12:44     ` Daniel Golle
2023-04-30 12:52       ` Arınç ÜNAL
2023-04-30 16:17     ` Arınç ÜNAL
2023-04-30 17:18       ` Andrew Lunn
2023-04-30 18:28         ` Arınç ÜNAL
2023-04-30 18:48           ` Andrew Lunn
2023-04-30 19:54             ` Arınç ÜNAL
2023-04-30 20:41               ` Andrew Lunn
2023-05-01  9:22               ` David Bauer
2023-05-01  9:28                 ` Arınç ÜNAL
2023-04-30 12:53   ` Arınç ÜNAL
2023-04-30 11:42 ` [PATCH 1/2] mt7530: register OF node for internal MDIO bus Daniel Golle
2023-04-30 14:14 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox