usb-gadget-fsl_udc_core-dtd-s-next-dtd-pointer-need-to-be-updated-once-written.patch
usb-add-usb_quirk_reset_resume-for-m-audio-88es.patch
xhci-add-lynx-point-to-list-of-intel-switchable-hosts.patch
+xhci-avoid-dead-ports-when-config_usb_xhci_hcd-n.patch
+usb-xhci-handle-comp_tx_err-for-isoc-tds.patch
+xhci-reset-reserved-command-ring-trbs-on-cleanup.patch
+xhci-add-new-short-tx-quirk-for-fresco-logic-host.patch
+usb-fix-resource-leak-in-xhci-power-loss-path.patch
+usbcore-enable-usb2-lpm-if-port-suspend-fails.patch
--- /dev/null
+From f8a9e72d125f4e00ec529ba67b674321a1f3bf31 Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oneukum@suse.de>
+Date: Thu, 10 May 2012 10:19:21 +0200
+Subject: USB: fix resource leak in xhci power loss path
+
+From: Oliver Neukum <oneukum@suse.de>
+
+commit f8a9e72d125f4e00ec529ba67b674321a1f3bf31 upstream.
+
+Some more data structures must be freed and counters
+reset if an XHCI controller has lost power. The failure
+to do so renders some chips inoperative after a certain number
+of S4 cycles.
+
+This patch should be backported to kernels as old as 3.2,
+that contain the commits c29eea621900f18287d50519f72cb9113746d75a
+"xhci: Implement HS/FS/LS bandwidth checking." and
+commit 839c817ce67178ca3c7c7ad534c571bba1e69ebe
+"xhci: Implement HS/FS/LS bandwidth checking."
+
+Signed-off-by: Oliver Neukum <oneukum@suse.de>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-mem.c | 26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -1685,6 +1685,14 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ {
+ struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
+ struct dev_info *dev_info, *next;
++ struct list_head *tt_list_head;
++ struct list_head *tt;
++ struct list_head *endpoints;
++ struct list_head *ep, *q;
++ struct xhci_tt_bw_info *tt_info;
++ struct xhci_interval_bw_table *bwt;
++ struct xhci_virt_ep *virt_ep;
++
+ unsigned long flags;
+ int size;
+ int i;
+@@ -1744,8 +1752,26 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ }
+ spin_unlock_irqrestore(&xhci->lock, flags);
+
++ bwt = &xhci->rh_bw->bw_table;
++ for (i = 0; i < XHCI_MAX_INTERVAL; i++) {
++ endpoints = &bwt->interval_bw[i].endpoints;
++ list_for_each_safe(ep, q, endpoints) {
++ virt_ep = list_entry(ep, struct xhci_virt_ep, bw_endpoint_list);
++ list_del(&virt_ep->bw_endpoint_list);
++ kfree(virt_ep);
++ }
++ }
++
++ tt_list_head = &xhci->rh_bw->tts;
++ list_for_each_safe(tt, q, tt_list_head) {
++ tt_info = list_entry(tt, struct xhci_tt_bw_info, tt_list);
++ list_del(tt);
++ kfree(tt_info);
++ }
++
+ xhci->num_usb2_ports = 0;
+ xhci->num_usb3_ports = 0;
++ xhci->num_active_eps = 0;
+ kfree(xhci->usb2_ports);
+ kfree(xhci->usb3_ports);
+ kfree(xhci->port_array);
--- /dev/null
+From 9c745995ae5c4ff787f34a359de908facc11ee00 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Mon, 23 Apr 2012 15:06:09 +0200
+Subject: usb-xhci: Handle COMP_TX_ERR for isoc tds
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 9c745995ae5c4ff787f34a359de908facc11ee00 upstream.
+
+While testing unplugging an UVC HD webcam with usb-redirection (so through
+usbdevfs), my userspace usb-redir code was getting a value of -1 in
+iso_frame_desc[n].status, which according to Documentation/usb/error-codes.txt
+is not a valid value.
+
+The source of this -1 is the default case in xhci-ring.c:process_isoc_td()
+adding a kprintf there showed the value of trb_comp_code to be COMP_TX_ERR
+in this case, so this patch adds handling for that completion code to
+process_isoc_td().
+
+This was observed and tested with the following xhci controller:
+1033:0194 NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)
+
+Note: I also wonder if setting frame->status to -1 (-EPERM) is the best we can
+do, but since I cannot come up with anything better I've left that as is.
+
+This patch should be backported to kernels as old as 2.6.36, which contain the
+commit 04e51901dd44f40a5a385ced897f6bca87d5f40a "USB: xHCI: Isochronous
+transfer implementation".
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.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 | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -1739,6 +1739,7 @@ static int process_isoc_td(struct xhci_h
+ break;
+ case COMP_DEV_ERR:
+ case COMP_STALL:
++ case COMP_TX_ERR:
+ frame->status = -EPROTO;
+ skip_td = true;
+ break;
--- /dev/null
+From c3e751e4f4754793bb52bd5ae30e9cc027edbb12 Mon Sep 17 00:00:00 2001
+From: Andiry Xu <andiry.xu@gmail.com>
+Date: Sat, 5 May 2012 00:50:10 +0800
+Subject: usbcore: enable USB2 LPM if port suspend fails
+
+From: Andiry Xu <andiry.xu@gmail.com>
+
+commit c3e751e4f4754793bb52bd5ae30e9cc027edbb12 upstream.
+
+USB2 LPM is disabled when device begin to suspend and enabled after device
+is resumed. That's because USB spec does not define the transition from
+U1/U2 state to U3 state.
+
+If usb_port_suspend() fails, usb_port_resume() is never called, and USB2 LPM
+is disabled in this situation. Enable USB2 LPM if port suspend fails.
+
+This patch should be backported to kernels as old as 3.2, that contain
+the commit 65580b4321eb36f16ae8b5987bfa1bb948fc5112 "xHCI: set USB2
+hardware LPM".
+
+Signed-off-by: Andiry Xu <andiry.xu@gmail.com>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/hub.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -2419,6 +2419,10 @@ int usb_port_suspend(struct usb_device *
+ NULL, 0,
+ USB_CTRL_SET_TIMEOUT);
+
++ /* Try to enable USB2 hardware LPM again */
++ if (udev->usb2_hw_lpm_capable == 1)
++ usb_set_usb2_hardware_lpm(udev, 1);
++
+ /* System sleep transitions should never fail */
+ if (!PMSG_IS_AUTO(msg))
+ status = 0;
--- /dev/null
+From 1530bbc6272d9da1e39ef8e06190d42c13a02733 Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Tue, 8 May 2012 09:22:49 -0700
+Subject: xhci: Add new short TX quirk for Fresco Logic host.
+
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+
+commit 1530bbc6272d9da1e39ef8e06190d42c13a02733 upstream.
+
+Sergio reported that when he recorded audio from a USB headset mic
+plugged into the USB 3.0 port on his ASUS N53SV-DH72, the audio sounded
+"robotic". When plugged into the USB 2.0 port under EHCI on the same
+laptop, the audio sounded fine. The device is:
+
+Bus 002 Device 004: ID 046d:0a0c Logitech, Inc. Clear Chat Comfort USB Headset
+
+The problem was tracked down to the Fresco Logic xHCI host controller
+not correctly reporting short transfers on isochronous IN endpoints.
+The driver would submit a 96 byte transfer, the device would only send
+88 or 90 bytes, and the xHCI host would report the transfer had a
+"successful" completion code, with an untransferred buffer length of 8
+or 6 bytes.
+
+The successful completion code and non-zero untransferred length is a
+contradiction. The xHCI host is supposed to only mark a transfer as
+successful if all the bytes are transferred. Otherwise, the transfer
+should be marked with a short packet completion code. Without the EHCI
+bus trace, we wouldn't know whether the xHCI driver should trust the
+completion code or the untransferred length. With it, we know to trust
+the untransferred length.
+
+Add a new xHCI quirk for the Fresco Logic host controller. If a
+transfer is reported as successful, but the untransferred length is
+non-zero, print a warning. For the Fresco Logic host, change the
+completion code to COMP_SHORT_TX and process the transfer like a short
+transfer.
+
+This should be backported to stable kernels that contain the commit
+f5182b4155b9d686c5540a6822486400e34ddd98 "xhci: Disable MSI for some
+Fresco Logic hosts." That commit was marked for stable kernels as old
+as 2.6.36.
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Reported-by: Sergio Correia <lists@uece.net>
+Tested-by: Sergio Correia <lists@uece.net>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-pci.c | 1 +
+ drivers/usb/host/xhci-ring.c | 20 +++++++++++++++++---
+ drivers/usb/host/xhci.h | 1 +
+ 3 files changed, 19 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/host/xhci-pci.c
++++ b/drivers/usb/host/xhci-pci.c
+@@ -72,6 +72,7 @@ static void xhci_pci_quirks(struct devic
+ xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u "
+ "has broken MSI implementation\n",
+ pdev->revision);
++ xhci->quirks |= XHCI_TRUST_TX_LENGTH;
+ }
+
+ if (pdev->vendor == PCI_VENDOR_ID_NEC)
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -1722,8 +1722,12 @@ static int process_isoc_td(struct xhci_h
+ /* handle completion code */
+ switch (trb_comp_code) {
+ case COMP_SUCCESS:
+- frame->status = 0;
+- break;
++ if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) {
++ frame->status = 0;
++ break;
++ }
++ if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
++ trb_comp_code = COMP_SHORT_TX;
+ case COMP_SHORT_TX:
+ frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ?
+ -EREMOTEIO : 0;
+@@ -1820,13 +1824,16 @@ static int process_bulk_intr_td(struct x
+ switch (trb_comp_code) {
+ case COMP_SUCCESS:
+ /* Double check that the HW transferred everything. */
+- if (event_trb != td->last_trb) {
++ if (event_trb != td->last_trb ||
++ TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
+ xhci_warn(xhci, "WARN Successful completion "
+ "on short TX\n");
+ if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
+ *status = -EREMOTEIO;
+ else
+ *status = 0;
++ if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
++ trb_comp_code = COMP_SHORT_TX;
+ } else {
+ *status = 0;
+ }
+@@ -1985,6 +1992,13 @@ static int handle_tx_event(struct xhci_h
+ * transfer type
+ */
+ case COMP_SUCCESS:
++ if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
++ break;
++ if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
++ trb_comp_code = COMP_SHORT_TX;
++ else
++ xhci_warn(xhci, "WARN Successful completion on short TX: "
++ "needs XHCI_TRUST_TX_LENGTH quirk?\n");
+ case COMP_SHORT_TX:
+ break;
+ case COMP_STOP:
+--- a/drivers/usb/host/xhci.h
++++ b/drivers/usb/host/xhci.h
+@@ -1466,6 +1466,7 @@ struct xhci_hcd {
+ #define XHCI_RESET_ON_RESUME (1 << 7)
+ #define XHCI_SW_BW_CHECKING (1 << 8)
+ #define XHCI_AMD_0x96_HOST (1 << 9)
++#define XHCI_TRUST_TX_LENGTH (1 << 10)
+ unsigned int num_active_eps;
+ unsigned int limit_active_eps;
+ /* There are two roothubs to keep track of bus suspend info for */
--- /dev/null
+From 51c9e6c7732b67769c0a514d31f505e49fa82dd4 Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Mon, 16 Apr 2012 10:56:47 -0700
+Subject: xhci: Avoid dead ports when CONFIG_USB_XHCI_HCD=n
+
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+
+commit 51c9e6c7732b67769c0a514d31f505e49fa82dd4 upstream.
+
+If the user chooses to say "no" to CONFIG_USB_XHCI_HCD on a system
+with an Intel Panther Point chipset, the PCI quirks code or the EHCI
+driver will switch the ports over to the xHCI host, but the xHCI driver
+will never load. The ports will be powered off and seem "dead" to the
+user.
+
+Fix this by only switching the ports over if CONFIG_USB_XHCI_HCD is
+either compiled in, or compiled as a module.
+
+This patch should be backported to stable kernels as old as 3.0,
+that contain commit 69e848c2090aebba5698a1620604c7dccb448684
+"Intel xhci: Support EHCI/xHCI port switching."
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Reported-by: Eric Anholt <eric.anholt@intel.com>
+Reported-by: David Bein <d.bein@f5.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/pci-quirks.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/drivers/usb/host/pci-quirks.c
++++ b/drivers/usb/host/pci-quirks.c
+@@ -9,6 +9,7 @@
+ */
+
+ #include <linux/types.h>
++#include <linux/kconfig.h>
+ #include <linux/kernel.h>
+ #include <linux/pci.h>
+ #include <linux/init.h>
+@@ -758,6 +759,19 @@ void usb_enable_xhci_ports(struct pci_de
+ {
+ u32 ports_available;
+
++ /* Don't switchover the ports if the user hasn't compiled the xHCI
++ * driver. Otherwise they will see "dead" USB ports that don't power
++ * the devices.
++ */
++ if (!IS_ENABLED(CONFIG_USB_XHCI_HCD)) {
++ dev_warn(&xhci_pdev->dev,
++ "CONFIG_USB_XHCI_HCD is turned off, "
++ "defaulting to EHCI.\n");
++ dev_warn(&xhci_pdev->dev,
++ "USB 3.0 devices will work at USB 2.0 speeds.\n");
++ return;
++ }
++
+ ports_available = 0xffffffff;
+ /* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable
+ * Register, to turn on SuperSpeed terminations for all
--- /dev/null
+From 33b2831ac870d50cc8e01c317b07fb1e69c13fe1 Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Tue, 8 May 2012 07:09:26 -0700
+Subject: xhci: Reset reserved command ring TRBs on cleanup.
+
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+
+commit 33b2831ac870d50cc8e01c317b07fb1e69c13fe1 upstream.
+
+When the xHCI driver needs to clean up memory (perhaps due to a failed
+register restore on resume from S3 or resume from S4), it needs to reset
+the number of reserved TRBs on the command ring to zero. Otherwise,
+several resume cycles (about 30) with a UAS device attached will
+continually increment the number of reserved TRBs, until all command
+submissions fail because there isn't enough room on the command ring.
+
+This patch should be backported to kernels as old as 2.6.32,
+that contain the commit 913a8a344ffcaf0b4a586d6662a2c66a7106557d
+"USB: xhci: Change how xHCI commands are handled."
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-mem.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -1701,6 +1701,7 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ xhci->event_ring = NULL;
+ xhci_dbg(xhci, "Freed event ring\n");
+
++ xhci->cmd_ring_reserved_trbs = 0;
+ if (xhci->cmd_ring)
+ xhci_ring_free(xhci, xhci->cmd_ring);
+ xhci->cmd_ring = NULL;