net: phy: ethernet_id: fix duplicate eth_phy binding
Subsystems (2)
PATCH 1/1 net: phy: ethernet_id: fix duplicate eth_phy binding
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.
--- drivers/net/phy/ethernet_id.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/ethernet_id.c +3 -1
@@ -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,
Signature · 1 line
2.34.1
Quoted 10 lines · Pranav Tilak
When both
CONFIG_PHY_ETHERNET_IDandCONFIG_DM_ETH_PHYare enabled,eth_phy_binds_nodes()called frometh_post_bind()already binds the ethernet PHY node toeth_phy_generic_drv. However,phy_connect_phy_id()called viazynq_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()withuclass_get_device_by_ofnode()to skip re-binding if the PHY node is already registered inUCLASS_ETH_PHY.
Shouldn't phy_connect() check whether the PHY isn't already bound and bail early if it is ?
[Public]
Hi @Marek Vasut,
Quoted 20 lines
-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Monday, April 6, 2026 9:35 PM
To: Vinay Tilak, Pranav <[email protected]>; [email protected]; Simek, Michal <[email protected]>
Cc: git (AMD-Xilinx) <[email protected]>; Begari, Padmarao <[email protected]>; Jerome Forissier <[email protected]>; Tom Rini <[email protected]>; Marek Vasut <[email protected]>; Ramon Fried <[email protected]>
Subject: Re: [PATCH] net: phy:ethernet_id: fix duplicateeth_phybindingQuoted 1 line · Pranav Tilak
When both
CONFIG_PHY_ETHERNET_IDandCONFIG_DM_ETH_PHYareenabled,
Quoted 6 lines
eth_phy_binds_nodes()called frometh_post_bind()already binds the ethernet PHY node toeth_phy_generic_drv. However,phy_connect_phy_id()called viazynq_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.
Quoted 5 lines
Quoted 3 lines
Fix this by guarding the bind/probe block in
phy_connect_phy_id()withuclass_get_device_by_ofnode()to skip re-binding if the PHY node is already registered inUCLASS_ETH_PHY.Shouldn't
phy_connect()check whether the PHY isn't already bound and bail early if it is ?
Yes, i checked we can move the duplicate binding check from phy_connect_phy_id() to its caller in phy_connect() and using uclass_get_device_by_phandle() to skip re-binding if the PHY node is already registered in UCLASS_ETH_PHY. Will update in v2.
Thanks,
Pranav Tilak.