lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH net-next v2 03/11] net: mdio: fwnode: remove legacy phy scanning
Date
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
\
 
 \ /
  Last update: 2022-03-31 11:33    [W:0.050 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site