Message ID | 20230508104557.47889-3-wsa+renesas@sang-engineering.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Krzysztof Wilczyński |
Headers | show |
Series | KingFisher: support regulators for PCIe | expand |
Hi Wolfram, On Mon, May 8, 2023 at 12:47 PM Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > > The KingFisher board has regulators. They just need to be en-/disabled, > so we can leave the handling to devm. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Thanks for your patch! > --- a/drivers/pci/controller/pcie-rcar-host.c > +++ b/drivers/pci/controller/pcie-rcar-host.c > @@ -992,6 +993,14 @@ static int rcar_pcie_probe(struct platform_device *pdev) > pcie->dev = dev; > platform_set_drvdata(pdev, host); > > + err = devm_regulator_get_enable_optional(dev, "vpcie3v3"); > + if (err < 0 && err != -ENODEV) > + dev_err_probe(dev, err, "error enabling 3.3V regulator"); > + > + err = devm_regulator_get_enable_optional(dev, "vpcie1v5"); > + if (err < 0 && err != -ENODEV) > + dev_err_probe(dev, err, "error enabling 1.5V regulator"); As per my comment on patch 1/3, I think you want to grab "vpcie12v0-supply", too. And perhaps factor out the voltage as a parameter in the error message, to increase string sharing? I don't know if PCIe specifies some ordering w.r.t. power supply enablement. > + > pm_runtime_enable(pcie->dev); > err = pm_runtime_get_sync(pcie->dev); > if (err < 0) { Gr{oetje,eeting}s, Geert
> I don't know if PCIe specifies some ordering w.r.t. power supply > enablement. I found this which is good enough for me: "There is no requirement for supply sequencing in either PCI Express or PCI Express Mini Card; the supplies may come up or go down in any order." [1] Thanks, Linear Technology! [1] https://www.analog.com/media/en/reference-design-documentation/design-notes/dn346f.pdf
diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c index e80e56b2a842..b0e4834176d2 100644 --- a/drivers/pci/controller/pcie-rcar-host.c +++ b/drivers/pci/controller/pcie-rcar-host.c @@ -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" @@ -992,6 +993,14 @@ static int rcar_pcie_probe(struct platform_device *pdev) pcie->dev = dev; platform_set_drvdata(pdev, host); + err = devm_regulator_get_enable_optional(dev, "vpcie3v3"); + if (err < 0 && err != -ENODEV) + dev_err_probe(dev, err, "error enabling 3.3V regulator"); + + err = devm_regulator_get_enable_optional(dev, "vpcie1v5"); + if (err < 0 && err != -ENODEV) + dev_err_probe(dev, err, "error enabling 1.5V regulator"); + pm_runtime_enable(pcie->dev); err = pm_runtime_get_sync(pcie->dev); if (err < 0) {
The KingFisher board has regulators. They just need to be en-/disabled, so we can leave the handling to devm. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- drivers/pci/controller/pcie-rcar-host.c | 9 +++++++++ 1 file changed, 9 insertions(+)