Skip to content

Commit 67b9ef2

Browse files
committed
Merge branch 'pci/controller/rcar'
- Replace of_device.h with explicit of.h include to untangle header usage (Rob Herring) - Add DT and driver support for optional miniPCIe 1.5v and 3.3v regulators on KingFisher (Wolfram Sang) * pci/controller/rcar: PCI: rcar-host: Add support for optional regulators dt-bindings: PCI: rcar-pci-host: Add optional regulators PCI: rcar-gen4: Replace of_device.h with explicit of.h include
2 parents 1b6069f + 6797e4d commit 67b9ef2

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

Documentation/devicetree/bindings/pci/rcar-pci-host.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ properties:
6868
phy-names:
6969
const: pcie
7070

71+
vpcie1v5-supply:
72+
description: The 1.5v regulator to use for PCIe.
73+
74+
vpcie3v3-supply:
75+
description: The 3.3v regulator to use for PCIe.
76+
77+
vpcie12v-supply:
78+
description: The 12v regulator to use for PCIe.
79+
7180
required:
7281
- compatible
7382
- reg
@@ -121,5 +130,7 @@ examples:
121130
clock-names = "pcie", "pcie_bus";
122131
power-domains = <&sysc R8A7791_PD_ALWAYS_ON>;
123132
resets = <&cpg 319>;
133+
vpcie3v3-supply = <&pcie_3v3>;
134+
vpcie12v-supply = <&pcie_12v>;
124135
};
125136
};

drivers/pci/controller/dwc/pcie-rcar-gen4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <linux/interrupt.h>
99
#include <linux/io.h>
1010
#include <linux/module.h>
11-
#include <linux/of_device.h>
11+
#include <linux/of.h>
1212
#include <linux/pci.h>
1313
#include <linux/platform_device.h>
1414
#include <linux/pm_runtime.h>

drivers/pci/controller/pcie-rcar-host.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/phy/phy.h>
3030
#include <linux/platform_device.h>
3131
#include <linux/pm_runtime.h>
32+
#include <linux/regulator/consumer.h>
3233

3334
#include "pcie-rcar.h"
3435

@@ -953,14 +954,22 @@ static const struct of_device_id rcar_pcie_of_match[] = {
953954
{},
954955
};
955956

957+
/* Design note 346 from Linear Technology says order is not important. */
958+
static const char * const rcar_pcie_supplies[] = {
959+
"vpcie1v5",
960+
"vpcie3v3",
961+
"vpcie12v",
962+
};
963+
956964
static int rcar_pcie_probe(struct platform_device *pdev)
957965
{
958966
struct device *dev = &pdev->dev;
967+
struct pci_host_bridge *bridge;
959968
struct rcar_pcie_host *host;
960969
struct rcar_pcie *pcie;
970+
unsigned int i;
961971
u32 data;
962972
int err;
963-
struct pci_host_bridge *bridge;
964973

965974
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*host));
966975
if (!bridge)
@@ -971,6 +980,13 @@ static int rcar_pcie_probe(struct platform_device *pdev)
971980
pcie->dev = dev;
972981
platform_set_drvdata(pdev, host);
973982

983+
for (i = 0; i < ARRAY_SIZE(rcar_pcie_supplies); i++) {
984+
err = devm_regulator_get_enable_optional(dev, rcar_pcie_supplies[i]);
985+
if (err < 0 && err != -ENODEV)
986+
return dev_err_probe(dev, err, "failed to enable regulator: %s\n",
987+
rcar_pcie_supplies[i]);
988+
}
989+
974990
pm_runtime_enable(pcie->dev);
975991
err = pm_runtime_get_sync(pcie->dev);
976992
if (err < 0) {

0 commit comments

Comments
 (0)