Commit 67b9ef22 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

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
parents 1b6069f5 6797e4da
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -68,6 +68,15 @@ properties:
  phy-names:
    const: pcie

  vpcie1v5-supply:
    description: The 1.5v regulator to use for PCIe.

  vpcie3v3-supply:
    description: The 3.3v regulator to use for PCIe.

  vpcie12v-supply:
    description: The 12v regulator to use for PCIe.

required:
  - compatible
  - reg
@@ -121,5 +130,7 @@ examples:
             clock-names = "pcie", "pcie_bus";
             power-domains = <&sysc R8A7791_PD_ALWAYS_ON>;
             resets = <&cpg 319>;
             vpcie3v3-supply = <&pcie_3v3>;
             vpcie12v-supply = <&pcie_12v>;
         };
    };
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+17 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>

#include "pcie-rcar.h"

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

/* Design note 346 from Linear Technology says order is not important. */
static const char * const rcar_pcie_supplies[] = {
	"vpcie1v5",
	"vpcie3v3",
	"vpcie12v",
};

static int rcar_pcie_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct pci_host_bridge *bridge;
	struct rcar_pcie_host *host;
	struct rcar_pcie *pcie;
	unsigned int i;
	u32 data;
	int err;
	struct pci_host_bridge *bridge;

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

	for (i = 0; i < ARRAY_SIZE(rcar_pcie_supplies); i++) {
		err = devm_regulator_get_enable_optional(dev, rcar_pcie_supplies[i]);
		if (err < 0 && err != -ENODEV)
			return dev_err_probe(dev, err, "failed to enable regulator: %s\n",
					     rcar_pcie_supplies[i]);
	}

	pm_runtime_enable(pcie->dev);
	err = pm_runtime_get_sync(pcie->dev);
	if (err < 0) {