aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/quirks.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-06-08 08:40:04 +0200
committerGerd Hoffmann <kraxel@redhat.com>2023-01-06 06:27:56 +0100
commitb47999765b6530d9e5a9cada531e279612a84493 (patch)
treeca686e0e9fa2cb5e61d5a615849991dcbd68a4da /drivers/pci/quirks.c
parent5cfc1b49a480b6425552be445f56c05dceff8b29 (diff)
downloadlinux-b47999765b6530d9e5a9cada531e279612a84493.tar.gz
[debug] reset_xhci_dev
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r--drivers/pci/quirks.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index d29f61bb5680..dc107f6cbef2 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3926,6 +3926,38 @@ reset_complete:
return 0;
}
+#define XHCI_CMD_RESET (1<<0)
+
+static int reset_xhci_dev(struct pci_dev *dev, int probe)
+{
+ void __iomem *mmio;
+ unsigned long timeout;
+ u32 opregs, cmd;
+
+ if (probe)
+ return 0;
+
+ mmio = pci_iomap(dev, 0, 0);
+ if (!mmio)
+ return -ENOMEM;
+
+ opregs = ioread8(mmio);
+ cmd = XHCI_CMD_RESET;
+ iowrite32(cmd, mmio + opregs);
+ timeout = jiffies + msecs_to_jiffies(250);
+ do {
+ cmd = ioread32(mmio + opregs);
+ if ((cmd & XHCI_CMD_RESET) == 0)
+ goto reset_complete;
+ msleep(10);
+ } while (time_before(jiffies, timeout));
+ pci_warn(dev, "timeout during reset\n");
+
+reset_complete:
+ pci_iounmap(dev, mmio);
+ return 0;
+}
+
#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed
#define PCI_DEVICE_ID_INTEL_IVB_M_VGA 0x0156
#define PCI_DEVICE_ID_INTEL_IVB_M2_VGA 0x0166
@@ -4128,6 +4160,8 @@ int pci_dev_specific_reset(struct pci_dev *dev, bool probe)
if (dev->class == PCI_CLASS_SERIAL_USB_EHCI)
reset_ehci_dev(dev, probe);
+ if (dev->class == PCI_CLASS_SERIAL_USB_XHCI)
+ reset_xhci_dev(dev, probe);
return -ENOTTY;
}