Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Sherry Sun <sherry.sun@nxp.com>
Cc: hongxing.zhu@nxp.com, l.stach@pengutronix.de,
	bhelgaas@google.com, lpieralisi@kernel.org,
	kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, s.hauer@pengutronix.de,
	festevam@gmail.com, imx@lists.linux.dev, kernel@pengutronix.de,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V7 04/13] PCI: imx6: Assert PERST# before enabling regulators
Date: Tue, 10 Mar 2026 11:23:41 -0400	[thread overview]
Message-ID: <abA3cM-Icmz47Ti2@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260310015426.365675-5-sherry.sun@nxp.com>

On Tue, Mar 10, 2026 at 09:54:17AM +0800, Sherry Sun wrote:
> According to the PCIe initialization requirements, PERST# signal should
> be asserted before applying power to the PCIe device, and deasserted
> after power and reference clock are stable.
>
> Currently, the driver enables the vpcie3v3aux regulator in
> imx_pcie_probe() before PERST# is asserted in imx_pcie_host_init(),
> which violates the PCIe power sequencing requirements. However, there
> is no issue so far because PERST# is requested as GPIOD_OUT_HIGH in
> imx_pcie_probe(), which guarantees that PERST# is asserted before
> enabling the vpcie3v3aux regulator.
>
> This is a preparation patch for the upcoming changes that will parse the

Nit: This is prepare for ...

> reset property using the new Root Port binding, which will use
> GPIOD_ASIS when requesting the reset GPIO. With GPIOD_ASIS, the GPIO
> state is not guaranteed, so explicit sequencing is required.
>
> Fix the power sequencing by:
> 1. Moving vpcie3v3aux regulator enable from probe to
>    imx_pcie_host_init(), where it can be properly sequenced with PERST#.
> 2. Moving imx_pcie_assert_perst() before regulator and clock enable to
>    ensure correct ordering.
>
> The vpcie3v3aux regulator is kept enabled for the entire PCIe controller
> lifecycle and automatically disabled on device removal via devm cleanup.
>
> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---
...
>  static void imx_pcie_assert_perst(struct imx_pcie *imx_pcie, bool assert)
>  {
>  	if (assert) {
> @@ -1240,6 +1249,29 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
>  	struct imx_pcie *imx_pcie = to_imx_pcie(pci);
>  	int ret;
>
> +	if (pp->bridge && imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_LUT)) {
> +		pp->bridge->enable_device = imx_pcie_enable_device;
> +		pp->bridge->disable_device = imx_pcie_disable_device;
> +	}

are you sure need move this part? it is not related preset and vaux.

> +
> +	imx_pcie_assert_perst(imx_pcie, true);
> +
> +	/* Keep 3.3Vaux supply enabled for the entire PCIe controller lifecycle */
> +	if (imx_pcie->vpcie_aux && !imx_pcie->vpcie_aux_enabled) {

How about two pcie shared one vaux regulator?

...
>  		if (ret) {
> @@ -1790,9 +1816,12 @@ static int imx_pcie_probe(struct platform_device *pdev)
>  	of_property_read_u32(node, "fsl,max-link-speed", &pci->max_link_speed);
>  	imx_pcie->supports_clkreq = of_property_read_bool(node, "supports-clkreq");
>
> -	ret = devm_regulator_get_enable_optional(&pdev->dev, "vpcie3v3aux");
> -	if (ret < 0 && ret != -ENODEV)
> -		return dev_err_probe(dev, ret, "failed to enable Vaux supply\n");
> +	imx_pcie->vpcie_aux = devm_regulator_get_optional(&pdev->dev, "vpcie3v3aux");
> +	if (IS_ERR(imx_pcie->vpcie_aux)) {
> +		if (PTR_ERR(imx_pcie->vpcie_aux) != -ENODEV)
> +			return PTR_ERR(imx_pcie->vpcie_aux);

keep old dev_err_probe(), just message change to "failed to get Vaux supply".

Frnak
> +		imx_pcie->vpcie_aux = NULL;
> +	}
>
>  	imx_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie");
>  	if (IS_ERR(imx_pcie->vpcie)) {
> --
> 2.37.1
>


  reply	other threads:[~2026-03-10 15:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  1:54 [PATCH V7 00/13] pci-imx6: Add support for parsing the reset property in new Root Port binding Sherry Sun
2026-03-10  1:54 ` [PATCH V7 01/13] dt-bindings: PCI: fsl,imx6q-pcie: Add reset GPIO in Root Port node Sherry Sun
2026-03-10  1:54 ` [PATCH V7 02/13] PCI: host-generic: Add common helpers for parsing Root Port properties Sherry Sun
2026-03-10 18:28   ` Frank Li
2026-03-11 10:03     ` Sherry Sun
2026-03-11 15:47       ` Frank Li
2026-03-12  2:04         ` Sherry Sun
2026-03-10  1:54 ` [PATCH V7 03/13] PCI: dwc: Parse Root Port nodes in dw_pcie_host_init() Sherry Sun
2026-03-10  1:54 ` [PATCH V7 04/13] PCI: imx6: Assert PERST# before enabling regulators Sherry Sun
2026-03-10 15:23   ` Frank Li [this message]
2026-03-11  7:09     ` Sherry Sun
2026-03-10  1:54 ` [PATCH V7 05/13] PCI: imx6: Add support for parsing the reset property in new Root Port binding Sherry Sun
2026-03-10  1:54 ` [PATCH V7 06/13] arm: dts: imx6qdl: Add Root Port node and PERST property Sherry Sun
2026-03-10  1:54 ` [PATCH V7 07/13] arm: dts: imx6sx: " Sherry Sun
2026-03-10  1:54 ` [PATCH V7 08/13] arm: dts: imx7d: " Sherry Sun
2026-03-10  1:54 ` [PATCH V7 09/13] arm64: dts: imx8mm: " Sherry Sun
2026-03-10  1:54 ` [PATCH V7 10/13] arm64: dts: imx8mp: " Sherry Sun
2026-03-10  1:54 ` [PATCH V7 11/13] arm64: dts: imx8mq: " Sherry Sun
2026-03-10  1:54 ` [PATCH V7 12/13] arm64: dts: imx8dxl/qm/qxp: " Sherry Sun
2026-03-10  1:54 ` [PATCH V7 13/13] arm64: dts: imx95: " Sherry Sun
2026-03-10 19:12 ` [PATCH V7 00/13] pci-imx6: Add support for parsing the reset property in new Root Port binding Bjorn Helgaas
2026-03-11  6:06   ` Sherry Sun

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=abA3cM-Icmz47Ti2@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=hongxing.zhu@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sherry.sun@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