diff options
Diffstat (limited to 'meta-rcar-gen3-adas')
-rw-r--r-- | meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0066-pci-pcie-rcar-add-regulators-support.patch | 107 | ||||
-rw-r--r-- | meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend | 1 |
2 files changed, 108 insertions, 0 deletions
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0066-pci-pcie-rcar-add-regulators-support.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0066-pci-pcie-rcar-add-regulators-support.patch new file mode 100644 index 0000000..2a9a2a0 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0066-pci-pcie-rcar-add-regulators-support.patch @@ -0,0 +1,107 @@ +From d5a3dee65f4ee9d320128bbf79df80d51aec7687 Mon Sep 17 00:00:00 2001 +From: Andrey Gusakov <andrey.gusakov@cogentembedded.com> +Date: Mon, 24 Jul 2017 20:22:03 +0300 +Subject: [PATCH] pci: pcie-rcar: add regulators support + +Add PCIE regulators + +Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> +--- + drivers/pci/host/pcie-rcar.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 54 insertions(+) + +diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c +index 8e24d5f88415..6994ea2ac936 100644 +--- a/drivers/pci/host/pcie-rcar.c ++++ b/drivers/pci/host/pcie-rcar.c +@@ -16,6 +16,7 @@ + + #include <linux/clk.h> + #include <linux/delay.h> ++#include <linux/regulator/consumer.h> + #include <linux/interrupt.h> + #include <linux/irq.h> + #include <linux/irqdomain.h> +@@ -155,6 +156,8 @@ struct rcar_pcie { + int root_bus_nr; + struct clk *clk; + struct clk *bus_clk; ++ struct regulator *pcie3v3; /* 3.3V power supply */ ++ struct regulator *pcie1v8; /* 1.8V power supply */ + struct rcar_msi msi; + }; + +@@ -1193,6 +1196,36 @@ static int rcar_pcie_parse_request_of_pci_ranges(struct rcar_pcie *pci) + return err; + } + ++static int rcar_pcie_set_vpcie(struct rcar_pcie *pcie) ++{ ++ struct device *dev = pcie->dev; ++ int err; ++ ++ if (!IS_ERR(pcie->pcie3v3)) { ++ err = regulator_enable(pcie->pcie3v3); ++ if (err) { ++ dev_err(dev, "fail to enable vpcie3v3 regulator\n"); ++ goto err_out; ++ } ++ } ++ ++ if (!IS_ERR(pcie->pcie1v8)) { ++ err = regulator_enable(pcie->pcie1v8); ++ if (err) { ++ dev_err(dev, "fail to enable vpcie1v8 regulator\n"); ++ goto err_disable_3v3; ++ } ++ } ++ ++ return 0; ++ ++err_disable_3v3: ++ if (!IS_ERR(pcie->pcie3v3)) ++ regulator_disable(pcie->pcie3v3); ++err_out: ++ return err; ++} ++ + static int rcar_pcie_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -1209,6 +1242,26 @@ static int rcar_pcie_probe(struct platform_device *pdev) + pcie->dev = dev; + platform_set_drvdata(pdev, pcie); + ++ pcie->pcie3v3 = devm_regulator_get_optional(dev, "pcie3v3"); ++ if (IS_ERR(pcie->pcie3v3)) { ++ if (PTR_ERR(pcie->pcie3v3) == -EPROBE_DEFER) ++ return -EPROBE_DEFER; ++ dev_info(dev, "no pcie3v3 regulator found\n"); ++ } ++ ++ pcie->pcie1v8 = devm_regulator_get_optional(dev, "pcie1v8"); ++ if (IS_ERR(pcie->pcie1v8)) { ++ if (PTR_ERR(pcie->pcie1v8) == -EPROBE_DEFER) ++ return -EPROBE_DEFER; ++ dev_info(dev, "no pcie1v8 regulator found\n"); ++ } ++ ++ err = rcar_pcie_set_vpcie(pcie); ++ if (err) { ++ dev_err(dev, "failed to set pcie regulators\n"); ++ goto err_set_pcie; ++ } ++ + INIT_LIST_HEAD(&pcie->resources); + + rcar_pcie_parse_request_of_pci_ranges(pcie); +@@ -1267,6 +1320,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) + + err_pm_disable: + pm_runtime_disable(dev); ++err_set_pcie: + return err; + } + +-- +2.13.0 diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend index bc656e2..5cae1e5 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend @@ -47,6 +47,7 @@ SRC_URI_append = " \ file://0063-ASoC-PCM3168A-add-TDM-modes-merge-ADC-and-DAC.patch \ file://0064-ADV7511-limit-maximum-pixelclock.patch \ file://0065-gpio-max732x-set-gpio-ouput-low-at-init.patch \ + file://0066-pci-pcie-rcar-add-regulators-support.patch \ " SRC_URI_append_h3ulcb = " file://ulcb.cfg" |