From: Frank Li <Frank.li@nxp.com>
To: Richard Zhu <hongxing.zhu@nxp.com>
Cc: l.stach@pengutronix.de, lpieralisi@kernel.org,
kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org,
bhelgaas@google.com, shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
imx@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] PCI: imx6: Enable the vpcie regulator when fetch it
Date: Wed, 18 Jun 2025 14:13:58 -0400 [thread overview]
Message-ID: <aFMB5ib19TYabeH+@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250618082042.3900021-1-hongxing.zhu@nxp.com>
On Wed, Jun 18, 2025 at 04:20:42PM +0800, Richard Zhu wrote:
> vpcie regulator is used to provide power to the PCIe port include WAKE#
> signal on i.MX. To support outbound wake up mechanism, enable the vpcie
> regulator when fetch it, and keep it on during PCIe port life cycle.
how about
Enable the vpcie regulator at probe time and keep it enabled for the
entire PCIe controller lifecycle. This ensures support for outbound
wake-up mechanisms such as WAKE# signaling.
Frank
>
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 27 ++++-----------------------
> 1 file changed, 4 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 5a38cfaf989b..7cab4bcfae56 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -159,7 +159,6 @@ struct imx_pcie {
> u32 tx_deemph_gen2_6db;
> u32 tx_swing_full;
> u32 tx_swing_low;
> - struct regulator *vpcie;
> struct regulator *vph;
> void __iomem *phy_base;
>
> @@ -1198,15 +1197,6 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
> struct imx_pcie *imx_pcie = to_imx_pcie(pci);
> int ret;
>
> - if (imx_pcie->vpcie) {
> - ret = regulator_enable(imx_pcie->vpcie);
> - if (ret) {
> - dev_err(dev, "failed to enable vpcie regulator: %d\n",
> - ret);
> - return 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;
> @@ -1222,7 +1212,7 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
> ret = imx_pcie_clk_enable(imx_pcie);
> if (ret) {
> dev_err(dev, "unable to enable pcie clocks: %d\n", ret);
> - goto err_reg_disable;
> + return ret;
> }
>
> if (imx_pcie->phy) {
> @@ -1269,9 +1259,6 @@ 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_reg_disable:
> - if (imx_pcie->vpcie)
> - regulator_disable(imx_pcie->vpcie);
> return ret;
> }
>
> @@ -1286,9 +1273,6 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp)
> phy_exit(imx_pcie->phy);
> }
> imx_pcie_clk_disable(imx_pcie);
> -
> - if (imx_pcie->vpcie)
> - regulator_disable(imx_pcie->vpcie);
> }
>
> static void imx_pcie_host_post_init(struct dw_pcie_rp *pp)
> @@ -1739,12 +1723,9 @@ static int imx_pcie_probe(struct platform_device *pdev)
> pci->max_link_speed = 1;
> of_property_read_u32(node, "fsl,max-link-speed", &pci->max_link_speed);
>
> - imx_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie");
> - if (IS_ERR(imx_pcie->vpcie)) {
> - if (PTR_ERR(imx_pcie->vpcie) != -ENODEV)
> - return PTR_ERR(imx_pcie->vpcie);
> - imx_pcie->vpcie = NULL;
> - }
> + ret = devm_regulator_get_enable_optional(&pdev->dev, "vpcie");
> + if (ret < 0 && ret != -ENODEV)
> + return dev_err_probe(dev, ret, "failed to enable vpcie");
>
> imx_pcie->vph = devm_regulator_get_optional(&pdev->dev, "vph");
> if (IS_ERR(imx_pcie->vph)) {
> --
> 2.37.1
>
prev parent reply other threads:[~2025-06-18 19:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 8:20 [PATCH v1] PCI: imx6: Enable the vpcie regulator when fetch it Richard Zhu
2025-06-18 16:56 ` Frank Li
2025-06-18 18:13 ` Frank Li [this message]
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=aFMB5ib19TYabeH+@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=bhelgaas@google.com \
--cc=festevam@gmail.com \
--cc=hongxing.zhu@nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--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=shawnguo@kernel.org \
/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