summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-08-12 15:07:03 -0600
committerBjorn Helgaas <bhelgaas@google.com>2013-08-12 15:07:03 -0600
commit63ef41811b86432101b4627ff07c9671f93a483f (patch)
treedc34a1b936e6e859d9ab514fc255955acaa2e85f /drivers/pci/pci.c
parentdf99d6a4e9a334a90980d752608ddf5a5fb59719 (diff)
parent4d708ab0c88512a3bea12f1ad68539fbe0d11d1a (diff)
downloadblackbird-op-linux-63ef41811b86432101b4627ff07c9671f93a483f.tar.gz
blackbird-op-linux-63ef41811b86432101b4627ff07c9671f93a483f.zip
Merge branch 'pci/vipul-chelsio-reset-v2' into next
* pci/vipul-chelsio-reset-v2: PCI: Use pci_wait_for_pending_transaction() instead of for loop bnx2x: Use pci_wait_for_pending_transaction() instead of for loop PCI: Chelsio quirk: Enable Bus Master during Function-Level Reset PCI: Add pci_wait_for_pending_transaction()
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a8d5fd064264..7d6ce2ec04ec 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3159,19 +3159,17 @@ int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask)
}
EXPORT_SYMBOL(pci_set_dma_seg_boundary);
-static int pcie_flr(struct pci_dev *dev, int probe)
+/**
+ * pci_wait_for_pending_transaction - waits for pending transaction
+ * @dev: the PCI device to operate on
+ *
+ * Return 0 if transaction is pending 1 otherwise.
+ */
+int pci_wait_for_pending_transaction(struct pci_dev *dev)
{
int i;
- u32 cap;
u16 status;
- pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
- if (!(cap & PCI_EXP_DEVCAP_FLR))
- return -ENOTTY;
-
- if (probe)
- return 0;
-
/* Wait for Transaction Pending bit clean */
for (i = 0; i < 4; i++) {
if (i)
@@ -3179,13 +3177,27 @@ static int pcie_flr(struct pci_dev *dev, int probe)
pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status);
if (!(status & PCI_EXP_DEVSTA_TRPND))
- goto clear;
+ return 1;
}
- dev_err(&dev->dev, "transaction is not cleared; "
- "proceeding with reset anyway\n");
+ return 0;
+}
+EXPORT_SYMBOL(pci_wait_for_pending_transaction);
+
+static int pcie_flr(struct pci_dev *dev, int probe)
+{
+ u32 cap;
+
+ pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
+ if (!(cap & PCI_EXP_DEVCAP_FLR))
+ return -ENOTTY;
+
+ if (probe)
+ return 0;
+
+ if (!pci_wait_for_pending_transaction(dev))
+ dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
-clear:
pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
msleep(100);
OpenPOWER on IntegriCloud