From: Vitor Soares <ivitro@gmail.com>
To: "Vignesh Raghavendra" <vigneshr@ti.com>,
"Siddharth Vadapalli" <s-vadapalli@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>
Cc: Vitor Soares <vitor.soares@toradex.com>,
linux-omap@vger.kernel.org, linux-pci@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, ivitro@gmail.com
Subject: [PATCH v1 2/2] PCI: j721e: Add support for optional regulator supplies
Date: Tue, 14 Oct 2025 12:25:49 +0100 [thread overview]
Message-ID: <20251014112553.398845-3-ivitro@gmail.com> (raw)
In-Reply-To: <20251014112553.398845-1-ivitro@gmail.com>
From: Vitor Soares <vitor.soares@toradex.com>
Some boards require external regulators to power PCIe endpoints.
Add support for optional 1.5V, 3.3V, and 12V supplies, which may be
defined in the device tree as vpcie1v5-supply, vpcie3v3-supply, and
vpcie12v-supply.
Use devm_regulator_get_enable_optional() to obtain and enable each
supply, so it will be automatically disabled when the driver is
removed.
Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
---
drivers/pci/controller/cadence/pci-j721e.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index 5bc5ab20aa6d..f29ce2aef04e 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -21,6 +21,7 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include "../../pci.h"
#include "pcie-cadence.h"
@@ -467,6 +468,10 @@ static const struct of_device_id of_j721e_pcie_match[] = {
};
MODULE_DEVICE_TABLE(of, of_j721e_pcie_match);
+static const char * const j721e_pcie_supplies[] = {
+ "vpcie12v", "vpcie3v3", "vpcie1v5"
+};
+
static int j721e_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -480,6 +485,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
struct gpio_desc *gpiod;
void __iomem *base;
struct clk *clk;
+ unsigned int i;
u32 num_lanes;
u32 mode;
int ret;
@@ -565,6 +571,13 @@ static int j721e_pcie_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
+ for (i = 0; i < ARRAY_SIZE(j721e_pcie_supplies); i++) {
+ ret = devm_regulator_get_enable_optional(dev, j721e_pcie_supplies[i]);
+ if (ret < 0 && ret != -ENODEV)
+ return dev_err_probe(dev, ret, "can't enable regulator %s\n",
+ j721e_pcie_supplies[i]);
+ }
+
dev_set_drvdata(dev, pcie);
pm_runtime_enable(dev);
ret = pm_runtime_get_sync(dev);
--
2.51.0
next prev parent reply other threads:[~2025-10-14 11:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 11:25 [PATCH v1 0/2] PCI: j721e: Add voltage regulator support Vitor Soares
2025-10-14 11:25 ` [PATCH v1 1/2] dt-bindings: PCI: ti,j721e-pci-host: Add optional regulator supplies Vitor Soares
2025-10-20 11:14 ` Krzysztof Kozlowski
2025-10-27 23:22 ` Vitor Soares
2025-10-28 5:41 ` Manivannan Sadhasivam
2025-10-28 23:35 ` Vitor Soares
2025-10-14 11:25 ` Vitor Soares [this message]
2025-10-21 2:06 ` [PATCH v1 2/2] PCI: j721e: Add support for " Manivannan Sadhasivam
2025-10-27 20:24 ` Vitor Soares
2025-10-28 5:46 ` Manivannan Sadhasivam
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=20251014112553.398845-3-ivitro@gmail.com \
--to=ivitro@gmail.com \
--cc=bhelgaas@google.com \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=vigneshr@ti.com \
--cc=vitor.soares@toradex.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