[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200918123800.19983-1-huobean@gmail.com>
Date: Fri, 18 Sep 2020 14:38:00 +0200
From: Bean Huo <huobean@...il.com>
To: songxiaowei@...ilicon.com, wangbinghui@...ilicon.com,
lorenzo.pieralisi@....com, bhelgaas@...gle.com,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
beanhuo@...ron.com
Subject: [PATCH] PCI: kirin: Return -EPROBE_DEFER in case the gpio isn't ready
From: Bean Huo <beanhuo@...ron.com>
PCI driver might be probed before the gpiochip, so, of_get_named_gpio()
can return -EPROBE_DEFER. And let kirin_pcie_probe() directly return
-ENODEV, which will result in the PCIe probe failure and the PCIe
will not be probed again after the gpiochip driver is loaded.
Fix the above issue by letting kirin_pcie_probe() return -EPROBE_DEFER in
such a case.
Fixes: 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller")
Signed-off-by: Bean Huo <beanhuo@...ron.com>
---
drivers/pci/controller/dwc/pcie-kirin.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
index e496f51e0152..74b88d158072 100644
--- a/drivers/pci/controller/dwc/pcie-kirin.c
+++ b/drivers/pci/controller/dwc/pcie-kirin.c
@@ -507,8 +507,12 @@ static int kirin_pcie_probe(struct platform_device *pdev)
kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node,
"reset-gpios", 0);
- if (kirin_pcie->gpio_id_reset < 0)
+ if (kirin_pcie->gpio_id_reset == -EPROBE_DEFER) {
+ return -EPROBE_DEFER;
+ } else if (!gpio_is_valid(kirin_pcie->gpio_id_reset)) {
+ dev_err(dev, "unable to get a valid gpio pin\n");
return -ENODEV;
+ }
ret = kirin_pcie_power_on(kirin_pcie);
if (ret)
--
2.17.1
Powered by blists - more mailing lists