Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2146244/?format=api
{ "id": 2146244, "url": "http://patchwork.ozlabs.org/api/patches/2146244/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20251006124915.13647-1-lucienzx159@gmail.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": "<20251006124915.13647-1-lucienzx159@gmail.com>", "list_archive_url": null, "date": "2025-10-06T12:49:15", "name": "[U-Boot,v2,1/1] net: phy: add paged PHY register accessors", "commit_ref": "34369d34e413ac32a131dd144b55ad04873e4854", "pull_url": null, "state": "accepted", "archived": false, "hash": "89cce1f2d258281c61b9ccb12a1df947adc0d85e", "submitter": { "id": 90627, "url": "http://patchwork.ozlabs.org/api/people/90627/?format=api", "name": "Lucien.Jheng", "email": "lucienzx159@gmail.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/20251006124915.13647-1-lucienzx159@gmail.com/mbox/", "series": [ { "id": 476405, "url": "http://patchwork.ozlabs.org/api/series/476405/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=476405", "date": "2025-10-06T12:49:15", "name": "[U-Boot,v2,1/1] net: phy: add paged PHY register accessors", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/476405/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2146244/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2146244/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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=enXEcx/i;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "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=gmail.com header.i=@gmail.com header.b=\"enXEcx/i\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=lucienzx159@gmail.com" ], "Received": [ "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4cgK1R3SXCz1yGb\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 6 Oct 2025 23:52:43 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 3F6568381D;\n\tMon, 6 Oct 2025 14:52:26 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id 7231C83734; Mon, 6 Oct 2025 14:50:35 +0200 (CEST)", "from mail-pf1-x435.google.com (mail-pf1-x435.google.com\n [IPv6:2607:f8b0:4864:20::435])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 279FC82E34\n for <u-boot@lists.denx.de>; Mon, 6 Oct 2025 14:50:33 +0200 (CEST)", "by mail-pf1-x435.google.com with SMTP id\n d2e1a72fcca58-78115430134so2970126b3a.1\n for <u-boot@lists.denx.de>; Mon, 06 Oct 2025 05:50:33 -0700 (PDT)", "from localhost.localdomain (124-218-201-66.cm.dynamic.apol.com.tw.\n [124.218.201.66]) by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-78b01f9cda9sm12548357b3a.13.2025.10.06.05.50.29\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 06 Oct 2025 05:50:31 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,\n FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS\n autolearn=ham autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1759755031; x=1760359831; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=W+amXRRSF7kIGRcKWB1QkramV3eTrZSiR05UbxchxUA=;\n b=enXEcx/ifZ4W2+ZUICl1HTlPrjdCCruziGZ60aOhq0TWc4yRnfk2v0cgsocOHjvFtX\n 2c4YTDpXutFb4SlaVbcEMx3XXtr/CB2lHgm8aJmwMCgYRaYAD96IjyOyXvlzaKi4JKDm\n ttJKY4b6MOr3vyFewfCAaZucSFFu+9vzfKSHYEPMkJ6/ly9xIN/SJBT7rpTzr6Ur3zWv\n ejiChzNzUk7OGKI4EloUHzbt93mjNG6gRmdpnXHM45riySGfcVpYuzK42a++tbHjtfYA\n dhjq4BZzahOMOKpEouVUwr+fOvlPiTZ14o5sEOA9XZMHZOPu/ZnjJzdQKc7JpNC5oxI2\n 8zDA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1759755031; x=1760359831;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=W+amXRRSF7kIGRcKWB1QkramV3eTrZSiR05UbxchxUA=;\n b=TO/wNhntUVrKHIIMyod4sBo9QvUXt7l/zj8sBSt+a95F0ut80YisrcU7oHRMc0zoZ9\n m+1wanUZgd0Ags1oQFs7vm/HqfP9lA7cCeuCrAOb6dVMJKUOLciElrLWM6vaigA6ypCG\n rId2PE6LsIjAe0sOT7UCkmS6ht53cfxTf3YD7ubRfXjPLPhBm0LyTNfjgvpPRBDyYnwb\n MKTTzZkZYe4NxnWYydEiyCKHf1PFewWY8IPTac5i/TwrvTf4PLl8cQbdsozsz61wftKi\n VrS2KbIgNUk1/OYLCoYYoFgzmC/0tn6rN3YtKhU3h5j0h6RX+fF+X2Zvq/zFIelmV17g\n THtQ==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCX6iEi/FLY8NKaae4n/jON/fL+NiJzOuZ4TTgUQhStTOf30S3dHTOgm+/10pJovh2bCSwcpJLw=@lists.denx.de", "X-Gm-Message-State": "AOJu0YzBrKCDbMcuZhs/Xayc+nbTZ4JmsefrpAatsGgM+8jk8qDgaTWA\n DWPt0JZVgYCDrANscFLUdbU/+5tqLbvvvjApunNxrYKCPWvUyqtVfNIL47k8XXseGI4=", "X-Gm-Gg": "ASbGncvx3+lUh7naeYW60HP5URICW3+TGa4iyWUtlu+3LXfSy+/44upbfmuTmxOTPSW\n aLNSyK6IAZngTS242Hkl7jO7bj6tzGNbjU2xOg87tknaqKR7TJCakM7DbbimgJm++8kQpsLMQXe\n ow4bl1jD/F72kz6NglAp+Yr3VqGjo0nLCkjwTfxgx8QFyvnJJUWaNpIv1Tzi+lHYKouHrqzSTve\n a6waQWi/yo977YLOxLSR/+JA3vyF6nVLlquYIuMWqdnwJivcYfN+IFGYEemC6YdDVU1xwv3K0r6\n ViraqhNmzvv/hZsO4vEWmjHoSlC73nMkXK+ElxSvAVEMvJYeikUQEFPOZ74lj6TowdOW5lx3baQ\n xPgOjlADCIR/Eyxq4sEF1CiyrISgHXc2rtjmeYnFK9CNlqavvJIMamg8LWqAJR/81WfomVnTyWY\n Auw1xBA8gtUYph7cFw3/Q4U3bnVr+Y3YjQWcVkGAb/3w==", "X-Google-Smtp-Source": "\n AGHT+IEdyJBC+Hd8APMDrAKdYQwNSbcD9TxHQyV7pZ0itYKaN3zj5eMhT8aBU0xLI3rjGe0kmBFNSg==", "X-Received": "by 2002:a05:6a20:a110:b0:2fb:add5:5580 with SMTP id\n adf61e73a8af0-32b620d8f5bmr16475717637.45.1759755031602;\n Mon, 06 Oct 2025 05:50:31 -0700 (PDT)", "From": "\"Lucien.Jheng\" <lucienzx159@gmail.com>", "To": "jerome.forissier@linaro.org, skylake.huang@mediatek.com,\n s-vadapalli@ti.com, paul.barker.ct@bp.renesas.com,\n marek.vasut+renesas@mailbox.org, u-boot@lists.denx.de", "Cc": "lucien.jheng@airoha.com, frank-w@public-files.de, daniel@makrotopia.org,\n \"Lucien.Jheng\" <lucienzx159@gmail.com>", "Subject": "[U-Boot, v2, 1/1]net: phy: add paged PHY register accessors", "Date": "Mon, 6 Oct 2025 20:49:15 +0800", "Message-Id": "<20251006124915.13647-1-lucienzx159@gmail.com>", "X-Mailer": "git-send-email 2.34.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Mailman-Approved-At": "Mon, 06 Oct 2025 14:52:24 +0200", "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": "Synchronize paged PHY helpers with Linux v6.17.\n\nAdd support for PHY devices that use paged register access by\nimplementing the following functions:\n- phy_save_page(): Save current page number\n- phy_select_page(): Switch to a specific page and return previous page\n- phy_restore_page(): Restore previously saved page\n\nAlso adds read_page and write_page callbacks to the phy_driver\nstructure to enable driver-specific page handling.\n\nThese helpers allow safe access to paged PHY registers by ensuring\nproper page selection and restoration,\neven in error conditions, which will be used by the Airoha PHY driver.\n\nSigned-off-by: Lucien.Jheng <lucienzx159@gmail.com>\n---\nChange in PATCH v2:\n * Change the commit message from \"Synchronize paged PHY helpers\n with Linux v4.16\" to \"Linux v6.17.\"\n * Remove unnecessary commit information.\n\nI have verified the patch by loading Airoha PHY firmware on Banana Pi BPI-R3 Mini.\nSince we need to switch pages to access en8811h PHY registers, this patch is necessary\nfor initializing the PHY and loading the firmware correctly.\n\n1. Implementation in air_en8811.c:\n````air_en8811.c````\n/*\n * Driver for Airoha EN8811H Ethernet PHY\n */\n#define AIR_EXT_PAGE_ACCESS\t\t0x1f\n...\n...\nstatic int en8811h_read_page(struct phy_device *phydev)\n{\n\treturn phy_read(phydev, MDIO_DEVAD_NONE, AIR_EXT_PAGE_ACCESS);\n}\n\nstatic int en8811h_write_page(struct phy_device *phydev, int page)\n{\n\treturn phy_write(phydev, MDIO_DEVAD_NONE, AIR_EXT_PAGE_ACCESS, page);\n}\n\nU_BOOT_PHY_DRIVER(en8811h) = {\n\t.name = \"Airoha EN8811H\",\n\t.uid = EN8811H_PHY_ID,\n\t.mask = 0x0ffffff0,\n\t.config = &en8811h_config,\n\t.probe = &en8811h_probe,\n\t.read_page = &en8811h_read_page,\n\t.write_page = &en8811h_write_page,\n\t.startup = &en8811h_startup,\n\t.shutdown = &genphy_shutdown,\n};\n```````End of air_en8811.c`````\n2. Test log:\n````Test Log````\nNet: 16384 bytes read in 1 ms (15.6 MiB/s)\n131072 bytes read in 9 ms (13.9 MiB/s)\naddr: 0x46000000, size: 0x24000\nFound Airoha Firmware.\nMD32 firmware version: 24112802\n````End of Test Log````\n\n drivers/net/phy/phy.c | 113 ++++++++++++++++++++++++++++++++++++++++++\n include/phy.h | 8 +++\n 2 files changed, 121 insertions(+)\n\n--\n2.34.1", "diff": "diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c\nindex 9702d042296..b58283fe3d5 100644\n--- a/drivers/net/phy/phy.c\n+++ b/drivers/net/phy/phy.c\n@@ -1250,3 +1250,116 @@ bool phy_interface_is_ncsi(void)\n \treturn 0;\n #endif\n }\n+\n+/**\n+ * __phy_read_page() - read the current page\n+ * @phydev: a pointer to a &struct phy_device\n+ *\n+ * Returns page index or < 0 on error\n+ */\n+static int __phy_read_page(struct phy_device *phydev)\n+{\n+\tstruct phy_driver *drv = phydev->drv;\n+\n+\tif (!drv->read_page) {\n+\t\tdebug(\"read_page callback not available, PHY driver not loaded?\\n\");\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\treturn drv->read_page(phydev);\n+}\n+\n+/**\n+ * __phy_write_page() - Write a new page\n+ * @phydev: a pointer to a &struct phy_device\n+ * @page: page index to select\n+ *\n+ * Returns 0 or < 0 on error.\n+ */\n+static int __phy_write_page(struct phy_device *phydev, int page)\n+{\n+\tstruct phy_driver *drv = phydev->drv;\n+\n+\tif (!drv->write_page) {\n+\t\tdebug(\"write_page callback not available, PHY driver not loaded?\\n\");\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\treturn drv->write_page(phydev, page);\n+}\n+\n+/**\n+ * phy_save_page() - save the current page\n+ * @phydev: a pointer to a &struct phy_device\n+ *\n+ * Return the current page number. On error,\n+ * returns a negative errno. phy_restore_page() must always be called\n+ * after this, irrespective of success or failure of this call.\n+ */\n+int phy_save_page(struct phy_device *phydev)\n+{\n+\treturn __phy_read_page(phydev);\n+}\n+\n+/**\n+ * phy_select_page - Switch to a PHY page and return the previous page\n+ * @phydev: a pointer to a &struct phy_device\n+ * @page: desired page\n+ *\n+ * NOTE: Save the current PHY page, and set the current page.\n+ * On error, returns a negative errno, otherwise returns the previous page number.\n+ * phy_restore_page() must always be called after this, irrespective\n+ * of success or failure of this call.\n+ */\n+int phy_select_page(struct phy_device *phydev, int page)\n+{\n+\tint ret, oldpage;\n+\n+\toldpage = ret = phy_save_page(phydev);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tif (oldpage != page) {\n+\t\tret = __phy_write_page(phydev, page);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t}\n+\n+\treturn oldpage;\n+}\n+\n+/**\n+ * phy_restore_page - Restore a previously saved page and propagate status\n+ * @phydev: a pointer to a &struct phy_device\n+ * @oldpage: the old page, return value from phy_save_page() or phy_select_page()\n+ * @ret: operation's return code\n+ *\n+ * Restoring @oldpage if it is a valid page.\n+ * This function propagates the earliest error code from the group of\n+ * operations.\n+ *\n+ * Returns:\n+ * @oldpage if it was a negative value, otherwise\n+ * @ret if it was a negative errno value, otherwise\n+ * phy_write_page()'s negative value if it were in error, otherwise\n+ * @ret.\n+ */\n+int phy_restore_page(struct phy_device *phydev, int oldpage, int ret)\n+{\n+\tint r;\n+\n+\tif (oldpage >= 0) {\n+\t\tr = __phy_write_page(phydev, oldpage);\n+\n+\t\t/* Propagate the operation return code if the page write\n+\t\t * was successful.\n+\t\t */\n+\t\tif (ret >= 0 && r < 0)\n+\t\t\tret = r;\n+\t} else {\n+\t\t/* Propagate the phy page selection error code */\n+\t\tret = oldpage;\n+\t}\n+\n+\treturn ret;\n+}\n\\ No newline at end of file\ndiff --git a/include/phy.h b/include/phy.h\nindex 36354aaf774..ae9fd1652cc 100644\n--- a/include/phy.h\n+++ b/include/phy.h\n@@ -123,6 +123,11 @@ struct phy_driver {\n \tint (*write_mmd)(struct phy_device *phydev, int devad, int reg,\n \t\t\t u16 val);\n\n+\t/** @read_page: Return the current PHY register page number */\n+\tint (*read_page)(struct phy_device *phydev);\n+\t/** @write_page: Set the current PHY register page number */\n+\tint (*write_page)(struct phy_device *phydev, int page);\n+\n \t/* driver private data */\n \tulong data;\n };\n@@ -314,6 +319,9 @@ int phy_modify_mmd_changed(struct phy_device *phydev, int devad, u32 regnum,\n \t\t\t u16 mask, u16 set);\n int phy_modify_mmd(struct phy_device *phydev, int devad, u32 regnum,\n \t\t u16 mask, u16 set);\n+int phy_save_page(struct phy_device *phydev);\n+int phy_select_page(struct phy_device *phydev, int page);\n+int phy_restore_page(struct phy_device *phydev, int oldpage, int ret);\n\n int phy_startup(struct phy_device *phydev);\n int phy_config(struct phy_device *phydev);\n", "prefixes": [ "U-Boot", "v2", "1/1" ] }