[{"id":3680181,"web_url":"http://patchwork.ozlabs.org/comment/3680181/","msgid":"<69ea2021-48e0-4b16-ae97-0d56b85b88d7@mailbox.org>","list_archive_url":null,"date":"2026-04-22T01:14:50","subject":"Re: [PATCH v3] net: phy: fix duplicate eth_phy binding","submitter":{"id":85664,"url":"http://patchwork.ozlabs.org/api/people/85664/","name":"Marek Vasut","email":"marek.vasut@mailbox.org"},"content":"On 4/21/26 1:34 PM, Pranav Tilak wrote:\n> When both CONFIG_PHY_ETHERNET_ID and CONFIG_DM_ETH_PHY are enabled,\n> eth_phy_binds_nodes() called from eth_post_bind() already binds the\n> ethernet PHY node to eth_phy_generic_drv. However, phy_connect_phy_id()\n> called via phy_connect() also binds the same PHY node, resulting in\n> duplicate entries in the DM tree.\n> \n> Fix this by checking at the beginning of phy_connect() whether the PHY\n> is already bound via uclass_get_device_by_phandle(). If so, skip all\n> generic binding methods.\n> \n> Fixes: 68a4d1506109 (\"net: phy: Bind ETH_PHY uclass driver to each new PHY\")\n> Signed-off-by: Pranav Tilak <pranav.vinaytilak@amd.com>\n> ---\n> Changes in v3:\n> - Moved duplicate binding check to beginning of phy_connect()\n> \n> Changes in v2:\n> - Move duplicate binding check to caller phy_connect()\n> - Update commit description\n> \n>   drivers/net/phy/phy.c | 6 ++++++\n>   1 file changed, 6 insertions(+)\n> \n> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c\n> index d7e0c4fe02d..b1eb5173fe8 100644\n> --- a/drivers/net/phy/phy.c\n> +++ b/drivers/net/phy/phy.c\n> @@ -927,7 +927,12 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,\n>   {\n>   \tstruct phy_device *phydev = NULL;\n>   \tuint mask = (addr >= 0) ? (1 << addr) : 0xffffffff;\n> +\tstruct udevice *phy_dev;\n>   \n> +\t/* Skip binding if PHY already bound by eth_phy_binds_nodes(). */\n> +\tif (!IS_ENABLED(CONFIG_DM_ETH_PHY) ||\n> +\t    uclass_get_device_by_phandle(UCLASS_ETH_PHY, dev,\n> +\t\t\t\t\t \"phy-handle\", &phy_dev)) {\n\nYou can not simply disable the phy_connect() code if DM_ETH_PHY is \nenabled, that will break a lot of users. There has to be some runtime \ncheck here to determine whether a PHY is already connected or not.","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256\n header.s=mail20150812 header.b=NxJhtdGc;\n\tdkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org\n header.a=rsa-sha256 header.s=mail20150812 header.b=Xmkmqu7e;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=mailbox.org","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n secure) header.d=mailbox.org header.i=@mailbox.org header.b=\"NxJhtdGc\";\n\tdkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org\n header.b=\"Xmkmqu7e\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=mailbox.org","phobos.denx.de;\n spf=pass smtp.mailfrom=marek.vasut@mailbox.org"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0hsR32Krz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 11:46:35 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 7190983C51;\n\tWed, 22 Apr 2026 03:46:27 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 399B083BC8; Wed, 22 Apr 2026 03:46:26 +0200 (CEST)","from mout-p-202.mailbox.org (mout-p-202.mailbox.org\n [IPv6:2001:67c:2050:0:465::202])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 3F90183936\n for <u-boot@lists.denx.de>; Wed, 22 Apr 2026 03:46:24 +0200 (CEST)","from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4g0hsC6wTvz9tlV;\n Wed, 22 Apr 2026 03:46:23 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;\n s=mail20150812; t=1776822384;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=5GrWt0eP60DE40ZOJhaTvS8v3xSdwyNfP0fMZjoeeeU=;\n b=NxJhtdGc9D1Ki/GRWkJM4clLzgNSVOgw+XYkFLeQnebVfA5gd6sI9JxPJ7YEivSW4hWhl+\n PU8mUrcy3SLmszYUR1rXpcCpt0qKAvE3O8y6mTW6KzzUXhT2/zn1Hn+z/pkfmt8Uvn7ci5\n AnUJFIiPbaCsiHVAHltiN+sxMSySD7tlBPlEy52MJM3lOsT+BkBZBih+eakDBgpaZWc52v\n mY6ne6QC55zSwlQrxHEdLWxEcwkTKozIOgWezNyT64yuCgu6NmDa2STVUto5BWuW3yUHRW\n SJvwTNsGnAy70RgYytqi4VpOu0KOCqzeVa2NW0cXb6xfN35QaLeRhiJQQodlCw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;\n s=mail20150812; t=1776822382;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=5GrWt0eP60DE40ZOJhaTvS8v3xSdwyNfP0fMZjoeeeU=;\n b=Xmkmqu7eiqR+W3Jx8wZJcdNjVZHH749dgV/nfjyuJPHPmd8qGZO/ZyEzw9c1JIgLUediaS\n LYGtDtocny0FF4DMXZ6vHdzZalMoVa7FzPPNCNmDVJ5A52L1s+ab9yMKj5Tq6PZVAfq85f\n uWa+TB2/g7KQj4wqiaBprgWkx9TCl8iQzLXl4nGoEMTIq8tV+HdieAy8ytP7ku/VJbiZF7\n 7Iv2QXBjH9HB0ggIJYKWkX6suMISAU5qluNucnzjn7V96991ErxNgAEFo+DMJiX0k92E5r\n CDu/lFdBizAoQjf7aSqJfcRJ0qgMxg1pr0mF39SjzEbqV3sZpSyLOJAUUScqgg=="],"Message-ID":"<69ea2021-48e0-4b16-ae97-0d56b85b88d7@mailbox.org>","Date":"Wed, 22 Apr 2026 03:14:50 +0200","MIME-Version":"1.0","Subject":"Re: [PATCH v3] net: phy: fix duplicate eth_phy binding","To":"Pranav Tilak <pranav.vinaytilak@amd.com>, u-boot@lists.denx.de,\n michal.simek@amd.com","Cc":"git@amd.com, padmarao.begari@amd.com,\n Jerome Forissier <jerome.forissier@arm.com>, Tom Rini <trini@konsulko.com>,\n Patrice Chotard <patrice.chotard@foss.st.com>,\n \"SkyLake.Huang\" <skylake.huang@mediatek.com>,\n \"Lucien.Jheng\" <lucienzx159@gmail.com>, Peng Fan <peng.fan@nxp.com>,\n Siddharth Vadapalli <s-vadapalli@ti.com>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Ramon Fried <rfried.dev@gmail.com>","References":"<20260421113445.3834570-1-pranav.vinaytilak@amd.com>","Content-Language":"en-US","From":"Marek Vasut <marek.vasut@mailbox.org>","In-Reply-To":"<20260421113445.3834570-1-pranav.vinaytilak@amd.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","X-MBO-RS-ID":"62320f5d3d885337870","X-MBO-RS-META":"bicnw1h7zponz45s8w8iurtthaujj77g","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"}}]