Thread (35 messages) 35 messages, 7 authors, 2025-03-20
STALE460d
Revisions (9)
  1. v10 [diff vs current]
  2. v11 [diff vs current]
  3. v12 current
  4. v13 [diff vs current]
  5. v14 [diff vs current]
  6. v15 [diff vs current]
  7. v16 [diff vs current]
  8. v17 [diff vs current]
  9. v18 [diff vs current]

[net-next PATCH v12 08/13] net: mdio: regmap: add OF support

From: Christian Marangi <ansuelsmth@gmail.com>
Date: 2025-03-09 17:28:03
Also in: linux-arm-kernel, linux-devicetree, linux-mediatek, lkml
Subsystem: ethernet phy library, mdio regmap driver, networking drivers, the rest · Maintainers: Andrew Lunn, Heiner Kallweit, Maxime Chevallier, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Permit to pass the device node pointer to mdio regmap config and permit
mdio registration with an OF node to support DT PHY probe.

With the device node pointer NULL, the normal mdio registration is used.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/net/mdio/mdio-regmap.c   | 2 +-
 include/linux/mdio/mdio-regmap.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mdio/mdio-regmap.c b/drivers/net/mdio/mdio-regmap.c
index 8bfcd9e415c8..329839ab68e6 100644
--- a/drivers/net/mdio/mdio-regmap.c
+++ b/drivers/net/mdio/mdio-regmap.c
@@ -90,7 +90,7 @@ struct mii_bus *devm_mdio_regmap_register(struct device *dev,
 	else
 		mii->phy_mask = ~0;
 
-	rc = devm_mdiobus_register(dev, mii);
+	rc = devm_of_mdiobus_register(dev, mii, config->np);
 	if (rc) {
 		dev_err(config->parent, "Cannot register MDIO bus![%s] (%d)\n", mii->id, rc);
 		return ERR_PTR(rc);
diff --git a/include/linux/mdio/mdio-regmap.h b/include/linux/mdio/mdio-regmap.h
index 8c7061e39ccb..23fc2dd9d752 100644
--- a/include/linux/mdio/mdio-regmap.h
+++ b/include/linux/mdio/mdio-regmap.h
@@ -22,6 +22,7 @@ struct regmap;
 
 struct mdio_regmap_config {
 	struct device *parent;
+	struct device_node *np;
 	struct regmap *regmap;
 	char name[MII_BUS_ID_SIZE];
 	u8 valid_addr;
-- 
2.48.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help