[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <f2ddbc72b378bd28cc249da6e3135c7d7bad5af4.1612335031.git.mchehab+huawei@kernel.org>
Date: Wed, 3 Feb 2021 08:01:52 +0100
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: unlisted-recipients:; (no To-header on input)
Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Binghui Wang <wangbinghui@...ilicon.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>,
Xiaowei Song <songxiaowei@...ilicon.com>,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Subject: [PATCH v2 08/11] PCI: dwc: pcie-kirin: add support for a regulator
On Kirin 970 designs, a power supply is required to enable
a PCI bridge and other components of the board.
For instance, on HiKey 970, the Hi6421v600 regulator provides a
power line (LDO33) which powers on the PCI bridge, the M.2 slot,
the mini PCIe 1x slot and the Realtek 8169 Ethernet card.
Without enabling such power supply, the PCI resource allocation
fails.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
drivers/pci/controller/dwc/pcie-kirin.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
index 2bce6e3750d4..005fc4c2ad7f 100644
--- a/drivers/pci/controller/dwc/pcie-kirin.c
+++ b/drivers/pci/controller/dwc/pcie-kirin.c
@@ -22,6 +22,7 @@
#include <linux/pci_regs.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include <linux/resource.h>
#include <linux/types.h>
#include "pcie-designware.h"
@@ -335,8 +336,21 @@ static long kirin970_pcie_get_resource(struct kirin_pcie *kirin_pcie,
struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct regulator *reg;
int ret;
+ reg = devm_regulator_get(dev, "pcie_vdd");
+ if (IS_ERR_OR_NULL(reg)) {
+ if (PTR_ERR(reg) == -EPROBE_DEFER)
+ return PTR_ERR(reg);
+ } else {
+ ret = regulator_enable(reg);
+ if (ret) {
+ dev_err(dev, "Failed to enable regulator\n");
+ return ret;
+ }
+ }
+
kirin970_pcie_get_eyeparam(kirin_pcie);
kirin_pcie->gpio_id_reset[0] = of_get_named_gpio(dev->of_node,
--
2.29.2
Powered by blists - more mailing lists