* [PATCH v2] PCI: imx6: Enable the vpcie regulator when fetch it
@ 2025-06-19 7:24 Richard Zhu
2025-06-19 15:03 ` Frank Li
2025-08-12 17:12 ` Manivannan Sadhasivam
0 siblings, 2 replies; 4+ messages in thread
From: Richard Zhu @ 2025-06-19 7:24 UTC (permalink / raw)
To: frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, bhelgaas,
shawnguo, s.hauer, kernel, festevam
Cc: linux-pci, linux-arm-kernel, imx, linux-kernel, Richard Zhu
Enable the vpcie regulator at probe time and keep it enabled for the
entire PCIe controller lifecycle. This ensures support for outbound
wake-up mechanism such as WAKE# signaling.
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: imx6: Enable the vpcie regulator when fetch it
2025-06-19 7:24 [PATCH v2] PCI: imx6: Enable the vpcie regulator when fetch it Richard Zhu
@ 2025-06-19 15:03 ` Frank Li
2025-08-12 17:12 ` Manivannan Sadhasivam
1 sibling, 0 replies; 4+ messages in thread
From: Frank Li @ 2025-06-19 15:03 UTC (permalink / raw)
To: Richard Zhu
Cc: l.stach, lpieralisi, kwilczynski, mani, robh, bhelgaas, shawnguo,
s.hauer, kernel, festevam, linux-pci, linux-arm-kernel, imx,
linux-kernel
On Thu, Jun 19, 2025 at 03:24:38PM +0800, Richard Zhu wrote:
> Enable the vpcie regulator at probe time and keep it enabled for the
> entire PCIe controller lifecycle. This ensures support for outbound
> wake-up mechanism such as WAKE# signaling.
>
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: imx6: Enable the vpcie regulator when fetch it
2025-06-19 7:24 [PATCH v2] PCI: imx6: Enable the vpcie regulator when fetch it Richard Zhu
2025-06-19 15:03 ` Frank Li
@ 2025-08-12 17:12 ` Manivannan Sadhasivam
2025-08-14 5:54 ` Hongxing Zhu
1 sibling, 1 reply; 4+ messages in thread
From: Manivannan Sadhasivam @ 2025-08-12 17:12 UTC (permalink / raw)
To: Richard Zhu
Cc: frank.li, l.stach, lpieralisi, kwilczynski, robh, bhelgaas,
shawnguo, s.hauer, kernel, festevam, linux-pci, linux-arm-kernel,
imx, linux-kernel
On Thu, Jun 19, 2025 at 03:24:38PM GMT, Richard Zhu wrote:
> Enable the vpcie regulator at probe time and keep it enabled for the
> entire PCIe controller lifecycle. This ensures support for outbound
> wake-up mechanism such as WAKE# signaling.
I'm not sure about this part. For supporting WAKE#, Vaux supply has to be
supplied to the endpoint. But here, 'vpcie' looks like the main 3.3V supply. So
keeping it always on to support WAKE#, sounds to me that the component never
enters the D3Cold state. So no WAKE# is required.
- Mani
>
> 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
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v2] PCI: imx6: Enable the vpcie regulator when fetch it
2025-08-12 17:12 ` Manivannan Sadhasivam
@ 2025-08-14 5:54 ` Hongxing Zhu
0 siblings, 0 replies; 4+ messages in thread
From: Hongxing Zhu @ 2025-08-14 5:54 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Frank Li, l.stach, lpieralisi, kwilczynski, robh, bhelgaas,
shawnguo, s.hauer, kernel, festevam, linux-pci, linux-arm-kernel,
imx, linux-kernel
> -----Original Message-----
> From: Manivannan Sadhasivam <mani@kernel.org>
> Sent: 2025年8月13日 1:12
> To: Hongxing Zhu <hongxing.zhu@nxp.com>
> Cc: Frank Li <frank.li@nxp.com>; l.stach@pengutronix.de;
> lpieralisi@kernel.org; kwilczynski@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 v2] PCI: imx6: Enable the vpcie regulator when fetch it
>
> On Thu, Jun 19, 2025 at 03:24:38PM GMT, Richard Zhu wrote:
> > Enable the vpcie regulator at probe time and keep it enabled for the
> > entire PCIe controller lifecycle. This ensures support for outbound
> > wake-up mechanism such as WAKE# signaling.
>
> I'm not sure about this part. For supporting WAKE#, Vaux supply has to be
> supplied to the endpoint. But here, 'vpcie' looks like the main 3.3V supply.
> So keeping it always on to support WAKE#, sounds to me that the
> component never enters the D3Cold state. So no WAKE# is required.
Hi Mani:
Thanks for your comments. You're right.
Another +3.3Vaux should be added to power up the WAKE# circuit.
Best Regards
Richard Zhu
>
> - Mani
>
> >
> > 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
> >
>
> --
> மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-14 5:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-19 7:24 [PATCH v2] PCI: imx6: Enable the vpcie regulator when fetch it Richard Zhu
2025-06-19 15:03 ` Frank Li
2025-08-12 17:12 ` Manivannan Sadhasivam
2025-08-14 5:54 ` Hongxing Zhu
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®