[PATCH] net: phy: ethernet_id: fix duplicate eth_phy binding

Pranav Tilak pranav.vinaytilak at amd.com
Mon Apr 6 10:41:50 CEST 2026


When both CONFIG_PHY_ETHERNET_ID and CONFIG_DM_ETH_PHY are enabled,
eth_phy_binds_nodes() called from eth_post_bind() already binds the
ethernet PHY node to eth_phy_generic_drv. However, phy_connect_phy_id()
called via zynq_phy_init() -> phy_connect() cannot attach to the
already bound PHY device and creates a second instance, resulting
in duplicate entries in the dm tree.

Fix this by guarding the bind/probe block in phy_connect_phy_id()
with uclass_get_device_by_ofnode() to skip re-binding if the PHY
node is already registered in UCLASS_ETH_PHY.

Fixes: 68a4d1506109 ("net: phy: Bind ETH_PHY uclass driver to each new PHY")
Signed-off-by: Pranav Tilak <pranav.vinaytilak at amd.com>
---
 drivers/net/phy/ethernet_id.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/ethernet_id.c b/drivers/net/phy/ethernet_id.c
index 2f8454ca27d..7b232ab37f6 100644
--- a/drivers/net/phy/ethernet_id.c
+++ b/drivers/net/phy/ethernet_id.c
@@ -8,6 +8,7 @@
 #include <dm/device_compat.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
+#include <dm/uclass.h>
 #include <phy.h>
 #include <linux/delay.h>
 #include <asm/gpio.h>
@@ -51,7 +52,8 @@ struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
 	if (phydev)
 		phydev->node = node;
 
-	if (IS_ENABLED(CONFIG_DM_ETH_PHY) && ofnode_valid(node)) {
+	if (IS_ENABLED(CONFIG_DM_ETH_PHY) && ofnode_valid(node) &&
+	    uclass_get_device_by_ofnode(UCLASS_ETH_PHY, node, &pdev)) {
 		node_name = ofnode_get_name(node);
 		ret = device_bind_driver_to_node(dev, "eth_phy_generic_drv",
 						 node_name, node,
-- 
2.34.1



More information about the U-Boot mailing list