From: Vladimir Oltean <olteanv@gmail.com>
To: Inochi Amaoto <inochiama@gmail.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Niklas Cassel" <cassel@kernel.org>,
"Frank Li" <Frank.Li@nxp.com>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Aksh Garg" <a-garg7@ti.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Vinod Koul" <vkoul@kernel.org>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Rhys Tumelty" <rhys@tumelty.co.uk>,
"Manikandan K Pillai" <mpillai@cadence.com>,
"vladimir.oltean@nxp.com" <vladimir.oltean@nxp.com>,
"Qiang Yu" <qiang.yu@oss.qualcomm.com>,
"Hans Zhang" <18255117159@163.com>, "Yao Zi" <me@ziyao.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" <dlan@gentoo.org>,
"Longbin Li" <looong.bin@gmail.com>
Subject: Re: [PATCH v5 6/8] doc: phy: Document some bulk helper functions
Date: Wed, 25 Nov 2026 17:28:30 +0200 [thread overview]
Message-ID: <awb-MUCgZJn94Lbx@skbuf> (raw)
In-Reply-To: <20261125043639.249525-7-inochiama@gmail.com>
On Wed, Nov 25, 2026 at 12:36:37PM +0800, Inochi Amaoto wrote:
> Document all newly added bulk helper function, it can be used to manage
> a set of PHYs automatically. This is useful when the driver want to
> simplify the management of multiple PHYs.
>
> Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> ---
> Documentation/driver-api/phy/phy.rst | 40 ++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/Documentation/driver-api/phy/phy.rst b/Documentation/driver-api/phy/phy.rst
> index 0865c2e94eec..cae3d4700814 100644
> --- a/Documentation/driver-api/phy/phy.rst
> +++ b/Documentation/driver-api/phy/phy.rst
> @@ -114,6 +114,12 @@ it. This framework provides the following APIs to get a reference to the PHY.
> struct phy *devm_of_phy_get_by_index(struct device *dev,
> struct device_node *np,
> int index);
> + int devm_phy_bulk_get(struct device *dev, int num_phys,
> + struct phy_bulk_data *phys);
> + int devm_phy_bulk_get_all(struct device *dev,
> + struct phy_bulk_data **phys);
> + int devm_of_phy_bulk_get_all(struct device *dev, struct device_node *np,
> + struct phy_bulk_data **phys);
>
> phy_get, devm_phy_get and devm_phy_optional_get can be used to get the PHY.
> In the case of dt boot, the string arguments
> @@ -129,6 +135,21 @@ Some generic drivers, such as ehci, may use multiple phys. In this case,
> devm_of_phy_get or devm_of_phy_get_by_index can be used to get a phy
> reference based on name or index.
>
> +The bulk helpers are useful when a controller operates several PHYs together,
> +for example the lanes of a single PCIe port. To get a set of PHYs by name,
> +the driver supplies an array of ``struct phy_bulk_data`` with the ``id`` of
> +each entry set to the corresponding PHY name. devm_phy_bulk_get() returns
> +zero if it obtains all the requested PHYs or a negative error code on failure.
> +The driver owns the array and keeps it valid until driver detach, when the
> +PHY references are released.
> +
> +When a controller needs every PHY listed in a device node's ``phys`` property,
> +devm_phy_bulk_get_all() obtains them from the controller's device node.
> +devm_of_phy_bulk_get_all() does the same for an explicitly supplied device
> +node. These functions return the number of PHYs listed in the node, which may
> +be zero, or a negative error code on failure. They store the allocated array
> +in ``*phys`` only when the return value is positive.
> +
> It should be noted that NULL is a valid phy reference. All phy
> consumer calls on the NULL phy become NOPs. That is the release calls,
> the phy_init() and phy_exit() calls, and phy_power_on() and
> @@ -149,6 +170,14 @@ The general order of calls should be::
> phy_exit()
> [[of_]phy_put()]
>
> +After acquiring a set of PHYs with a bulk helper, the order is::
> +
> + phy_bulk_init()
> + phy_bulk_power_on()
> + ...
> + phy_bulk_power_off()
> + phy_bulk_exit()
> +
> Some PHY drivers may not implement :c:func:`phy_init` or :c:func:`phy_power_on`,
> but controllers should always call these functions to be compatible with other
> PHYs. Some PHYs may require :c:func:`phy_set_mode <phy_set_mode_ext>`, while
> @@ -172,6 +201,12 @@ PHY framework provides 2 APIs to release a reference to the PHY.
> Both these APIs are used to release a reference to the PHY and devm_phy_put
> destroys the devres associated with this PHY.
>
> +For devm_phy_bulk_get_all() and devm_of_phy_bulk_get_all(), driver detach
> +releases both the PHY references and the allocated array. To release them
> +earlier, use::
> +
> + void devm_phy_bulk_put_all(struct device *dev, struct phy_bulk_data *phy);
> +
> Destroying the PHY
> ==================
>
> @@ -221,3 +256,8 @@ DeviceTree Binding
>
> The documentation for PHY dt binding can be found @
> Documentation/devicetree/bindings/phy/phy-bindings.txt
> +
> +Missing Bulk Helpers
> +====================
> +Currently, only a few bulk helper functions are added as they have users.
> +Function not upstreamed can be found at https://lore.kernel.org/linux-phy/20260904083709.425893-1-inochiama@gmail.com/
s/Function/Functions/
Other than that:
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Thanks for updating the documentation, this is appreciated.
next prev parent reply other threads:[~2026-11-25 15:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 4:36 [PATCH v5 0/8] phy: core: Add phy bulk helpers support Inochi Amaoto
2026-11-25 4:36 ` [PATCH v5 1/8] phy: core: Add common helper to add phy phandle device link Inochi Amaoto
2026-11-25 4:36 ` [PATCH v5 2/8] phy: core: Add common helper for get phy phandle by index Inochi Amaoto
2026-11-25 4:36 ` [PATCH v5 3/8] phy: core: Make phy_put() ignore NULL and error pointers Inochi Amaoto
2026-11-25 4:36 ` [PATCH v5 4/8] phy: core: Add phy bulk data helper functions Inochi Amaoto
2026-11-25 15:20 ` Vladimir Oltean
2026-11-25 4:36 ` [PATCH v5 5/8] phy: core: Add managed " Inochi Amaoto
2026-11-25 4:36 ` [PATCH v5 6/8] doc: phy: Document some bulk " Inochi Amaoto
2026-11-25 15:28 ` Vladimir Oltean [this message]
2026-11-25 4:36 ` [PATCH v5 7/8] PCI: cadence: Use phy bulk data api to simplifiy the logic Inochi Amaoto
2026-11-25 15:23 ` Vladimir Oltean
2026-11-25 4:36 ` [PATCH v5 8/8] ata: ahci_imx: Use bulk PHY APIs for calibration PHYs Inochi Amaoto
2026-11-25 15:39 ` Vladimir Oltean
2026-11-25 15:56 ` Niklas Cassel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=awb-MUCgZJn94Lbx@skbuf \
--to=olteanv@gmail.com \
--cc=18255117159@163.com \
--cc=Frank.Li@nxp.com \
--cc=a-garg7@ti.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=corbet@lwn.net \
--cc=dlan@gentoo.org \
--cc=dlemoal@kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=inochiama@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=looong.bin@gmail.com \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=me@ziyao.cc \
--cc=mpillai@cadence.com \
--cc=neil.armstrong@linaro.org \
--cc=qiang.yu@oss.qualcomm.com \
--cc=rdunlap@infradead.org \
--cc=rhys@tumelty.co.uk \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=skhan@linuxfoundation.org \
--cc=vkoul@kernel.org \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox