aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2020-08-05 18:24:18 -0500
committerBjorn Helgaas <bhelgaas@google.com>2020-08-05 18:24:18 -0500
commit5b17dbab263035aa1dc8e61637bc719f47c60daa (patch)
tree6308959e501fce66efdee2850c49416a27dc6a2d /drivers/pci
parentMerge branch 'pci/switchtec' (diff)
parentPCI: aardvark: Don't touch PCIe registers if no card connected (diff)
downloadlinux-dev-5b17dbab263035aa1dc8e61637bc719f47c60daa.tar.xz
linux-dev-5b17dbab263035aa1dc8e61637bc719f47c60daa.zip
Merge branch 'remotes/lorenzo/pci/aardvark'
- Indicate error in 'val' when config read fails (Pali Rohár) - Don't touch PCIe registers if no card connected (Pali Rohár) * remotes/lorenzo/pci/aardvark: PCI: aardvark: Don't touch PCIe registers if no card connected PCI: aardvark: Indicate error in 'val' when config read fails
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/controller/pci-aardvark.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index 90ff291c24f0..1258f45cbc11 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -644,6 +644,13 @@ static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,
if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0)
return false;
+ /*
+ * If the link goes down after we check for link-up, nothing bad
+ * happens but the config access times out.
+ */
+ if (bus->number != pcie->root_bus_nr && !advk_pcie_link_up(pcie))
+ return false;
+
return true;
}
@@ -688,8 +695,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
advk_writel(pcie, 1, PIO_START);
ret = advk_pcie_wait_pio(pcie);
- if (ret < 0)
+ if (ret < 0) {
+ *val = 0xffffffff;
return PCIBIOS_SET_FAILED;
+ }
advk_pcie_check_pio_status(pcie);