mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: "Sherry Sun (OSS)" <sherry.sun@oss.nxp.com>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, lpieralisi@kernel.org,
	kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com,
	hongxing.zhu@nxp.com, l.stach@pengutronix.de,
	imx@lists.linux.dev, linux-pci@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, sherry.sun@nxp.com
Subject: Re: [PATCH V3 1/8] PCI: imx6: Integrate new pwrctrl API for pci-imx6
Date: Wed, 20 May 2026 14:38:48 -0400	[thread overview]
Message-ID: <ag3_uFchYZoE9sMn@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260520084904.2424253-2-sherry.sun@oss.nxp.com>

On Wed, May 20, 2026 at 04:48:57PM +0800, Sherry Sun (OSS) wrote:
> From: Sherry Sun <sherry.sun@nxp.com>
>
> Integrate the PCI pwrctrl framework into the pci-imx6 driver to provide
> standardized power management for PCIe devices.
>
> Legacy regulator handling (vpcie-supply at controller level) is
> maintained for backward compatibility with existing device trees.
> New device trees should specify power supplies at the Root Port
> level to utilize the pwrctrl framework.
>
> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/pci/controller/dwc/Kconfig    |  1 +
>  drivers/pci/controller/dwc/pci-imx6.c | 24 +++++++++++++++++++++++-
>  2 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig
> index 216ede0a867e..aa0b784c85b4 100644
> --- a/drivers/pci/controller/dwc/Kconfig
> +++ b/drivers/pci/controller/dwc/Kconfig
> @@ -114,6 +114,7 @@ config PCI_IMX6_HOST
>  	depends on PCI_MSI
>  	select PCIE_DW_HOST
>  	select PCI_IMX6
> +	select PCI_PWRCTRL_GENERIC
>  	help
>  	  Enables support for the PCIe controller in the i.MX SoCs to
>  	  work in Root Complex mode. The PCI controller on i.MX is based
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 773ab65b2afa..b137551871fc 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -20,6 +20,7 @@
>  #include <linux/of.h>
>  #include <linux/of_address.h>
>  #include <linux/pci.h>
> +#include <linux/pci-pwrctrl.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/regulator/consumer.h>
> @@ -1331,6 +1332,7 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
>  			return ret;
>  	}
>
> +	/* Legacy regulator handling for DT backward compatibility. */
>  	if (imx_pcie->vpcie) {
>  		ret = regulator_enable(imx_pcie->vpcie);
>  		if (ret) {
> @@ -1340,10 +1342,22 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
>  		}
>  	}
>
> +	ret = pci_pwrctrl_create_devices(dev);
> +	if (ret) {
> +		dev_err(dev, "failed to create pwrctrl devices\n");
> +		goto err_reg_disable;
> +	}
> +
> +	ret = pci_pwrctrl_power_on_devices(dev);
> +	if (ret) {
> +		dev_err(dev, "failed to power on pwrctrl devices\n");
> +		goto err_pwrctrl_destroy;
> +	}
> +
>  	ret = imx_pcie_clk_enable(imx_pcie);
>  	if (ret) {
>  		dev_err(dev, "unable to enable pcie clocks: %d\n", ret);
> -		goto err_reg_disable;
> +		goto err_pwrctrl_power_off;
>  	}
>
>  	if (pp->bridge && imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_LUT)) {
> @@ -1402,6 +1416,11 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
>  	phy_exit(imx_pcie->phy);
>  err_clk_disable:
>  	imx_pcie_clk_disable(imx_pcie);
> +err_pwrctrl_power_off:
> +	pci_pwrctrl_power_off_devices(dev);
> +err_pwrctrl_destroy:
> +	if (ret != -EPROBE_DEFER)
> +		pci_pwrctrl_destroy_devices(dev);
>  err_reg_disable:
>  	if (imx_pcie->vpcie)
>  		regulator_disable(imx_pcie->vpcie);
> @@ -1420,6 +1439,7 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp)
>  	}
>  	imx_pcie_clk_disable(imx_pcie);
>
> +	pci_pwrctrl_power_off_devices(pci->dev);
>  	if (imx_pcie->vpcie)
>  		regulator_disable(imx_pcie->vpcie);
>  }
> @@ -1931,6 +1951,8 @@ static void imx_pcie_shutdown(struct platform_device *pdev)
>  	/* bring down link, so bootloader gets clean state in case of reboot */
>  	imx_pcie_assert_core_reset(imx_pcie);
>  	imx_pcie_assert_perst(imx_pcie, true);
> +	pci_pwrctrl_power_off_devices(&pdev->dev);
> +	pci_pwrctrl_destroy_devices(&pdev->dev);
>  }
>
>  static const struct imx_pcie_drvdata drvdata[] = {
> --
> 2.37.1
>

  reply	other threads:[~2026-05-20 18:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20  8:48 [PATCH V3 0/8] PCI: imx6: Integrate pwrctrl API and update device trees Sherry Sun (OSS)
2026-05-20  8:48 ` [PATCH V3 1/8] PCI: imx6: Integrate new pwrctrl API for pci-imx6 Sherry Sun (OSS)
2026-05-20 18:38   ` Frank Li [this message]
2026-05-20  8:48 ` [PATCH V3 2/8] arm: dts: imx6qdl-sabresd: Move power supply property to Root Port node Sherry Sun (OSS)
2026-05-20  8:48 ` [PATCH V3 3/8] arm: dts: imx6sx-sdb: " Sherry Sun (OSS)
2026-05-20  8:49 ` [PATCH V3 4/8] arm64: dts: imx8mm-evk: " Sherry Sun (OSS)
2026-05-20  8:49 ` [PATCH V3 5/8] arm64: dts: imx8mp-evk: Move power supply properties " Sherry Sun (OSS)
2026-05-20  8:49 ` [PATCH V3 6/8] arm64: dts: imx8mq-evk: " Sherry Sun (OSS)
2026-05-20  8:49 ` [PATCH V3 7/8] arm64: dts: imx8dxl/qm/qxp: " Sherry Sun (OSS)
2026-05-20  8:49 ` [PATCH V3 8/8] arm64: dts: imx95: " Sherry Sun (OSS)
2026-05-21  3:37 ` [PATCH V3 0/8] PCI: imx6: Integrate pwrctrl API and update device trees Hongxing Zhu (OSS)
2026-05-21  4:40   ` Sherry Sun
2026-06-10 15:25     ` Manivannan Sadhasivam
2026-06-10 13:48 ` (subset) " Manivannan Sadhasivam
2026-06-10 15:29 ` Manivannan Sadhasivam
2026-06-29 16:15 ` (subset) " Frank.Li
2026-06-29 16:18 ` Frank.Li
2026-06-29 19:07   ` Frank Li
2026-06-30  2:23     ` 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=ag3_uFchYZoE9sMn@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 \
    --cc=sherry.sun@oss.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

all inboxes | Powered by JetHome®