Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2160097/?format=api
{ "id": 2160097, "url": "http://patchwork.ozlabs.org/api/patches/2160097/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20251101123401.110681-3-root@infi.wang/", "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": "<20251101123401.110681-3-root@infi.wang>", "list_archive_url": null, "date": "2025-11-01T12:31:35", "name": "[v5,2/2] net: phy: aquantia: use generic firmware loader", "commit_ref": "14ece61178f4e604d62de1bc1cb15aa2013d6338", "pull_url": null, "state": "accepted", "archived": false, "hash": "9cd169aeb26ae96223dd8858ae4079f720a31911", "submitter": { "id": 91745, "url": "http://patchwork.ozlabs.org/api/people/91745/?format=api", "name": "Beiyan Yun", "email": "root@infi.wang" }, "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/20251101123401.110681-3-root@infi.wang/mbox/", "series": [ { "id": 480568, "url": "http://patchwork.ozlabs.org/api/series/480568/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=480568", "date": "2025-11-01T12:31:33", "name": "net: phy: aquantia: Switch to generic firmware loader", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/480568/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2160097/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2160097/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 (2048-bit key;\n unprotected) header.d=infi.wang header.i=@infi.wang header.a=rsa-sha256\n header.s=sig1 header.b=ZjxnjiNu;\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=none (p=none dis=none) header.from=infi.wang", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=infi.wang header.i=@infi.wang header.b=\"ZjxnjiNu\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=infi.wang", "phobos.denx.de; spf=pass smtp.mailfrom=root@infi.wang" ], "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 4czHNh0gcSz1yHs\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 1 Nov 2025 23:34:44 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id BC83E83A9F;\n\tSat, 1 Nov 2025 13:34:31 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id 66CD383A84; Sat, 1 Nov 2025 13:34:30 +0100 (CET)", "from outbound.pv.icloud.com\n (p-west1-cluster4-host11-snip4-8.eps.apple.com [57.103.65.219])\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 4387583A84\n for <u-boot@lists.denx.de>; Sat, 1 Nov 2025 13:34:28 +0100 (CET)", "from outbound.pv.icloud.com (unknown [127.0.0.2])\n by p00-icloudmta-asmtp-us-west-1a-100-percent-4 (Postfix) with ESMTPS id\n 9EA9E18000BA; Sat, 1 Nov 2025 12:34:24 +0000 (UTC)", "from debian.. (unknown [17.56.9.36])\n by p00-icloudmta-asmtp-us-west-1a-100-percent-4 (Postfix) with ESMTPSA id\n 41D6B18013AA; Sat, 1 Nov 2025 12:34:21 +0000 (UTC)" ], "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 RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_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=infi.wang; s=sig1;\n bh=Swut9NZ3dbC/HhEGlzDTktN/bdW2mQCBKL1pKVXCS+w=;\n h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme;\n b=ZjxnjiNuDUzG+BScK9NaHqlmEaRmDaM9oVjy0GUKc3y2IcbBaBmCtr645JIzETqZ1+xw4iudxnByjN9b1JWHox2aV0+KTr+lExgdmNPHtTme8nq1cAOBPkbYoB6inkOwu0eSDC9hIsvKGKDpIQPa2plcrqcVxec+unjQYk6BD84sdNLKbzDfrKLiJ8PFCad35gR9YVx7M3dM3go3ZqccdCSFQUzPi30n0Dfdgw/yVdEN4CR5ZepOf3RC/fdkv/EyUw1Cp4lzeTlXGZM2JtIkhCLVkQIOwf/VYzQjmhLPCJDcsfT2G1BJ5oUzqXKbd9eYc5fa+rNzrev3z+3/6Uzc+Q==", "mail-alias-created-date": "1549370554000", "From": "Beiyan Yun <root@infi.wang>", "To": "u-boot@lists.denx.de", "Cc": "Tom Rini <trini@konsulko.com>, Yao Zi <ziyao@disroot.org>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>, Beiyan Yun <root@infi.wang>,\n Jerome Forissier <jerome.forissier@linaro.org>,\n Joe Hershberger <joe.hershberger@ni.com>,\n \"Lucien.Jheng\" <lucienzx159@gmail.com>, Ramon Fried <rfried.dev@gmail.com>,\n Romain Gantois <romain.gantois@bootlin.com>,\n Siddharth Vadapalli <s-vadapalli@ti.com>,\n Sky Huang <SkyLake.Huang@mediatek.com>,\n Weijie Gao <weijie.gao@mediatek.com>", "Subject": "[PATCH v5 2/2] net: phy: aquantia: use generic firmware loader", "Date": "Sat, 1 Nov 2025 20:31:35 +0800", "Message-ID": "<20251101123401.110681-3-root@infi.wang>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20251101123401.110681-1-root@infi.wang>", "References": "<20251101123401.110681-1-root@infi.wang>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Proofpoint-GUID": "AmdgBzBfflaXLhcsKaQoxZq3xHO71wum", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjUxMTAxMDEwNyBTYWx0ZWRfX1NzSxf5xPa/l\n GHWx61j24ZeDzK61FL2h+a1nNW0UQ66QMoKKmfcIdJlan+p4bx/93EEJbbOHS0glOnh3yU1dnxP\n QVEfP1ywabFHpshR0csdH+ZaYzsISidg7K398LAAGiLaP/G9kV1YwRNMqGAKU1i6Yrw0TGL9X5U\n RhitCnHfLTNjYczpUq7DYc0+e+29AmjHkvqJf1dP2gkR7OjAYTrYDk0Y2qI8REvhhInnJDXJ5gh\n QZbeb01IOluTW0dH7lul1y14EitA87TxOyhAoNcaMB1366zQlbpSYgtQSEV4eiPrEXc3lk+G8=", "X-Proofpoint-ORIG-GUID": "AmdgBzBfflaXLhcsKaQoxZq3xHO71wum", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49\n definitions=2025-11-01_02,2025-10-29_03,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=notspam policy=default score=0 mlxscore=0\n malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999\n spamscore=0 clxscore=1030 suspectscore=0 classifier=spam adjust=0 reason=mlx\n scancount=1 engine=8.22.0-2506270000 definitions=main-2511010107", "X-JNJ": "\n AAAAAAABthzrDldxNPRizjFEINJx8lBH4U6lY7L8yIWr9kZVViCJI0bO96qvOkwXW74myaSvYOBgykMkuvRwg7khoFIGCyHNn+spnVqcgvJES5sbky9rMCmALpPtmvQyoQZ5K9eryE5mCRvRYz+qScsfurWKk5HCR69TlMVVXKQfDAi9vJ8xD09jZfSn6B8gd3hAtts/zqwAkmkz8Xsib6yBHR+IwjtDubV1RKOaEmPFijfC1IBuW8+SqwMMeYv+sQ/xTL/s6K6wbZP2kjYHak4bSimdJBd4xD75vNTBszR8YCpFMX/i/IAoBwgQSJEmFF+T9iLOV+LQSK5SlJLBalLQyn5q1h2oZ+6HDFIMpmyRsO/6MX1vDT1i0QOk6uGb2Vj5tZ9fIazgVFsq+4Duq405w2F9PKp1xV0vzpjhUzDZPcga8suJEcXIkJk4xyxpqt79UC5wSckJKYFYMzoGmF5xI0U/Qb7fG3fWuJ1fUZsE67xNmsqkvON1qQ8xNHsfPAB9DvgFPUNr6YUWNp+tGkkO4SDxvfYkBN+HiVcfNFcetaNgJcBh0FDahyItJv9D3RLCDaozsYinTKwyrT7795m/Xbt/t80nqcUSR2JNQIUDAQ4kucNeiQR1s5HXMr8/Btv2A5Co4VjRTggaCn9Tv4BbEHFIiIxoAFt73m4LOAbF1sRZeKCSg6J/5guCYnn7CaHQsckViHZ9VmhjvXjGFwgpJuwz6xmt22NLpf/rvAPiXpW5YnqoxP4lgY4HqPxtWWjdikdkkoQFIKzFtCkhBdiumftQQFNemRnKLxlcFuhJAwhEKNTNAJbTBqI=", "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": "Aquantia PHYs are being used w/o SPI flash in some routers recently.\nCurrent firmware loader only attempts to load from FS on top of MMC,\nlimiting the use on many devices.\n\nRemoved the old firmware loader, migrate to generic script based firmware\nloader to allow a wider range and runtime override of firmware source.\n(e.g., MMC, USB, UBIFS).\n\nTested on Buffalo WXR18000BE10P with UBIFS.\n\nSigned-off-by: Beiyan Yun <root@infi.wang>\n---\n\nChanges in v5:\n- Remove fsloader codepath\n- Drop binding changes\n- Make script name static\n\nChanges in v4:\n- Split firmware upload helpers change\n- Reorder `aquantia_read_fw`\n- Make `aquantia_read_fw` weak to allow overide\n- Rename exit label in `aquantia_read_fw`\n- Kconfig polish\n\nChanges in v3:\n- Select FW_LOADER with PHY_AQUANTIA_UPLOAD_FW\n\nChanges in v2:\n- Add support for script based loader\n\n drivers/net/phy/Kconfig | 23 ++++++------\n drivers/net/phy/aquantia.c | 76 ++++++++++++++------------------------\n 2 files changed, 39 insertions(+), 60 deletions(-)", "diff": "diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig\nindex 018be98705a..d8845469dd5 100644\n--- a/drivers/net/phy/Kconfig\n+++ b/drivers/net/phy/Kconfig\n@@ -91,23 +91,22 @@ menuconfig PHY_AQUANTIA\n config PHY_AQUANTIA_UPLOAD_FW\n \tbool \"Aquantia firmware loading support\"\n \tdepends on PHY_AQUANTIA\n+\tselect FW_LOADER\n \thelp\n-\t\tAquantia PHYs use firmware which can be either loaded automatically\n-\t\tfrom storage directly attached to the phy or loaded by the boot loader\n-\t\tvia MDIO commands. The firmware is loaded from a file, specified by\n-\t\tthe PHY_AQUANTIA_FW_PART and PHY_AQUANTIA_FW_NAME options.\n+\t Aquantia PHYs use firmware which can be either loaded automatically\n+\t from storage directly attached to the phy or loaded by the boot loader\n+\t via MDIO commands.\n \n-config PHY_AQUANTIA_FW_PART\n-\tstring \"Aquantia firmware partition\"\n-\tdepends on PHY_AQUANTIA_UPLOAD_FW\n-\thelp\n-\t\tPartition containing the firmware file.\n+\t This option enables loading the firmware using the generic\n+\t firmware loader framework.\n \n-config PHY_AQUANTIA_FW_NAME\n-\tstring \"Aquantia firmware filename\"\n+config PHY_AQUANTIA_FW_MAX_SIZE\n+\thex \"Max firmware size\"\n \tdepends on PHY_AQUANTIA_UPLOAD_FW\n+\tdefault 0x80000\n \thelp\n-\t\tFirmware filename.\n+\t The maximum size of the Aquantia PHY firmware. This is used to\n+\t allocate a buffer to load the firmware into.\n \n config PHY_ATHEROS\n \tbool \"Atheros Ethernet PHYs support\"\ndiff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c\nindex fc2476fb038..e0deef58f52 100644\n--- a/drivers/net/phy/aquantia.c\n+++ b/drivers/net/phy/aquantia.c\n@@ -16,7 +16,9 @@\n #include <u-boot/crc.h>\n #include <malloc.h>\n #include <asm/byteorder.h>\n-#include <fs.h>\n+#if (IS_ENABLED(CONFIG_PHY_AQUANTIA_UPLOAD_FW))\n+#include <fw_loader.h>\n+#endif\n \n #define AQUNTIA_10G_CTL\t\t0x20\n #define AQUNTIA_VENDOR_P1\t0xc400\n@@ -127,52 +129,29 @@ struct fw_header {\n \n #pragma pack()\n \n-#if defined(CONFIG_PHY_AQUANTIA_UPLOAD_FW)\n-static int aquantia_read_fw(u8 **fw_addr, size_t *fw_length)\n+#if (IS_ENABLED(CONFIG_PHY_AQUANTIA_UPLOAD_FW))\n+int __weak aquantia_read_fw(struct phy_device *phydev,\n+\t\t\t u8 **fw_addr, size_t *fw_length)\n {\n-\tloff_t length, read;\n \tint ret;\n-\tvoid *addr = NULL;\n-\n-\t*fw_addr = NULL;\n-\t*fw_length = 0;\n-\tdebug(\"Loading Aquantia microcode from %s %s\\n\",\n-\t CONFIG_PHY_AQUANTIA_FW_PART, CONFIG_PHY_AQUANTIA_FW_NAME);\n-\tret = fs_set_blk_dev(\"mmc\", CONFIG_PHY_AQUANTIA_FW_PART, FS_TYPE_ANY);\n-\tif (ret < 0)\n-\t\tgoto cleanup;\n-\n-\tret = fs_size(CONFIG_PHY_AQUANTIA_FW_NAME, &length);\n-\tif (ret < 0)\n-\t\tgoto cleanup;\n-\n-\taddr = malloc(length);\n-\tif (!addr) {\n-\t\tret = -ENOMEM;\n-\t\tgoto cleanup;\n-\t}\n-\n-\tret = fs_set_blk_dev(\"mmc\", CONFIG_PHY_AQUANTIA_FW_PART, FS_TYPE_ANY);\n-\tif (ret < 0)\n-\t\tgoto cleanup;\n-\n-\tret = fs_read(CONFIG_PHY_AQUANTIA_FW_NAME, (ulong)addr, 0, length,\n-\t\t &read);\n-\tif (ret < 0)\n-\t\tgoto cleanup;\n+\tu8 *microcode;\n \n-\t*fw_addr = addr;\n-\t*fw_length = length;\n-\tdebug(\"Found Aquantia microcode.\\n\");\n+\tmicrocode = malloc(CONFIG_PHY_AQUANTIA_FW_MAX_SIZE);\n+\tif (!microcode) {\n+\t\tprintf(\"Failed to allocate memory for firmware\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n \n-cleanup:\n-\tif (ret < 0) {\n-\t\tprintf(\"loading firmware file %s %s failed with error %d\\n\",\n-\t\t CONFIG_PHY_AQUANTIA_FW_PART,\n-\t\t CONFIG_PHY_AQUANTIA_FW_NAME, ret);\n-\t\tfree(addr);\n+\tret = request_firmware_into_buf_via_script(\n+\t\tmicrocode, CONFIG_PHY_AQUANTIA_FW_MAX_SIZE,\n+\t\t\"aqr_phy_load_firmware\", fw_length);\n+\tif (ret) {\n+\t\tfree(microcode);\n+\t\treturn ret;\n \t}\n-\treturn ret;\n+\n+\t*fw_addr = microcode;\n+\treturn 1;\n }\n \n /* load data into the phy's memory */\n@@ -293,16 +272,17 @@ static int aquantia_do_upload_firmware(struct phy_device *phydev,\n \n static int aquantia_upload_firmware(struct phy_device *phydev)\n {\n-\tint ret;\n+\tint ret, fwrc;\n \tu8 *addr = NULL;\n-\tsize_t fw_length = 0;\n+\tsize_t fw_length;\n \n-\tret = aquantia_read_fw(&addr, &fw_length);\n-\tif (ret != 0)\n-\t\treturn ret;\n+\tfwrc = aquantia_read_fw(phydev, &addr, &fw_length);\n+\tif (fwrc < 0)\n+\t\treturn fwrc;\n \n \tret = aquantia_do_upload_firmware(phydev, addr, fw_length);\n-\tfree(addr);\n+\tif (fwrc > 0)\n+\t\tfree(addr);\n \n \treturn ret;\n }\n", "prefixes": [ "v5", "2/2" ] }