[V2,2/2] PCI: Introduce pci_dev_wait() in pci_power_up() API
diff mbox series

Message ID 20191120051743.23124-2-vidyas@nvidia.com
State New
Headers show
  • [V2,1/2] PCI: Move the definition of pci_dev_wait()
Related show

Commit Message

Vidya Sagar Nov. 20, 2019, 5:17 a.m. UTC
Add pci_dev_wait() in pci_power_up() before accessing the configuration
space of a device for the first time in the system resume sequence.
This is  to accommodate devices (Ex:- Intel 750 NVMe) that respond with CRS
status while they get ready for configuration space access and before they
finally start responding with proper values.

Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
 drivers/pci/pci.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff mbox series

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 71b45ce73bf6..7672b9a44bac 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1086,6 +1086,13 @@  int pci_power_up(struct pci_dev *dev)
+	/*
+	 * Wait for those devices (Ex: Intel 750 NVMe) that are not ready yet
+	 * and responding with CRS statuses for the configuration space
+	 * requests.
+	 */
+	pci_dev_wait(dev, "Switch to D0", PCIE_RESET_READY_POLL_MS);
 	return pci_raw_set_power_state(dev, PCI_D0);