Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2115286/?format=api
{ "id": 2115286, "url": "http://patchwork.ozlabs.org/api/patches/2115286/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20250724141536.1222764-1-s-vadapalli@ti.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20250724141536.1222764-1-s-vadapalli@ti.com>", "list_archive_url": null, "date": "2025-07-24T14:15:36", "name": "[v3] net: phy: Support overriding Auto Negotiation timeout with env variable", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "03d803ec383d3c73d1006665e00fa0e8592e37f6", "submitter": { "id": 84157, "url": "http://patchwork.ozlabs.org/api/people/84157/?format=api", "name": "Siddharth Vadapalli", "email": "s-vadapalli@ti.com" }, "delegate": { "id": 157425, "url": "http://patchwork.ozlabs.org/api/users/157425/?format=api", "username": "jforissier", "first_name": "Jerome", "last_name": "Forissier", "email": "jerome.forissier@linaro.org" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20250724141536.1222764-1-s-vadapalli@ti.com/mbox/", "series": [ { "id": 466553, "url": "http://patchwork.ozlabs.org/api/series/466553/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=466553", "date": "2025-07-24T14:15:36", "name": "[v3] net: phy: Support overriding Auto Negotiation timeout with env variable", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/466553/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2115286/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2115286/checks/", "tags": {}, "related": [], "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 (1024-bit key;\n unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256\n header.s=ti-com-17Q1 header.b=NSSiKA4H;\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=quarantine dis=none) header.from=ti.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=ti.com header.i=@ti.com header.b=\"NSSiKA4H\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=quarantine dis=none) header.from=ti.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=s-vadapalli@ti.com" ], "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 4bntMt0f2Nz1xpj\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 25 Jul 2025 00:16:09 +1000 (AEST)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 47C8583885;\n\tThu, 24 Jul 2025 16:16:09 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id B4F1B8388C; Thu, 24 Jul 2025 16:16:07 +0200 (CEST)", "from fllvem-ot04.ext.ti.com (fllvem-ot04.ext.ti.com [198.47.19.246])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n bits)) (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 3F36B83844\n for <u-boot@lists.denx.de>; Thu, 24 Jul 2025 16:16:04 +0200 (CEST)", "from lelvem-sh02.itg.ti.com ([10.180.78.226])\n by fllvem-ot04.ext.ti.com (8.15.2/8.15.2) with ESMTP id 56OEFhcf1963500;\n Thu, 24 Jul 2025 09:15:43 -0500", "from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24])\n by lelvem-sh02.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 56OEFhKw3585650\n (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL);\n Thu, 24 Jul 2025 09:15:43 -0500", "from DFLE103.ent.ti.com (10.64.6.24) by DFLE103.ent.ti.com\n (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55; Thu, 24\n Jul 2025 09:15:43 -0500", "from lelvem-mr06.itg.ti.com (10.180.75.8) by DFLE103.ent.ti.com\n (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55 via\n Frontend Transport; Thu, 24 Jul 2025 09:15:43 -0500", "from uda0492258.dhcp.ti.com (uda0492258.dhcp.ti.com\n [172.24.227.169])\n by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 56OEFa8B274591;\n Thu, 24 Jul 2025 09:15:37 -0500" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,\n RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;\n s=ti-com-17Q1; t=1753366543;\n bh=duf9i0YOEo34TZb71HlP2yUVzdSDS+1BWJId7il+5xQ=;\n h=From:To:CC:Subject:Date;\n b=NSSiKA4HT249i8vJQ8owNy2rHiE48TFOcl938oRU8saLAl+OWBEamt2jZX1imMCgh\n KOid4PMBDHqJFIxXz9ePcvvux13vu8baDE8fjQPhv/S6u4AVweUwOgznrflNnxEPq+\n yt0mTuOjSXXpGnVeOPne7G096gHK3C10ZNN0ODxU=", "From": "Siddharth Vadapalli <s-vadapalli@ti.com>", "To": "<trini@konsulko.com>, <sjg@chromium.org>, <joe.hershberger@ni.com>,\n <rfried.dev@gmail.com>, <michal.simek@amd.com>,\n <marek.vasut+renesas@mailbox.org>, <marek.vasut@mailbox.org>,\n <jerome.forissier@linaro.org>, <quentin.schulz@cherry.de>,\n <kever.yang@rock-chips.com>, <alexthreed@gmail.com>,\n <ilias.apalodimas@linaro.org>, <pbrobinson@gmail.com>,\n <paul.barker.ct@bp.renesas.com>, <romain.gantois@bootlin.com>,\n <lucienzx159@gmail.com>, <skylake.huang@mediatek.com>", "CC": "<u-boot@lists.denx.de>, <u-kumar1@ti.com>, <praneeth@ti.com>, <nm@ti.com>,\n <srk@ti.com>, <s-vadapalli@ti.com>", "Subject": "[PATCH v3] net: phy: Support overriding Auto Negotiation timeout with\n env variable", "Date": "Thu, 24 Jul 2025 19:45:36 +0530", "Message-ID": "<20250724141536.1222764-1-s-vadapalli@ti.com>", "X-Mailer": "git-send-email 2.34.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-C2ProcessedOrg": "333ef613-75bf-4e12-a4b1-8e3623f5dcea", "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" }, "content": "The Auto Negotiation procedure between two Ethernet PHYs consists of\ndetermining the best commonly supported parameters among Speed,\nDuplex Mode and Flow Control.\n\nThe time taken for this procedure is not only dependent on the local\nPHY used, but also on the link-partner PHY.\n\nWhile a timeout can be specified in the form of a \"CONFIG\" on the basis\nof the local PHY present on the device, since the timeout also depends\non the link-partner PHY, it might be necessary to modify the timeout.\n\nTo avoid rebuilding the bootloader for a given device, just because it\nmay be connected to various link-partner PHYs, each with a different\ntimeout, introduce an environment variable named \"phy_aneg_timeout\" and\noverride \"CONFIG_PHY_ANEG_TIMEOUT\" with \"phy_aneg_timeout\".\n\nSigned-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>\n---\n\nHello,\n\nThis patch is based on commit\n3532f1f5edf block: Remove blk_find_first/next\nof the master branch of Mainline U-Boot.\n\nv2 of this patch is at:\nhttps://patchwork.ozlabs.org/project/uboot/patch/20250723062642.634345-1-s-vadapalli@ti.com/\nChanges since v2:\n- Addressed feedback from Quentin Schulz at:\n https://patchwork.ozlabs.org/project/uboot/patch/20250723062642.634345-1-s-vadapalli@ti.com/#3550923\n by performing the following changes:\n 1) Based the patch on the master branch of U-Boot instead of the next\n branch.\n 2) Updated doc/usage/environment.rst by removing the default value of\n CONFIG_PHY_ANEG_TIMEOUT which was taken from its Kconfig file.\n 3) Updated doc/usage/environment.rst by specificially mentioning the\n base and unit of the \"phy_aneg_timeout\" variable as decimal and\n millisecond.\n 4) Updated\n a) drivers/net/phy/aquantia.c\n b) drivers/net/phy/phy.c\n c) drivers/net/xilinx_axi_emac.c\n by using \"u32\" instead of \"ulong\" for storing the value of the\n \"phy_aneg_timeout\" and also for the variable whose value is\n compared against \"phy_aneg_timeout\".\n\nv1 of this patch is at:\nhttps://patchwork.ozlabs.org/project/uboot/patch/20250722060554.352952-1-s-vadapalli@ti.com/\nChanges since v1:\n- Switched to env_get_ulong() based on feedback from Marek Vasut at:\n https://patchwork.ozlabs.org/project/uboot/patch/20250722060554.352952-1-s-vadapalli@ti.com/#3550426\n- Addressed feedback from Quentin Schulz at:\n https://patchwork.ozlabs.org/project/uboot/patch/20250722060554.352952-1-s-vadapalli@ti.com/#3550263\n by performing the following changes:\n 1) Updated drivers/net/phy/Kconfig by documenting that phy_aneg_timeout\n env variable can override the value of CONFIG_PHY_ANEG_TIMEOUT\n 2) Updated doc/usage/environment.rst by documenting the base and unit\n of phy_aneg_timeout\n 3) Updated drivers/net/phy/aquantia.c and drivers/net/xilinx_axi_emac.c\n to support overriding CONFIG_PHY_ANEG_TIMEOUT with phy_aneg_timeout\n\nPatch has been tested on J784S4-EVM validating the following cases:\n1. PHY Auto-Negotiation performed with \"phy_aneg_timeout\" unset.\n CONFIG_PHY_TIMEOUT with a value of 4,000 takes effect.\n => Auto Negotiation succeeds\n2. PHY Auto-Negotiation performed with \"phy_aneg_timeout\" set to 20,000.\n \"phy_aneg_timeout\" overrides CONFIG_PHY_TIMEOUT.\n [Higher value than default specified by CONFIG_PHY_ANEG_TIMEOUT]\n => Auto Negotiation succeeds\n3. PHY Auto-Negotiation performed with \"phy_aneg_timeout\" set to 200.\n \"phy_aneg_timeout\" overrides CONFIG_PHY_TIMEOUT.\n [Lower value than default specified by CONFIG_PHY_ANEG_TIMEOUT]\n => Auto Negotiation times out\n\nTest Logs:\nhttps://gist.github.com/Siddharth-Vadapalli-at-TI/b1ee7ea655212c03e77a7eb1b9453728\n\nRegards,\nSiddharth.\n\n doc/usage/environment.rst | 9 +++++++++\n drivers/net/phy/Kconfig | 5 ++++-\n drivers/net/phy/aquantia.c | 9 +++++----\n drivers/net/phy/phy.c | 7 +++++--\n drivers/net/xilinx_axi_emac.c | 4 +++-\n 5 files changed, 26 insertions(+), 8 deletions(-)", "diff": "diff --git a/doc/usage/environment.rst b/doc/usage/environment.rst\nindex bb6c351b441..77197d79380 100644\n--- a/doc/usage/environment.rst\n+++ b/doc/usage/environment.rst\n@@ -335,6 +335,15 @@ netretry\n Useful on scripts which control the retry operation\n themselves.\n \n+phy_aneg_timeout\n+ If set, the specified value will override CONFIG_PHY_ANEG_TIMEOUT.\n+ This variable has the same base and unit as CONFIG_PHY_ANEG_TIMEOUT\n+ which is \"decimal\" and \"millisecond\" respectively. The default value\n+ of CONFIG_PHY_ANEG_TIMEOUT may be sufficient for most use-cases, but\n+ certain link-partners may require a larger timeout due to the Ethernet\n+ PHY they use. Alternatively, the timeout can be reduced as well if the\n+ use-case demands it.\n+\n rng_seed_size\n Size of random value added to device-tree node /chosen/rng-seed.\n This variable is given as a decimal number.\ndiff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig\nindex 8d88c142900..21bf983056a 100644\n--- a/drivers/net/phy/Kconfig\n+++ b/drivers/net/phy/Kconfig\n@@ -23,7 +23,10 @@ config PHY_ANEG_TIMEOUT\n \tint \"PHY auto-negotiation timeout\"\n \tdefault 4000\n \thelp\n-\t Default PHY auto-negotiation timeout.\n+\t Value of PHY auto-negotiation timeout with the base being\n+\t \"decimal\" and the unit being \"millisecond\". This can be\n+\t overridden by the \"phy_aneg_timeout\" environment variable\n+\t that has the same base (decimal) and unit (millisecond).\n \n if PHY_ADDR_ENABLE\n config PHY_ADDR\ndiff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c\nindex d2db8d9f792..c29d8facdee 100644\n--- a/drivers/net/phy/aquantia.c\n+++ b/drivers/net/phy/aquantia.c\n@@ -551,14 +551,15 @@ int aquantia_config(struct phy_device *phydev)\n \n int aquantia_startup(struct phy_device *phydev)\n {\n-\tu32 speed;\n-\tint i = 0;\n+\tu32 speed, i = 0;\n \tint reg;\n \n \tphydev->duplex = DUPLEX_FULL;\n \n \t/* if the AN is still in progress, wait till timeout. */\n \tif (!aquantia_link_is_up(phydev)) {\n+\t\tu32 aneg_timeout = env_get_ulong(\"phy_aneg_timeout\", 10,\n+\t\t\t\t\t\t CONFIG_PHY_ANEG_TIMEOUT);\n \t\tprintf(\"%s Waiting for PHY auto negotiation to complete\",\n \t\t phydev->dev->name);\n \t\tdo {\n@@ -566,9 +567,9 @@ int aquantia_startup(struct phy_device *phydev)\n \t\t\tif ((i++ % 500) == 0)\n \t\t\t\tprintf(\".\");\n \t\t} while (!aquantia_link_is_up(phydev) &&\n-\t\t\t i < (4 * CONFIG_PHY_ANEG_TIMEOUT));\n+\t\t\t i < (4 * aneg_timeout));\n \n-\t\tif (i > CONFIG_PHY_ANEG_TIMEOUT)\n+\t\tif (i > aneg_timeout)\n \t\t\tprintf(\" TIMEOUT !\\n\");\n \t}\n \ndiff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c\nindex e6fed8c41d7..9702d042296 100644\n--- a/drivers/net/phy/phy.c\n+++ b/drivers/net/phy/phy.c\n@@ -9,6 +9,7 @@\n */\n #include <console.h>\n #include <dm.h>\n+#include <env.h>\n #include <log.h>\n #include <malloc.h>\n #include <net.h>\n@@ -242,7 +243,9 @@ int genphy_update_link(struct phy_device *phydev)\n \n \tif ((phydev->autoneg == AUTONEG_ENABLE) &&\n \t !(mii_reg & BMSR_ANEGCOMPLETE)) {\n-\t\tint i = 0;\n+\t\tu32 i = 0;\n+\t\tu32 aneg_timeout = env_get_ulong(\"phy_aneg_timeout\", 10,\n+\t\t\t\t\t\t CONFIG_PHY_ANEG_TIMEOUT);\n \n \t\tprintf(\"%s Waiting for PHY auto negotiation to complete\",\n \t\t phydev->dev->name);\n@@ -250,7 +253,7 @@ int genphy_update_link(struct phy_device *phydev)\n \t\t\t/*\n \t\t\t * Timeout reached ?\n \t\t\t */\n-\t\t\tif (i > (CONFIG_PHY_ANEG_TIMEOUT / 50)) {\n+\t\t\tif (i > (aneg_timeout / 50)) {\n \t\t\t\tprintf(\" TIMEOUT !\\n\");\n \t\t\t\tphydev->link = 0;\n \t\t\t\treturn -ETIMEDOUT;\ndiff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c\nindex 4d87e2d1f36..f072ac84990 100644\n--- a/drivers/net/xilinx_axi_emac.c\n+++ b/drivers/net/xilinx_axi_emac.c\n@@ -343,6 +343,8 @@ static int axiemac_phy_init(struct udevice *dev)\n \n static int pcs_pma_startup(struct axidma_priv *priv)\n {\n+\tu32 aneg_timeout = env_get_ulong(\"phy_aneg_timeout\", 10,\n+\t\t\t\t\t CONFIG_PHY_ANEG_TIMEOUT);\n \tu32 rc, retry_cnt = 0;\n \tu16 mii_reg;\n \n@@ -361,7 +363,7 @@ static int pcs_pma_startup(struct axidma_priv *priv)\n \t * and the external PHY is not obtained.\n \t */\n \tdebug(\"axiemac: waiting for link status of the PCS/PMA PHY\");\n-\twhile (retry_cnt * 10 < CONFIG_PHY_ANEG_TIMEOUT) {\n+\twhile (retry_cnt * 10 < aneg_timeout) {\n \t\trc = phyread(priv, priv->pcsaddr, MII_BMSR, &mii_reg);\n \t\tif ((mii_reg & BMSR_LSTATUS) && mii_reg != 0xffff && !rc) {\n \t\t\tdebug(\".Done\\n\");\n", "prefixes": [ "v3" ] }