Patchworkβ [2/3] PCI: add Intel USB specific reset method.

login
register
about
Submitter Dexuan Cui
Date 2009-11-06 09:24:56
Message ID <1257499497-9186-2-git-send-email-dexuan.cui@intel.com>
Download mbox | patch
Permalink /patch/58024/
State New
Headers show

Comments

Dexuan Cui - 2009-11-06 09:24:56
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
---
 drivers/pci/quirks.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

Patch

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index dfc734e..aa5dc79 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2578,7 +2578,29 @@  void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
  * reset a single function if other methods (e.g. FLR, PM D0->D3) are
  * not available.
  */
+static int reset_intel_generic_dev(struct pci_dev *dev, int probe)
+{
+	int pos;
+
+	/* only implement the function for PCI_CLASS_SERIAL_USB at present */
+	if (dev->class != PCI_CLASS_SERIAL_USB)
+		return -ENOTTY;
+
+	pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
+	if (!pos)
+		return -ENOTTY;
+
+	if (probe)
+		return 0;
+
+	pci_write_config_byte(dev, pos + 0x4, 1);
+	msleep(100);
+
+	return 0;
+}
+
 struct pci_dev_reset_methods pci_dev_reset_methods[] = {
+	{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, reset_intel_generic_dev },
 	{ 0 }
 };
 #else