Thread (12 messages) 12 messages, 1 author, 2022-03-31
STALE1525d

[RFC PATCH net-next v2 03/11] net: mdio: fwnode: remove legacy phy scanning

From: Clément Léger <clement.leger@bootlin.com>
Date: 2022-03-31 09:27:32
Also in: lkml
Subsystem: ethernet phy library, networking drivers, the rest · Maintainers: Andrew Lunn, Heiner Kallweit, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

When 'reg' property is missing from child MDIO nodes, an automatic scan
is done to find phy devices that are present on the bus. Since the
'reg' property is marked as required in the mdio.yaml bindings, remove
this legacy scan mechanism.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/net/mdio/fwnode_mdio.c | 39 +---------------------------------
 1 file changed, 1 insertion(+), 38 deletions(-)
diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
index 17585c5b34bb..38c873c49ecf 100644
--- a/drivers/net/mdio/fwnode_mdio.c
+++ b/drivers/net/mdio/fwnode_mdio.c
@@ -217,7 +217,6 @@ EXPORT_SYMBOL(fwnode_mdiobus_child_is_phy);
 int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 {
 	struct device_node *child;
-	bool scanphys = false;
 	int addr, rc;
 
 	if (!np)
@@ -247,10 +246,8 @@ int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 	/* Loop over the child nodes and register a phy_device for each phy */
 	for_each_available_child_of_node(np, child) {
 		addr = of_mdio_parse_addr(&mdio->dev, child);
-		if (addr < 0) {
-			scanphys = true;
+		if (addr < 0)
 			continue;
-		}
 
 		if (of_mdiobus_child_is_phy(child))
 			rc = fwnode_mdiobus_register_phy(mdio,
@@ -267,40 +264,6 @@ int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 			goto unregister;
 	}
 
-	if (!scanphys)
-		return 0;
-
-	/* auto scan for PHYs with empty reg property */
-	for_each_available_child_of_node(np, child) {
-		/* Skip PHYs with reg property set */
-		if (of_find_property(child, "reg", NULL))
-			continue;
-
-		for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
-			/* skip already registered PHYs */
-			if (mdiobus_is_registered_device(mdio, addr))
-				continue;
-
-			/* be noisy to encourage people to set reg property */
-			dev_info(&mdio->dev, "scan phy %pOFn at address %i\n",
-				 child, addr);
-
-			if (of_mdiobus_child_is_phy(child)) {
-				/* -ENODEV is the return code that PHYLIB has
-				 * standardized on to indicate that bus
-				 * scanning should continue.
-				 */
-				rc = fwnode_mdiobus_register_phy(mdio,
-								 of_fwnode_handle(child),
-								 addr);
-				if (!rc)
-					break;
-				if (rc != -ENODEV)
-					goto unregister;
-			}
-		}
-	}
-
 	return 0;
 
 unregister:
-- 
2.34.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