usb-option-re-add-novatelwireless_product_hspa_highspeed-to-option_id-array.patch
usb-sierra-add-support-for-sierra-wireless-mc7710.patch
usb-don-t-clear-urb-dev-in-scatter-gather-library.patch
+xhci-don-t-re-enable-ie-constantly.patch
+xhci-don-t-write-zeroed-pointers-to-xhc-registers.patch
+xhci-restore-event-ring-dequeue-pointer-on-resume.patch
+xhci-correct-the-define-xhci_legacy_disable_smi.patch
--- /dev/null
+From 95018a53f7653e791bba1f54c8d75d9cb700d1bd Mon Sep 17 00:00:00 2001
+From: Alex He <alex.he@amd.com>
+Date: Fri, 30 Mar 2012 10:21:38 +0800
+Subject: xHCI: Correct the #define XHCI_LEGACY_DISABLE_SMI
+
+From: Alex He <alex.he@amd.com>
+
+commit 95018a53f7653e791bba1f54c8d75d9cb700d1bd upstream.
+
+Re-define XHCI_LEGACY_DISABLE_SMI and used it in right way. All SMI enable
+bits will be cleared to zero and flag bits 29:31 are also cleared to zero.
+Other bits should be presvered as Table 146.
+
+This patch should be backported to kernels as old as 2.6.31.
+
+Signed-off-by: Alex He <alex.he@amd.com>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/pci-quirks.c | 10 +++++++---
+ drivers/usb/host/xhci-ext-caps.h | 5 +++--
+ 2 files changed, 10 insertions(+), 5 deletions(-)
+
+--- a/drivers/usb/host/pci-quirks.c
++++ b/drivers/usb/host/pci-quirks.c
+@@ -824,9 +824,13 @@ static void __devinit quirk_usb_handoff_
+ }
+ }
+
+- /* Disable any BIOS SMIs */
+- writel(XHCI_LEGACY_DISABLE_SMI,
+- base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
++ val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
++ /* Mask off (turn off) any enabled SMIs */
++ val &= XHCI_LEGACY_DISABLE_SMI;
++ /* Mask all SMI events bits, RW1C */
++ val |= XHCI_LEGACY_SMI_EVENTS;
++ /* Disable any BIOS SMIs and clear all SMI events*/
++ writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
+
+ if (usb_is_intel_switchable_xhci(pdev))
+ usb_enable_xhci_ports(pdev);
+--- a/drivers/usb/host/xhci-ext-caps.h
++++ b/drivers/usb/host/xhci-ext-caps.h
+@@ -62,8 +62,9 @@
+ /* USB Legacy Support Control and Status Register - section 7.1.2 */
+ /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */
+ #define XHCI_LEGACY_CONTROL_OFFSET (0x04)
+-/* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */
+-#define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17))
++/* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */
++#define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17))
++#define XHCI_LEGACY_SMI_EVENTS (0x7 << 29)
+
+ /* command register values to disable interrupts and halt the HC */
+ /* start/stop HC execution - do not write unless HC is halted*/
--- /dev/null
+From 4e833c0b87a30798e67f06120cecebef6ee9644c Mon Sep 17 00:00:00 2001
+From: Felipe Balbi <balbi@ti.com>
+Date: Thu, 15 Mar 2012 16:37:08 +0200
+Subject: xhci: don't re-enable IE constantly
+
+From: Felipe Balbi <balbi@ti.com>
+
+commit 4e833c0b87a30798e67f06120cecebef6ee9644c upstream.
+
+While we're at that, define IMAN bitfield to aid readability.
+
+The interrupt enable bit should be set once on driver init, and we
+shouldn't need to continually re-enable it. Commit c21599a3 introduced
+a read of the irq_pending register, and that allows us to preserve the
+state of the IE bit. Before that commit, we were blindly writing 0x3 to
+the register.
+
+This patch should be backported to kernels as old as 2.6.36, or ones
+that contain the commit c21599a36165dbc78b380846b254017a548b9de5 "USB:
+xhci: Reduce reads and writes of interrupter registers".
+
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-ring.c | 2 +-
+ drivers/usb/host/xhci.h | 4 ++++
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -2352,7 +2352,7 @@ hw_died:
+ u32 irq_pending;
+ /* Acknowledge the PCI interrupt */
+ irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending);
+- irq_pending |= 0x3;
++ irq_pending |= IMAN_IP;
+ xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending);
+ }
+
+--- a/drivers/usb/host/xhci.h
++++ b/drivers/usb/host/xhci.h
+@@ -205,6 +205,10 @@ struct xhci_op_regs {
+ #define CMD_PM_INDEX (1 << 11)
+ /* bits 12:31 are reserved (and should be preserved on writes). */
+
++/* IMAN - Interrupt Management Register */
++#define IMAN_IP (1 << 1)
++#define IMAN_IE (1 << 0)
++
+ /* USBSTS - USB status - status bitmasks */
+ /* HC not running - set to 1 when run/stop bit is cleared. */
+ #define STS_HALT XHCI_STS_HALT
--- /dev/null
+From 159e1fcc9a60fc7daba23ee8fcdb99799de3fe84 Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Fri, 16 Mar 2012 13:09:39 -0700
+Subject: xhci: Don't write zeroed pointers to xHC registers.
+
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+
+commit 159e1fcc9a60fc7daba23ee8fcdb99799de3fe84 upstream.
+
+When xhci_mem_cleanup() is called, we can't be sure if the xHC is
+actually halted. We can ask the xHC to halt by writing to the RUN bit
+in the command register, but that might timeout due to a HW hang.
+
+If the host controller is still running, we should not write zeroed
+values to the event ring dequeue pointers or base tables, the DCBAA
+pointers, or the command ring pointers. Eric Fu reports his VIA VL800
+host accesses the event ring pointers after a failed register restore on
+resume from suspend. The hypothesis is that the host never actually
+halted before the register write to change the event ring pointer to
+zero.
+
+Remove all writes of zeroed values to pointer registers in
+xhci_mem_cleanup(). Instead, make all callers of the function reset the
+host controller first, which will reset those registers to zero.
+xhci_mem_init() is the only caller that doesn't first halt and reset the
+host controller before calling xhci_mem_cleanup().
+
+This should be backported to kernels as old as 2.6.32.
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Tested-by: Elric Fu <elricfu1@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-mem.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -1509,11 +1509,6 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ int i;
+
+ /* Free the Event Ring Segment Table and the actual Event Ring */
+- if (xhci->ir_set) {
+- xhci_writel(xhci, 0, &xhci->ir_set->erst_size);
+- xhci_write_64(xhci, 0, &xhci->ir_set->erst_base);
+- xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue);
+- }
+ size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
+ if (xhci->erst.entries)
+ pci_free_consistent(pdev, size,
+@@ -1525,7 +1520,6 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ xhci->event_ring = NULL;
+ xhci_dbg(xhci, "Freed event ring\n");
+
+- xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring);
+ if (xhci->cmd_ring)
+ xhci_ring_free(xhci, xhci->cmd_ring);
+ xhci->cmd_ring = NULL;
+@@ -1554,7 +1548,6 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ xhci->medium_streams_pool = NULL;
+ xhci_dbg(xhci, "Freed medium stream array pool\n");
+
+- xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr);
+ if (xhci->dcbaa)
+ pci_free_consistent(pdev, sizeof(*xhci->dcbaa),
+ xhci->dcbaa, xhci->dcbaa->dma);
+@@ -2123,6 +2116,8 @@ int xhci_mem_init(struct xhci_hcd *xhci,
+
+ fail:
+ xhci_warn(xhci, "Couldn't initialize memory\n");
++ xhci_halt(xhci);
++ xhci_reset(xhci);
+ xhci_mem_cleanup(xhci);
+ return -ENOMEM;
+ }
--- /dev/null
+From fb3d85bc7193f23c9a564502df95564c49a32c91 Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Fri, 16 Mar 2012 13:27:39 -0700
+Subject: xhci: Restore event ring dequeue pointer on resume.
+
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+
+commit fb3d85bc7193f23c9a564502df95564c49a32c91 upstream.
+
+The xhci_save_registers() function saved the event ring dequeue pointer
+in the s3 register structure, but xhci_restore_registers() never
+restored it. No other code in the xHCI successful resume path would
+ever restore it either. Fix that.
+
+This should be backported to kernels as old as 2.6.37, that contain the
+commit 5535b1d5f8885695c6ded783c692e3c0d0eda8ca "USB: xHCI: PCI power
+management implementation".
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Tested-by: Elric Fu <elricfu1@gmail.com>
+Cc: Andiry Xu <andiry.xu@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -627,6 +627,7 @@ static void xhci_restore_registers(struc
+ xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control);
+ xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size);
+ xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base);
++ xhci_write_64(xhci, xhci->s3.erst_dequeue, &xhci->ir_set->erst_dequeue);
+ }
+
+ static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci)