From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F09E4606A325 for ; Mon, 30 Nov 2026 06:36:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=5BmAyeR7; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=z+hxKGQo DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=7wnjRNq1L6fBNEzLwY1CeNZOHOqxmgLJmsVQ3z7wQc8=; b=5BmAyeR75X4tt353gPeZN1Nrd0 EEL8kCUBo0sixrRESPPrbg+pVs0lUG8be5AuYg7fpeSY7oWN/KQmQMcgCBE7SN9V+Z0y5UrsYRhFx RqTkwsfZx9maeTqK5jhDAMqBajCCjZw/dudY+bwK2p62TH0aIyGNTBUshX95GXGGDO6atfI1qCMGr vj1kuer4D/GBsHiInX9rCXnVOFlVBwiGpZO91hvTkMatvKbOlLOYEj+VeOcwUGmXODjrFVFl2FN+N PUdBvj1WMgyQfqnclQ5lhgpbLwfe6hZP7TvlvZcK3f4IbghdCX0hUDv3g2ZjWWFDMMU3eHoekoasU o1NHQ9yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXv04-00000003RLc-2QM8; Mon, 30 Nov 2026 06:36:32 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXv01-00000003RKS-1JRi for linux-phy@lists.infradead.org; Mon, 30 Nov 2026 06:36:30 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2f05b465cd1so14405415ad.3 for ; Sun, 29 Nov 2026 22:36:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796020588; x=1796625388; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=2tNdEmf8xIs7oa0sQeL2Xv+WGUIGMINppK3Xjkx/YB4=; b=z+hxKGQoxOgs7W9BxNAW+XS0aZc4frQS4VJ5rXnt8CsQQsCDUczgSsUJwJ9GfwwXNQ LRu1lmYJ8R70/jqXQuMp2lgXHMEGuqYcUEwITK0JlTj3y29QBApUIjiiH6GZH8YNPRjr G/21VLN91KMQ2YGTwg9BM0BcKJSLujqpHOE9EOe/AKO5yqHMqtcFWYk8R+VseUF/Jvxi DjZz6L/9YSLx/PsbqgrWUfJXiWsoc2acgYiSGvKr4a6Ip7t+x3WISjKcN9Bomeo9Q9xd Onbhig5Qh2KccbB3qpHtyTKPJXYQ2AG+hKVo9xP7d6QP/BXQgkoqWZXus3SUM7DYL7dw Vs3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796020588; x=1796625388; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2tNdEmf8xIs7oa0sQeL2Xv+WGUIGMINppK3Xjkx/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7nfL9JKxRmgK+xjlYxdv3fk3gXOW5rknekMo4AA6MA4Ii dO9RjUyRNMUHYBB0Ma6NqQnWCF1eVYwXRwIvY/pgzPu1JOjBKjwnKLw3HKGEtm6I/SmVkZtosex reOyftn1s1/3zg3yuNt8CEQNtwI= X-Received: by 2002:a17:903:b0e:b0:2ef:f9a6:1e5f with SMTP id d9443c01a7336-2f03f144747mr304774725ad.27.1796020588198; Sun, 29 Nov 2026 22:36:28 -0800 (PST) Received: from localhost ([2001:19f0:8000:4ce8:5400:7ff:fe0e:e6b2]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f03f1215e2sm160816995ad.63.2026.11.29.22.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 22:36:27 -0800 (PST) From: Inochi Amaoto To: Andy Shevchenko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Damien Le Moal , Niklas Cassel , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aksh Garg , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Vinod Koul , Neil Armstrong , Vladimir Oltean , Rhys Tumelty , Inochi Amaoto , Qiang Yu , Manikandan K Pillai , "vladimir.oltean@nxp.com" , Hans Zhang <18255117159@163.com>, Yao Zi Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-phy@lists.infradead.org, Yixun Lan , Longbin Li Subject: [PATCH v6 0/8] phy: core: Add phy bulk helpers support Date: Mon, 30 Nov 2026 14:35:59 +0800 Message-ID: <20261130063607.294823-1-inochiama@gmail.com> X-Mailer: git-send-email 2.56.1 X-Archived-By: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_223629_360259_B35603EF X-CRM114-Status: GOOD ( 21.09 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 As discussed in [1], some drivers may do not care the difference between phys. Instead, they only need to treat them as a group and operate them together. This means a bulk operation is needed. Add some bulk helper functions for phy core by referencing the design of clock/reset subsystem. This can relieve the driver owners' life who needs to handle many phys, as well as each phy error reporting. The example consumer driver is at [2], with the following function used: - phy_bulk_init - phy_bulk_exit - phy_bulk_power_on - phy_bulk_power_off - devm_of_phy_bulk_get_all The devm_phy_bulk_get_all() is also added as a simple wrapper of devm_of_phy_bulk_get_all(). This patch set also includes another two porting for cadence PCIe driver, and the the IMX SATA driver, as I have the document of these two device so I can verify the PHY timing requirement. However, since I have no real board, the driver is not well tested. Only the Specemit K3 PCIe driver [2] is tested with this patch set. Note: 1. The patch still uses -EOPNOTSUPP for dummy blob. Instead, I send a new patch [3] for fixing the left function. 2. libahci_platform.c is not ported, as its getter require additional check on the DT so it can no be handled by a simple bulk get. [1] https://lore.kernel.org/linux-pci/ak9KzNFF26B0Kttz@ashevche-desk.local/ [2] https://lore.kernel.org/linux-pci/20261125041523.242588-1-inochiama@gmail.com/ [3] https://lore.kernel.org/linux-phy/20260929084739.467082-1-inochiama@gmail.com/ Changed from v5: - https://lore.kernel.org/linux-phy/20261125043639.249525-1-inochiama@gmail.com/ 1. Apply Vladimir's tag to patch 6,7,8 2. Add test state in the cover letter patch 4: 1. Move affected function to patch 5 to fix compile warning. patch 6: 1. Fix wrong spell. patch 7: 1. Fix spell error at title patch 8: 1. Remove unneed error information in imx8_sata_probe(). 2. Add comment for why this change is possible. Changed from v4: - https://lore.kernel.org/linux-phy/20260923023304.78428-1-inochiama@gmail.com/ 1. rebased to v7.4-rc1 2. Apply Andy's tag to patch 1, 2. patch 3: 1. Add this patch as Andy's request for simpler bulk api handling. patch 4: 1. Add reversed recovery operation in phy bulk operator APIs like the reset subsystem. 2. Use int instead unsigned int to simplifiy the error check. 3. Fix wrong error handling in phy_bulk_get() 4. Fix document of the existed bulk API. patch 5: 1. Remove unnecessary num_phys and device node check in the bulk getter API. Now it expects user will give a valid input. 2. Add devm_phy_bulk_get() and related helper function 3. Add devm_phy_bulk_put_all() for future porting 4. Make all dummy handler follows the same semantics in other subsystem. patch 6: 1. Add missing doc of the all function patch 7,8: 1. Add these two patches as an example for phy bulk API. Changed from v3: - https://lore.kernel.org/linux-phy/20260923023304.78428-1-inochiama@gmail.com/ patch 5: 1. Fix spell error in the document. Changed from v2: - https://lore.kernel.org/linux-phy/20260904083709.425893-1-inochiama@gmail.com/ patch 1: 1. Add Andy's tag 2. Update comment for phy_add_device_link patch 2: 1. Add Andy's tag 2. Update comment for changed function patch 3: 1. Remove all unused function and make the dependency as static things. 2. Update comments for struct phy_bulk_data and left functions patch 4: 1. Remove all unused function and make the dependency as static things. patch 5: 1. Add phy document for these newly added apis. Changed from v1: - https://lore.kernel.org/linux-phy/20260831025319.94886-1-inochiama@gmail.com/ patch 1: 1. Update document. patch 2: 1. Fix document format. 2. Fix several document description. patch 3: 1. Split into two patches: one for non devm helpers, one for devm helpers. 2. All the bulk helper now use unsigned int for counts. 3. Fix multiple the while loop statement. 4. Rename of_phy_get_parent_count() to of_phy_get_count(). 5. Fix some 80 line function problems. 6. Use PTR_ERR_OR_ZERO() to simplify the error handle. 7. Fix zero value in the document 8. Use two separate release function for devm helpers. Inochi Amaoto (8): phy: core: Add common helper to add phy phandle device link phy: core: Add common helper for get phy phandle by index phy: core: Make phy_put() ignore NULL and error pointers phy: core: Add phy bulk data helper functions phy: core: Add managed phy bulk data helper functions doc: phy: Document some bulk helper functions PCI: cadence: Use phy bulk data api to simplify the logic ata: ahci_imx: Use bulk PHY APIs for calibration PHYs Documentation/driver-api/phy/phy.rst | 40 ++ drivers/ata/ahci_imx.c | 54 +- drivers/pci/controller/cadence/pcie-cadence.c | 62 +- drivers/pci/controller/cadence/pcie-cadence.h | 2 +- drivers/phy/phy-core.c | 546 ++++++++++++++++-- include/linux/phy/phy.h | 69 +++ 6 files changed, 644 insertions(+), 129 deletions(-) -- 2.56.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy