--- /dev/null
+From fea5417579faa777befe2ad4f111e3fa6f2675b1 Mon Sep 17 00:00:00 2001
+From: James Ralston <james.d.ralston@intel.com>
+Date: Fri, 8 Feb 2013 17:34:47 -0800
+Subject: ahci: Add Device IDs for Intel Wellsburg PCH
+
+From: James Ralston <james.d.ralston@intel.com>
+
+commit 151743fd8dfb02956c5184b5f4f0f42677eb75bc upstream.
+
+This patch adds the AHCI-mode SATA Device IDs for the Intel Wellsburg PCH
+
+Signed-off-by: James Ralston <james.d.ralston@intel.com>
+Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/ahci.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -292,6 +292,14 @@ static const struct pci_device_id ahci_p
+ { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */
+ { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */
+ { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */
++ { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */
++ { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */
++ { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */
++ { PCI_VDEVICE(INTEL, 0x8d0e), board_ahci }, /* Wellsburg RAID */
++ { PCI_VDEVICE(INTEL, 0x8d62), board_ahci }, /* Wellsburg AHCI */
++ { PCI_VDEVICE(INTEL, 0x8d64), board_ahci }, /* Wellsburg RAID */
++ { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
++ { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
+
+ /* JMicron 360/1/3/5/6, match class to avoid IDE function */
+ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
--- /dev/null
+From 17318fb39430c776003caddfbd2b6ed6259fff90 Mon Sep 17 00:00:00 2001
+From: James Ralston <james.d.ralston@intel.com>
+Date: Mon, 4 Nov 2013 09:24:58 -0800
+Subject: ahci: Add Device IDs for Intel Wildcat Point-LP
+
+From: James Ralston <james.d.ralston@intel.com>
+
+commit 9f961a5f6efc87a79571d7166257b36af28ffcfe upstream.
+
+This patch adds the AHCI-mode SATA Device IDs for the Intel Wildcat Point-LP PCH.
+
+Signed-off-by: James Ralston <james.d.ralston@intel.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/ahci.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -301,6 +301,10 @@ static const struct pci_device_id ahci_p
+ { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
+ { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
+ { PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */
++ { PCI_VDEVICE(INTEL, 0x9c83), board_ahci }, /* Wildcat Point-LP AHCI */
++ { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */
++ { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */
++ { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */
+
+ /* JMicron 360/1/3/5/6, match class to avoid IDE function */
+ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
--- /dev/null
+From d23288a5a9fb61c0fc58e544fc38c14ef60076c8 Mon Sep 17 00:00:00 2001
+From: Seth Heasley <seth.heasley@intel.com>
+Date: Wed, 19 Jun 2013 16:36:45 -0700
+Subject: ahci: AHCI-mode SATA patch for Intel Coleto Creek DeviceIDs
+
+From: Seth Heasley <seth.heasley@intel.com>
+
+commit 1cfc7df3de10c40ed459e13cce6de616023bf41c upstream.
+
+This patch adds the AHCI-mode SATA DeviceIDs for the Intel Coleto Creek PCH.
+
+Signed-off-by: Seth Heasley <seth.heasley@intel.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/ahci.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -300,6 +300,7 @@ static const struct pci_device_id ahci_p
+ { PCI_VDEVICE(INTEL, 0x8d64), board_ahci }, /* Wellsburg RAID */
+ { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
+ { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
++ { PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */
+
+ /* JMicron 360/1/3/5/6, match class to avoid IDE function */
+ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
--- /dev/null
+From 28009d3918aabba0e0713baa49f8f6367604af51 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 18 Jun 2013 16:14:22 +0200
+Subject: ALSA: hda - Cache the MUX selection for generic HDMI
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit bddee96b5d0db869f47b195fe48c614ca824203c upstream.
+
+When a selection to a converter MUX is changed in hdmi_pcm_open(), it
+should be cached so that the given connection can be restored properly
+at PM resume. We need just to replace the corresponding
+snd_hda_codec_write() call with snd_hda_codec_write_cache().
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_hdmi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -910,7 +910,7 @@ static int hdmi_pcm_open(struct hda_pcm_
+ per_cvt->assigned = 1;
+ hinfo->nid = per_cvt->cvt_nid;
+
+- snd_hda_codec_write(codec, per_pin->pin_nid, 0,
++ snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
+ AC_VERB_SET_CONNECT_SEL,
+ mux_idx);
+ snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
usb-ssu100-fix-use-after-free-in-tiocmiwait.patch
usb-ti_usb_3410_5052-fix-use-after-free-in-tiocmiwait.patch
usb-serial-fix-hang-when-opening-port.patch
+usb-ftdi_sio-enable-two-uart-ports-on-st-microconnect-lite.patch
+usb-dwc3-gadget-free-trb-pool-only-from-epnum-2.patch
+usb-serial-add-option-gtm681w-to-qcserial-device-table.patch
+usb-spcp8x5-fix-device-initialisation-at-open.patch
+usb-pl2303-fix-device-initialisation-at-open.patch
+usb-mos7840-fix-memory-leak-in-open.patch
+usb-mos7840-fix-race-in-register-handling.patch
+usb-adutux-fix-big-endian-device-type-reporting.patch
+usb-ti_usb_3410_5052-fix-big-endian-firmware-handling.patch
+usb-keyspan-fix-null-deref-at-disconnect-and-release.patch
+usb-ohci-allow-runtime-pm-without-system-sleep.patch
+usb-fix-build-error-when-config_pm_sleep-isn-t-enabled.patch
+usb-fix-pm-config-symbol-in-uhci-hcd-ehci-hcd-and-xhci-hcd.patch
+usb-disable-usb-2.0-link-pm-before-device-reset.patch
+usb-dwc3-pci-add-support-for-baytrail.patch
+usb-dwc3-add-support-for-merrifield.patch
+usb-wusbcore-set-the-rpipe-wmaxpacketsize-value-correctly.patch
+usb-wusbcore-change-wa_segs_max-to-a-legal-value.patch
+usb-ftdi_sio-fixed-handling-of-unsupported-csize-setting.patch
+ahci-add-device-ids-for-intel-wellsburg-pch.patch
+ahci-ahci-mode-sata-patch-for-intel-coleto-creek-deviceids.patch
+xhci-don-t-enable-disable-rwe-on-bus-suspend-resume.patch
+ahci-add-device-ids-for-intel-wildcat-point-lp.patch
+usb-hub-clear-port-reset-change-during-init-resume.patch
+xhci-quirk-for-extra-long-delay-for-s4.patch
+xhci-fix-spurious-wakeups-after-s5-on-haswell.patch
+xhci-limit-the-spurious-wakeup-fix-only-to-hp-machines.patch
+alsa-hda-cache-the-mux-selection-for-generic-hdmi.patch
--- /dev/null
+From 735143e24807a8202d2fde8999eab1c3b761949d Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Sun, 11 Aug 2013 16:49:22 +0200
+Subject: USB: adutux: fix big-endian device-type reporting
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit d482b9d558602a9cacab063b1c8779f9b5214da7 upstream.
+
+Make sure the reported device-type on big-endian machines is the same as
+on little-endian ones.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/misc/adutux.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/misc/adutux.c
++++ b/drivers/usb/misc/adutux.c
+@@ -829,7 +829,7 @@ static int adu_probe(struct usb_interfac
+
+ /* let the user know what node this device is now attached to */
+ dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n",
+- udev->descriptor.idProduct, dev->serial_number,
++ le16_to_cpu(udev->descriptor.idProduct), dev->serial_number,
+ (dev->minor - ADU_MINOR_BASE));
+ exit:
+ dbg(2," %s : leave, return value %p (dev)", __func__, dev);
--- /dev/null
+From 7e6337b694966dd7d3b9d904c830b48a4e6a80a6 Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Mon, 30 Sep 2013 17:26:29 +0300
+Subject: usb: Disable USB 2.0 Link PM before device reset.
+
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+
+commit dcc01c0864823f91c3bf3ffca6613e2351702b87 upstream.
+
+Before the USB core resets a device, we need to disable the L1 timeout
+for the roothub, if USB 2.0 Link PM is enabled. Otherwise the port may
+transition into L1 in between descriptor fetches, before we know if the
+USB device descriptors changed. LPM will be re-enabled after the
+full device descriptors are fetched, and we can confirm the device still
+supports USB 2.0 LPM after the reset.
+
+We don't need to wait for the USB device to exit L1 before resetting the
+device, since the xHCI roothub port diagrams show a transition to the
+Reset state from any of the Ux states (see Figure 34 in the 2012-08-14
+xHCI specification update).
+
+This patch should be backported to kernels as old as 3.2, that contain
+the commit 65580b4321eb36f16ae8b5987bfa1bb948fc5112 "xHCI: set USB2
+hardware LPM". That was the first commit to enable USB 2.0
+hardware-driven Link Power Management.
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/hub.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -4139,6 +4139,12 @@ static int usb_reset_and_verify_device(s
+ }
+ parent_hub = hdev_to_hub(parent_hdev);
+
++ /* Disable USB2 hardware LPM.
++ * It will be re-enabled by the enumeration process.
++ */
++ if (udev->usb2_hw_lpm_enabled == 1)
++ usb_set_usb2_hardware_lpm(udev, 0);
++
+ set_bit(port1, parent_hub->busy_bits);
+ for (i = 0; i < SET_CONFIG_TRIES; ++i) {
+
--- /dev/null
+From 798761949ee8ddb4a25888cf7c0722fbacbc70cc Mon Sep 17 00:00:00 2001
+From: David Cohen <david.a.cohen@linux.intel.com>
+Date: Thu, 26 Sep 2013 13:01:44 -0700
+Subject: usb: dwc3: add support for Merrifield
+
+From: David Cohen <david.a.cohen@linux.intel.com>
+
+commit 85601f8cf67c56a561a6dd5e130e65fdc179047d upstream.
+
+Add PCI id for Intel Merrifield
+
+Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/dwc3-pci.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/dwc3/dwc3-pci.c
++++ b/drivers/usb/dwc3/dwc3-pci.c
+@@ -48,6 +48,7 @@
+ #define PCI_VENDOR_ID_SYNOPSYS 0x16c3
+ #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
+ #define PCI_DEVICE_ID_INTEL_BYT 0x0f37
++#define PCI_DEVICE_ID_INTEL_MRFLD 0x119e
+
+ struct dwc3_pci {
+ struct device *dev;
+@@ -157,6 +158,7 @@ static DEFINE_PCI_DEVICE_TABLE(dwc3_pci_
+ PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3),
+ },
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
++ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
+ { } /* Terminating Entry */
+ };
+ MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
--- /dev/null
+From 5b9ce8be3223c6d68e7581b0de59f6a92ccdd02d Mon Sep 17 00:00:00 2001
+From: George Cherian <george.cherian@ti.com>
+Date: Mon, 27 May 2013 14:35:49 +0530
+Subject: usb: dwc3: gadget: free trb pool only from epnum 2
+
+From: George Cherian <george.cherian@ti.com>
+
+commit 5bf8fae33d14cc5c3c53a926f9079f92c8b082b0 upstream.
+
+we never allocate a TRB pool for physical endpoints
+0 and 1 so trying to free it (a invalid TRB pool pointer)
+will lead us in a warning while removing dwc3.ko module.
+
+In order to fix the situation, all we have to do is skip
+dwc3_free_trb_pool() for physical endpoints 0 and 1 just
+as we while deleting endpoints from the endpoints list.
+
+Signed-off-by: George Cherian <george.cherian@ti.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/gadget.c | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/dwc3/gadget.c
++++ b/drivers/usb/dwc3/gadget.c
+@@ -1483,10 +1483,19 @@ static void dwc3_gadget_free_endpoints(s
+
+ for (epnum = 0; epnum < DWC3_ENDPOINTS_NUM; epnum++) {
+ dep = dwc->eps[epnum];
+- dwc3_free_trb_pool(dep);
+-
+- if (epnum != 0 && epnum != 1)
++ /*
++ * Physical endpoints 0 and 1 are special; they form the
++ * bi-directional USB endpoint 0.
++ *
++ * For those two physical endpoints, we don't allocate a TRB
++ * pool nor do we add them the endpoints list. Due to that, we
++ * shouldn't do these two operations otherwise we would end up
++ * with all sorts of bugs when removing dwc3.ko.
++ */
++ if (epnum != 0 && epnum != 1) {
++ dwc3_free_trb_pool(dep);
+ list_del(&dep->endpoint.ep_list);
++ }
+
+ kfree(dep);
+ }
--- /dev/null
+From b62cd96de3161dfb125a769030eec35a4cab3d3a Mon Sep 17 00:00:00 2001
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Date: Tue, 17 Sep 2013 10:38:13 +0300
+Subject: usb: dwc3: pci: add support for BayTrail
+
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+
+commit b62cd96de3161dfb125a769030eec35a4cab3d3a upstream.
+
+Add PCI id for Intel BayTrail.
+
+Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/dwc3-pci.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/dwc3/dwc3-pci.c
++++ b/drivers/usb/dwc3/dwc3-pci.c
+@@ -47,6 +47,7 @@
+ /* FIXME define these in <linux/pci_ids.h> */
+ #define PCI_VENDOR_ID_SYNOPSYS 0x16c3
+ #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
++#define PCI_DEVICE_ID_INTEL_BYT 0x0f37
+
+ struct dwc3_pci {
+ struct device *dev;
+@@ -155,6 +156,7 @@ static DEFINE_PCI_DEVICE_TABLE(dwc3_pci_
+ PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
+ PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3),
+ },
++ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
+ { } /* Terminating Entry */
+ };
+ MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
--- /dev/null
+From bc96269f72229f0b175bc6716040331650656b41 Mon Sep 17 00:00:00 2001
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 30 Aug 2013 10:46:00 -0400
+Subject: USB: fix build error when CONFIG_PM_SLEEP isn't enabled
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 9d8924297cd9c256c23c02abae40202563452453 upstream.
+
+This patch fixes a build error that occurs when CONFIG_PM is enabled
+and CONFIG_PM_SLEEP isn't:
+
+>> drivers/usb/host/ohci-pci.c:294:10: error: 'usb_hcd_pci_pm_ops' undeclared here (not in a function)
+ .pm = &usb_hcd_pci_pm_ops
+
+Since the usb_hcd_pci_pm_ops structure is defined and used when
+CONFIG_PM is enabled, its declaration should not be protected by
+CONFIG_PM_SLEEP.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Reported-by: kbuild test robot <fengguang.wu@intel.com>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/usb/hcd.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/usb/hcd.h
++++ b/include/linux/usb/hcd.h
+@@ -393,7 +393,7 @@ extern int usb_hcd_pci_probe(struct pci_
+ extern void usb_hcd_pci_remove(struct pci_dev *dev);
+ extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
+
+-#ifdef CONFIG_PM_SLEEP
++#ifdef CONFIG_PM
+ extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
+ #endif
+ #endif /* CONFIG_PCI */
--- /dev/null
+From c9e34fa1d28f3e04e9fbe4cdce5aa9a70c4952f6 Mon Sep 17 00:00:00 2001
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Tue, 24 Sep 2013 15:45:25 -0400
+Subject: USB: fix PM config symbol in uhci-hcd, ehci-hcd, and xhci-hcd
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit f875fdbf344b9fde207f66b392c40845dd7e5aa6 upstream.
+
+Since uhci-hcd, ehci-hcd, and xhci-hcd support runtime PM, the .pm
+field in their pci_driver structures should be protected by CONFIG_PM
+rather than CONFIG_PM_SLEEP. The corresponding change has already
+been made for ohci-hcd.
+
+Without this change, controllers won't do runtime suspend if system
+suspend or hibernation isn't enabled.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/ehci-pci.c | 2 +-
+ drivers/usb/host/uhci-pci.c | 2 +-
+ drivers/usb/host/xhci-pci.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/host/ehci-pci.c
++++ b/drivers/usb/host/ehci-pci.c
+@@ -549,7 +549,7 @@ static struct pci_driver ehci_pci_driver
+ .remove = usb_hcd_pci_remove,
+ .shutdown = usb_hcd_pci_shutdown,
+
+-#ifdef CONFIG_PM_SLEEP
++#ifdef CONFIG_PM
+ .driver = {
+ .pm = &usb_hcd_pci_pm_ops
+ },
+--- a/drivers/usb/host/uhci-pci.c
++++ b/drivers/usb/host/uhci-pci.c
+@@ -293,7 +293,7 @@ static struct pci_driver uhci_pci_driver
+ .remove = usb_hcd_pci_remove,
+ .shutdown = uhci_shutdown,
+
+-#ifdef CONFIG_PM_SLEEP
++#ifdef CONFIG_PM
+ .driver = {
+ .pm = &usb_hcd_pci_pm_ops
+ },
+--- a/drivers/usb/host/xhci-pci.c
++++ b/drivers/usb/host/xhci-pci.c
+@@ -335,7 +335,7 @@ static struct pci_driver xhci_pci_driver
+ /* suspend and resume implemented later */
+
+ .shutdown = usb_hcd_pci_shutdown,
+-#ifdef CONFIG_PM_SLEEP
++#ifdef CONFIG_PM
+ .driver = {
+ .pm = &usb_hcd_pci_pm_ops
+ },
--- /dev/null
+From ae04c6d22a958d4879c4139ea57dee8a92243e42 Mon Sep 17 00:00:00 2001
+From: Adrian Thomasset <adrian.thomasset@st.com>
+Date: Wed, 24 Apr 2013 11:37:35 +0100
+Subject: USB: ftdi_sio: enable two UART ports on ST Microconnect Lite
+
+From: Adrian Thomasset <adrian.thomasset@st.com>
+
+commit 71d9a2b95fc9c9474d46d764336efd7a5a805555 upstream.
+
+The FT4232H used in the ST Micro Connect Lite has four hi-speed UART ports.
+The first two ports are reserved for the JTAG interface.
+
+We enable by default ports 2 and 3 as UARTs (where port 2 is a
+conventional RS-232 UART)
+
+Signed-off-by: Adrian Thomasset <adrian.thomasset@st.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -1855,8 +1855,11 @@ static int ftdi_8u2232c_probe(struct usb
+ }
+
+ /*
+- * First and second port on STMCLiteadaptors is reserved for JTAG interface
+- * and the forth port for pio
++ * First two ports on JTAG adaptors using an FT4232 such as STMicroelectronics's
++ * ST Micro Connect Lite are reserved for JTAG or other non-UART interfaces and
++ * can be accessed from userspace.
++ * The next two ports are enabled as UARTs by default, where port 2 is
++ * a conventional RS-232 UART.
+ */
+ static int ftdi_stmclite_probe(struct usb_serial *serial)
+ {
+@@ -1865,12 +1868,13 @@ static int ftdi_stmclite_probe(struct us
+
+ dbg("%s", __func__);
+
+- if (interface == udev->actconfig->interface[2])
+- return 0;
++ if (interface == udev->actconfig->interface[0] ||
++ interface == udev->actconfig->interface[1]) {
++ dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
++ return -ENODEV;
++ }
+
+- dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
+-
+- return -ENODEV;
++ return 0;
+ }
+
+ /*
--- /dev/null
+From 75a4cfafc7379ed99dbb85f4b92de7e86a534876 Mon Sep 17 00:00:00 2001
+From: Colin Leitner <colin.leitner@googlemail.com>
+Date: Tue, 5 Nov 2013 18:02:34 +0100
+Subject: USB: ftdi_sio: fixed handling of unsupported CSIZE setting
+
+From: Colin Leitner <colin.leitner@googlemail.com>
+
+commit 8704211f65a2106ba01b6ac9727cdaf9ca11594c upstream.
+
+FTDI UARTs support only 7 or 8 data bits. Until now the ftdi_sio driver would
+only report this limitation for CS6 to dmesg and fail to reflect this fact to
+tcgetattr.
+
+This patch reverts the unsupported CSIZE setting and reports the fact with less
+severance to dmesg for both CS5 and CS6.
+
+To test the patch it's sufficient to call
+
+ stty -F /dev/ttyUSB0 cs5
+
+which will succeed without the patch and report an error with the patch
+applied.
+
+As an additional fix this patch ensures that the control request will always
+include a data bit size.
+
+Signed-off-by: Colin Leitner <colin.leitner@gmail.com>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+[bwh: Backported to 3.2:
+ - Old code is cosmetically different
+ - s/ddev/\&port->dev/]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 31 ++++++++++++++++++++++++-------
+ 1 file changed, 24 insertions(+), 7 deletions(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -2201,6 +2201,20 @@ static void ftdi_set_termios(struct tty_
+ termios->c_cflag |= CRTSCTS;
+ }
+
++ /*
++ * All FTDI UART chips are limited to CS7/8. We won't pretend to
++ * support CS5/6 and revert the CSIZE setting instead.
++ */
++ if ((C_CSIZE(tty) != CS8) && (C_CSIZE(tty) != CS7)) {
++ dev_warn(&port->dev, "requested CSIZE setting not supported\n");
++
++ termios->c_cflag &= ~CSIZE;
++ if (old_termios)
++ termios->c_cflag |= old_termios->c_cflag & CSIZE;
++ else
++ termios->c_cflag |= CS8;
++ }
++
+ cflag = termios->c_cflag;
+
+ if (!old_termios)
+@@ -2237,13 +2251,16 @@ no_skip:
+ } else {
+ urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE;
+ }
+- if (cflag & CSIZE) {
+- switch (cflag & CSIZE) {
+- case CS7: urb_value |= 7; dbg("Setting CS7"); break;
+- case CS8: urb_value |= 8; dbg("Setting CS8"); break;
+- default:
+- dev_err(&port->dev, "CSIZE was set but not CS7-CS8\n");
+- }
++ switch (cflag & CSIZE) {
++ case CS7:
++ urb_value |= 7;
++ dev_dbg(&port->dev, "Setting CS7\n");
++ break;
++ default:
++ case CS8:
++ urb_value |= 8;
++ dev_dbg(&port->dev, "Setting CS8\n");
++ break;
+ }
+
+ /* This is needed by the break command since it uses the same command
--- /dev/null
+From e92aee330837e4911553761490a8fb843f2053a6 Mon Sep 17 00:00:00 2001
+From: Julius Werner <jwerner@chromium.org>
+Date: Tue, 15 Oct 2013 17:45:00 -0700
+Subject: usb: hub: Clear Port Reset Change during init/resume
+
+From: Julius Werner <jwerner@chromium.org>
+
+commit e92aee330837e4911553761490a8fb843f2053a6 upstream.
+
+This patch adds the Port Reset Change flag to the set of bits that are
+preemptively cleared on init/resume of a hub. In theory this bit should
+never be set unexpectedly... in practice it can still happen if BIOS,
+SMM or ACPI code plays around with USB devices without cleaning up
+correctly. This is especially dangerous for XHCI root hubs, which don't
+generate any more Port Status Change Events until all change bits are
+cleared, so this is a good precaution to have (similar to how it's
+already done for the Warm Port Reset Change flag).
+
+Signed-off-by: Julius Werner <jwerner@chromium.org>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+[bwh: Backported to 3.2:
+ - Adjust context
+ - s/usb_clear_port_feature/clear_port_feature/]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+[yangyl: Backported to 3.4: Adjust context]
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/core/hub.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -920,6 +920,11 @@ static void hub_activate(struct usb_hub
+ clear_port_feature(hub->hdev, port1,
+ USB_PORT_FEAT_C_ENABLE);
+ }
++ if (portchange & USB_PORT_STAT_C_RESET) {
++ need_debounce_delay = true;
++ clear_port_feature(hub->hdev, port1,
++ USB_PORT_FEAT_C_RESET);
++ }
+ if ((portchange & USB_PORT_STAT_C_BH_RESET) &&
+ hub_is_superspeed(hub->hdev)) {
+ need_debounce_delay = true;
--- /dev/null
+From 8ab959a23fae461cf05093cfd5b0e6ebdc50aa87 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Tue, 13 Aug 2013 13:27:35 +0200
+Subject: USB: keyspan: fix null-deref at disconnect and release
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit ff8a43c10f1440f07a5faca0c1556921259f7f76 upstream.
+
+Make sure to fail properly if the device is not accepted during attach
+in order to avoid null-pointer derefs (of missing interface private
+data) at disconnect or release.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/keyspan.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/serial/keyspan.c
++++ b/drivers/usb/serial/keyspan.c
+@@ -2486,7 +2486,7 @@ static int keyspan_startup(struct usb_se
+ if (d_details == NULL) {
+ dev_err(&serial->dev->dev, "%s - unknown product id %x\n",
+ __func__, le16_to_cpu(serial->dev->descriptor.idProduct));
+- return 1;
++ return -ENODEV;
+ }
+
+ /* Setup private data for serial driver */
--- /dev/null
+From 3c574b0665d5f20a7e67a96e3ed7cdfaa46c39b7 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 1 Jul 2013 14:03:33 +0200
+Subject: USB: mos7840: fix memory leak in open
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit 5f8a2e68b679b41cc8e9b642f2f5aa45dd678641 upstream.
+
+Allocated urbs and buffers were never freed on errors in open.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/mos7840.c | 26 +++++++++++++++++---------
+ 1 file changed, 17 insertions(+), 9 deletions(-)
+
+--- a/drivers/usb/serial/mos7840.c
++++ b/drivers/usb/serial/mos7840.c
+@@ -923,20 +923,20 @@ static int mos7840_open(struct tty_struc
+ status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data);
+ if (status < 0) {
+ dbg("Reading Spreg failed");
+- return -1;
++ goto err;
+ }
+ Data |= 0x80;
+ status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data);
+ if (status < 0) {
+ dbg("writing Spreg failed");
+- return -1;
++ goto err;
+ }
+
+ Data &= ~0x80;
+ status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data);
+ if (status < 0) {
+ dbg("writing Spreg failed");
+- return -1;
++ goto err;
+ }
+ /* End of block to be checked */
+
+@@ -945,7 +945,7 @@ static int mos7840_open(struct tty_struc
+ &Data);
+ if (status < 0) {
+ dbg("Reading Controlreg failed");
+- return -1;
++ goto err;
+ }
+ Data |= 0x08; /* Driver done bit */
+ Data |= 0x20; /* rx_disable */
+@@ -953,7 +953,7 @@ static int mos7840_open(struct tty_struc
+ mos7840_port->ControlRegOffset, Data);
+ if (status < 0) {
+ dbg("writing Controlreg failed");
+- return -1;
++ goto err;
+ }
+ /* do register settings here */
+ /* Set all regs to the device default values. */
+@@ -964,21 +964,21 @@ static int mos7840_open(struct tty_struc
+ status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data);
+ if (status < 0) {
+ dbg("disabling interrupts failed");
+- return -1;
++ goto err;
+ }
+ /* Set FIFO_CONTROL_REGISTER to the default value */
+ Data = 0x00;
+ status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data);
+ if (status < 0) {
+ dbg("Writing FIFO_CONTROL_REGISTER failed");
+- return -1;
++ goto err;
+ }
+
+ Data = 0xcf;
+ status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data);
+ if (status < 0) {
+ dbg("Writing FIFO_CONTROL_REGISTER failed");
+- return -1;
++ goto err;
+ }
+
+ Data = 0x03;
+@@ -1134,7 +1134,15 @@ static int mos7840_open(struct tty_struc
+ dbg ("%s leave", __func__);
+
+ return 0;
+-
++err:
++ for (j = 0; j < NUM_URBS; ++j) {
++ urb = mos7840_port->write_urb_pool[j];
++ if (!urb)
++ continue;
++ kfree(urb->transfer_buffer);
++ usb_free_urb(urb);
++ }
++ return status;
+ }
+
+ /*****************************************************************************
--- /dev/null
+From 6380025aff7900370d4488ee4bfd95ac6c6491d5 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Fri, 26 Jul 2013 11:55:17 +0200
+Subject: USB: mos7840: fix race in register handling
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit d8a083cc746664916d9d36ed9e4d08a29525f245 upstream.
+
+Fix race in mos7840_get_reg which unconditionally manipulated the
+control urb (which may already be in use) by adding a control-urb busy
+flag.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/mos7840.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/serial/mos7840.c
++++ b/drivers/usb/serial/mos7840.c
+@@ -185,6 +185,10 @@
+ #define URB_TRANSFER_BUFFER_SIZE 32 /* URB Size */
+
+
++enum mos7840_flag {
++ MOS7840_FLAG_CTRL_BUSY,
++};
++
+ static const struct usb_device_id moschip_port_id_table[] = {
+ {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
+ {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
+@@ -258,6 +262,8 @@ struct moschip_port {
+ struct urb *write_urb_pool[NUM_URBS];
+ char busy[NUM_URBS];
+ bool read_urb_busy;
++
++ unsigned long flags;
+ };
+
+
+@@ -519,11 +525,11 @@ static void mos7840_control_callback(str
+ /* this urb is terminated, clean up */
+ dbg("%s - urb shutting down with status: %d", __func__,
+ status);
+- return;
++ goto out;
+ default:
+ dbg("%s - nonzero urb status received: %d", __func__,
+ status);
+- return;
++ goto out;
+ }
+
+ dbg("%s urb buffer size is %d", __func__, urb->actual_length);
+@@ -536,6 +542,8 @@ static void mos7840_control_callback(str
+ mos7840_handle_new_msr(mos7840_port, regval);
+ else if (mos7840_port->MsrLsr == 1)
+ mos7840_handle_new_lsr(mos7840_port, regval);
++out:
++ clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mos7840_port->flags);
+ }
+
+ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg,
+@@ -546,6 +554,9 @@ static int mos7840_get_reg(struct moschi
+ unsigned char *buffer = mcs->ctrl_buf;
+ int ret;
+
++ if (test_and_set_bit_lock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags))
++ return -EBUSY;
++
+ dr->bRequestType = MCS_RD_RTYPE;
+ dr->bRequest = MCS_RDREQ;
+ dr->wValue = cpu_to_le16(Wval); /* 0 */
+@@ -557,6 +568,9 @@ static int mos7840_get_reg(struct moschi
+ mos7840_control_callback, mcs);
+ mcs->control_urb->transfer_buffer_length = 2;
+ ret = usb_submit_urb(mcs->control_urb, GFP_ATOMIC);
++ if (ret)
++ clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags);
++
+ return ret;
+ }
+
--- /dev/null
+From 60d3bfb16dc6db40932968fef856b81c625f8cec Mon Sep 17 00:00:00 2001
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Mon, 26 Aug 2013 15:01:40 -0400
+Subject: USB: OHCI: Allow runtime PM without system sleep
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 69820e01aa756b8d228143d997f71523c1e97984 upstream.
+
+Since ohci-hcd supports runtime PM, the .pm field in its pci_driver
+structure should be protected by CONFIG_PM rather than
+CONFIG_PM_SLEEP.
+
+Without this change, OHCI controllers won't do runtime suspend if
+system suspend or hibernation isn't enabled.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/ohci-pci.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/host/ohci-pci.c
++++ b/drivers/usb/host/ohci-pci.c
+@@ -414,7 +414,7 @@ static struct pci_driver ohci_pci_driver
+ .remove = usb_hcd_pci_remove,
+ .shutdown = usb_hcd_pci_shutdown,
+
+-#ifdef CONFIG_PM_SLEEP
++#ifdef CONFIG_PM
+ .driver = {
+ .pm = &usb_hcd_pci_pm_ops
+ },
--- /dev/null
+From 0f9613bfc25a11c5ed61c2213031b209381619cc Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 10 Jun 2013 18:29:38 +0200
+Subject: USB: pl2303: fix device initialisation at open
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit 2d8f4447b58bba5f8cb895c07690434c02307eaf upstream.
+
+Do not use uninitialised termios data to determine when to configure the
+device at open.
+
+This also prevents stack data from leaking to userspace in the OOM error
+path.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+[bwh: Backported to 3.2: tty_struct::termios is a pointer, not a struct]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/pl2303.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/drivers/usb/serial/pl2303.c
++++ b/drivers/usb/serial/pl2303.c
+@@ -269,7 +269,7 @@ static void pl2303_set_termios(struct tt
+ serial settings even to the same values as before. Thus
+ we actually need to filter in this specific case */
+
+- if (!tty_termios_hw_change(tty->termios, old_termios))
++ if (old_termios && !tty_termios_hw_change(tty->termios, old_termios))
+ return;
+
+ cflag = tty->termios->c_cflag;
+@@ -278,7 +278,8 @@ static void pl2303_set_termios(struct tt
+ if (!buf) {
+ dev_err(&port->dev, "%s - out of memory.\n", __func__);
+ /* Report back no change occurred */
+- *tty->termios = *old_termios;
++ if (old_termios)
++ *tty->termios = *old_termios;
+ return;
+ }
+
+@@ -416,7 +417,7 @@ static void pl2303_set_termios(struct tt
+ control = priv->line_control;
+ if ((cflag & CBAUD) == B0)
+ priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
+- else if ((old_termios->c_cflag & CBAUD) == B0)
++ else if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
+ priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
+ if (control != priv->line_control) {
+ control = priv->line_control;
+@@ -477,7 +478,6 @@ static void pl2303_close(struct usb_seri
+
+ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
+ {
+- struct ktermios tmp_termios;
+ struct usb_serial *serial = port->serial;
+ struct pl2303_private *priv = usb_get_serial_port_data(port);
+ int result;
+@@ -495,7 +495,7 @@ static int pl2303_open(struct tty_struct
+
+ /* Setup termios */
+ if (tty)
+- pl2303_set_termios(tty, port, &tmp_termios);
++ pl2303_set_termios(tty, port, NULL);
+
+ dbg("%s - submitting interrupt urb", __func__);
+ result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
--- /dev/null
+From 7d578af04ddac58f49ee90b56625a45090745de7 Mon Sep 17 00:00:00 2001
+From: Richard Weinberger <richard@nod.at>
+Date: Fri, 24 May 2013 12:01:51 +0200
+Subject: USB: serial: Add Option GTM681W to qcserial device table.
+
+From: Richard Weinberger <richard@nod.at>
+
+commit 8a2f132a01c2dd4c3905fa560f92019761ed72b1 upstream.
+
+The Option GTM681W uses a qualcomm chip and can be
+served by the qcserial device driver.
+
+Signed-off-by: Richard Weinberger <richard@nod.at>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/qcserial.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/serial/qcserial.c
++++ b/drivers/usb/serial/qcserial.c
+@@ -121,6 +121,7 @@ static const struct usb_device_id id_tab
+ {USB_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
+ {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */
+ {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */
++ {USB_DEVICE(0x0AF0, 0x8120)}, /* Option GTM681W */
+ { } /* Terminating entry */
+ };
+ MODULE_DEVICE_TABLE(usb, id_table);
--- /dev/null
+From 9e5adb3632ba5664767ff5f41d3f584d9de102b8 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 10 Jun 2013 18:29:39 +0200
+Subject: USB: spcp8x5: fix device initialisation at open
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit 5e4211f1c47560c36a8b3d4544dfd866dcf7ccd0 upstream.
+
+Do not use uninitialised termios data to determine when to configure the
+device at open.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+[bwh: Backported to 3.2: tty_struct::termios is a pointer, not a struct]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/spcp8x5.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+--- a/drivers/usb/serial/spcp8x5.c
++++ b/drivers/usb/serial/spcp8x5.c
+@@ -337,7 +337,6 @@ static void spcp8x5_set_termios(struct t
+ struct spcp8x5_private *priv = usb_get_serial_port_data(port);
+ unsigned long flags;
+ unsigned int cflag = tty->termios->c_cflag;
+- unsigned int old_cflag = old_termios->c_cflag;
+ unsigned short uartdata;
+ unsigned char buf[2] = {0, 0};
+ int baud;
+@@ -346,15 +345,15 @@ static void spcp8x5_set_termios(struct t
+
+
+ /* check that they really want us to change something */
+- if (!tty_termios_hw_change(tty->termios, old_termios))
++ if (old_termios && !tty_termios_hw_change(tty->termios, old_termios))
+ return;
+
+ /* set DTR/RTS active */
+ spin_lock_irqsave(&priv->lock, flags);
+ control = priv->line_control;
+- if ((old_cflag & CBAUD) == B0) {
++ if (old_termios && (old_termios->c_cflag & CBAUD) == B0) {
+ priv->line_control |= MCR_DTR;
+- if (!(old_cflag & CRTSCTS))
++ if (!(old_termios->c_cflag & CRTSCTS))
+ priv->line_control |= MCR_RTS;
+ }
+ if (control != priv->line_control) {
+@@ -442,7 +441,6 @@ static void spcp8x5_set_termios(struct t
+ * status of the device. */
+ static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port)
+ {
+- struct ktermios tmp_termios;
+ struct usb_serial *serial = port->serial;
+ struct spcp8x5_private *priv = usb_get_serial_port_data(port);
+ int ret;
+@@ -465,7 +463,7 @@ static int spcp8x5_open(struct tty_struc
+
+ /* Setup termios */
+ if (tty)
+- spcp8x5_set_termios(tty, port, &tmp_termios);
++ spcp8x5_set_termios(tty, port, NULL);
+
+ spcp8x5_get_msr(serial->dev, &status, priv->type);
+
--- /dev/null
+From c372ce3c31bf53445e71426b56252ca8238c330f Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Sun, 11 Aug 2013 16:49:23 +0200
+Subject: USB: ti_usb_3410_5052: fix big-endian firmware handling
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit e877dd2f2581628b7119df707d4cf03d940cff49 upstream.
+
+Fix endianess bugs in firmware handling introduced by commits cb7a7c6a
+("ti_usb_3410_5052: add Multi-Tech modem support") and 05a3d905
+("ti_usb_3410_5052: support alternate firmware") which made the driver
+use the wrong firmware for certain devices on big-endian machines.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/ti_usb_3410_5052.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/serial/ti_usb_3410_5052.c
++++ b/drivers/usb/serial/ti_usb_3410_5052.c
+@@ -1687,12 +1687,13 @@ static int ti_download_firmware(struct t
+
+ dbg("%s\n", __func__);
+ /* try ID specific firmware first, then try generic firmware */
+- sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor,
+- dev->descriptor.idProduct);
++ sprintf(buf, "ti_usb-v%04x-p%04x.fw",
++ le16_to_cpu(dev->descriptor.idVendor),
++ le16_to_cpu(dev->descriptor.idProduct));
+ if ((status = request_firmware(&fw_p, buf, &dev->dev)) != 0) {
+ buf[0] = '\0';
+- if (dev->descriptor.idVendor == MTS_VENDOR_ID) {
+- switch (dev->descriptor.idProduct) {
++ if (le16_to_cpu(dev->descriptor.idVendor) == MTS_VENDOR_ID) {
++ switch (le16_to_cpu(dev->descriptor.idProduct)) {
+ case MTS_CDMA_PRODUCT_ID:
+ strcpy(buf, "mts_cdma.fw");
+ break;
--- /dev/null
+From 4a6c6bb2be9c0c7bf82089b29afa178f2e53fd8e Mon Sep 17 00:00:00 2001
+From: Thomas Pugliese <thomas.pugliese@gmail.com>
+Date: Wed, 23 Oct 2013 14:44:29 -0500
+Subject: usb: wusbcore: change WA_SEGS_MAX to a legal value
+
+From: Thomas Pugliese <thomas.pugliese@gmail.com>
+
+commit f74b75e7f920c700636cccca669c7d16d12e9202 upstream.
+
+change WA_SEGS_MAX to a number that is legal according to the WUSB
+spec.
+
+Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/wusbcore/wa-xfer.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/wusbcore/wa-xfer.c
++++ b/drivers/usb/wusbcore/wa-xfer.c
+@@ -90,7 +90,8 @@
+ #include "wusbhc.h"
+
+ enum {
+- WA_SEGS_MAX = 255,
++ /* [WUSB] section 8.3.3 allocates 7 bits for the segment index. */
++ WA_SEGS_MAX = 128,
+ };
+
+ enum wa_seg_status {
+@@ -444,7 +445,7 @@ static ssize_t __wa_xfer_setup_sizes(str
+ xfer->seg_size = (xfer->seg_size / maxpktsize) * maxpktsize;
+ xfer->segs = (urb->transfer_buffer_length + xfer->seg_size - 1)
+ / xfer->seg_size;
+- if (xfer->segs >= WA_SEGS_MAX) {
++ if (xfer->segs > WA_SEGS_MAX) {
+ dev_err(dev, "BUG? ops, number of segments %d bigger than %d\n",
+ (int)(urb->transfer_buffer_length / xfer->seg_size),
+ WA_SEGS_MAX);
--- /dev/null
+From d83ceadbcef3426b566bdd6dea16043bfaa12a75 Mon Sep 17 00:00:00 2001
+From: Thomas Pugliese <thomas.pugliese@gmail.com>
+Date: Wed, 23 Oct 2013 14:44:26 -0500
+Subject: usb: wusbcore: set the RPIPE wMaxPacketSize value correctly
+
+From: Thomas Pugliese <thomas.pugliese@gmail.com>
+
+commit 7b6bc07ab554e929c85d51b3d5b26cf7f12c6a3b upstream.
+
+For isochronous endpoints, set the RPIPE wMaxPacketSize value using
+wOverTheAirPacketSize from the endpoint companion descriptor instead of
+wMaxPacketSize from the normal endpoint descriptor.
+
+Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/wusbcore/wa-rpipe.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/wusbcore/wa-rpipe.c
++++ b/drivers/usb/wusbcore/wa-rpipe.c
+@@ -332,7 +332,10 @@ static int rpipe_aim(struct wa_rpipe *rp
+ /* FIXME: compute so seg_size > ep->maxpktsize */
+ rpipe->descr.wBlocks = cpu_to_le16(16); /* given */
+ /* ep0 maxpktsize is 0x200 (WUSB1.0[4.8.1]) */
+- rpipe->descr.wMaxPacketSize = cpu_to_le16(ep->desc.wMaxPacketSize);
++ if (usb_endpoint_xfer_isoc(&ep->desc))
++ rpipe->descr.wMaxPacketSize = epcd->wOverTheAirPacketSize;
++ else
++ rpipe->descr.wMaxPacketSize = ep->desc.wMaxPacketSize;
+ rpipe->descr.bHSHubAddress = 0; /* reserved: zero */
+ rpipe->descr.bHSHubPort = wusb_port_no_to_idx(urb->dev->portnum);
+ /* FIXME: use maximum speed as supported or recommended by device */
--- /dev/null
+From dc77997de6b3cbe994ba052653ec8e292af5b627 Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Mon, 5 Aug 2013 13:36:00 -0700
+Subject: xhci: Don't enable/disable RWE on bus suspend/resume.
+
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+
+commit f217c980ca980e3a645b7485ea5eae9a747f4945 upstream.
+
+The RWE bit of the USB 2.0 PORTPMSC register is supposed to enable
+remote wakeup for devices in the lower power link state L1. It has
+nothing to do with the device suspend remote wakeup from L2. The RWE
+bit is designed to be set once (when USB 2.0 LPM is enabled for the
+port) and cleared only when USB 2.0 LPM is disabled for the port.
+
+The xHCI bus suspend method was setting the RWE bit erroneously, and the
+bus resume method was clearing it. The xHCI 1.0 specification with
+errata up to Aug 12, 2012 says in section 4.23.5.1.1.1 "Hardware
+Controlled LPM":
+
+"While Hardware USB2 LPM is enabled, software shall not modify the
+HIRDBESL or RWE fields of the USB2 PORTPMSC register..."
+
+If we have previously enabled USB 2.0 LPM for a device, that means when
+the USB 2.0 bus is resumed, we violate the xHCI specification by
+clearing RWE. It also means that after a bus resume, the host would
+think remote wakeup is disabled from L1 for ports with USB 2.0 Link PM
+enabled, which is not what we want.
+
+This patch should be backported to kernels as old as 3.2, that
+contain the commit 65580b4321eb36f16ae8b5987bfa1bb948fc5112 "xHCI: set
+USB2 hardware LPM". That was the first kernel that supported USB 2.0
+Link PM.
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+[bwh: Backported to 3.2: deleted code was cosmetically different]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-hub.c | 28 ----------------------------
+ 1 file changed, 28 deletions(-)
+
+--- a/drivers/usb/host/xhci-hub.c
++++ b/drivers/usb/host/xhci-hub.c
+@@ -1048,20 +1048,6 @@ int xhci_bus_suspend(struct usb_hcd *hcd
+ t1 = xhci_port_state_to_neutral(t1);
+ if (t1 != t2)
+ xhci_writel(xhci, t2, port_array[port_index]);
+-
+- if (hcd->speed != HCD_USB3) {
+- /* enable remote wake up for USB 2.0 */
+- __le32 __iomem *addr;
+- u32 tmp;
+-
+- /* Add one to the port status register address to get
+- * the port power control register address.
+- */
+- addr = port_array[port_index] + 1;
+- tmp = xhci_readl(xhci, addr);
+- tmp |= PORT_RWE;
+- xhci_writel(xhci, tmp, addr);
+- }
+ }
+ hcd->state = HC_STATE_SUSPENDED;
+ bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
+@@ -1140,20 +1126,6 @@ int xhci_bus_resume(struct usb_hcd *hcd)
+ xhci_ring_device(xhci, slot_id);
+ } else
+ xhci_writel(xhci, temp, port_array[port_index]);
+-
+- if (hcd->speed != HCD_USB3) {
+- /* disable remote wake up for USB 2.0 */
+- __le32 __iomem *addr;
+- u32 tmp;
+-
+- /* Add one to the port status register address to get
+- * the port power control register address.
+- */
+- addr = port_array[port_index] + 1;
+- tmp = xhci_readl(xhci, addr);
+- tmp &= ~PORT_RWE;
+- xhci_writel(xhci, tmp, addr);
+- }
+ }
+
+ (void) xhci_readl(xhci, &xhci->op_regs->command);
--- /dev/null
+From 21f58875dda7b00228bba716d48e3e2eafb210f9 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 12 Sep 2013 08:11:06 +0200
+Subject: xhci: Fix spurious wakeups after S5 on Haswell
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 638298dc66ea36623dbc2757a24fc2c4ab41b016 upstream.
+
+Haswell LynxPoint and LynxPoint-LP with the recent Intel BIOS show
+mysterious wakeups after shutdown occasionally. After discussing with
+BIOS engineers, they explained that the new BIOS expects that the
+wakeup sources are cleared and set to D3 for all wakeup devices when
+the system is going to sleep or power off, but the current xhci driver
+doesn't do this properly (partly intentionally).
+
+This patch introduces a new quirk, XHCI_SPURIOUS_WAKEUP, for
+fixing the spurious wakeups at S5 by calling xhci_reset() in the xhci
+shutdown ops as done in xhci_stop(), and setting the device to PCI D3
+at shutdown and remove ops.
+
+The PCI D3 call is based on the initial fix patch by Oliver Neukum.
+
+[Note: Sarah changed the quirk name from XHCI_HSW_SPURIOUS_WAKEUP to
+XHCI_SPURIOUS_WAKEUP, since none of the other quirks have system names
+in them. Sarah also fixed a collision with a quirk submitted around the
+same time, by changing the xhci->quirks bit from 17 to 18.]
+
+This patch should be backported to kernels as old as 3.0, that
+contain the commit 1c12443ab8eba71a658fae4572147e56d1f84f66 "xhci: Add
+Lynx Point to list of Intel switchable hosts."
+
+Cc: Oliver Neukum <oneukum@suse.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-pci.c | 17 +++++++++++++++++
+ drivers/usb/host/xhci.c | 7 +++++++
+ drivers/usb/host/xhci.h | 1 +
+ 3 files changed, 25 insertions(+)
+
+--- a/drivers/usb/host/xhci-pci.c
++++ b/drivers/usb/host/xhci-pci.c
+@@ -34,6 +34,9 @@
+ #define PCI_VENDOR_ID_ETRON 0x1b6f
+ #define PCI_DEVICE_ID_ASROCK_P67 0x7023
+
++#define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31
++#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31
++
+ static const char hcd_name[] = "xhci_hcd";
+
+ /* called after powerup, by probe or system-pm "wakeup" */
+@@ -111,6 +114,15 @@ static void xhci_pci_quirks(struct devic
+ xhci->quirks |= XHCI_SPURIOUS_REBOOT;
+ xhci->quirks |= XHCI_AVOID_BEI;
+ }
++ if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
++ (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI ||
++ pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI)) {
++ /* Workaround for occasional spurious wakeups from S5 (or
++ * any other sleep) on Haswell machines with LPT and LPT-LP
++ * with the new Intel BIOS
++ */
++ xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
++ }
+ if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
+ pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
+ xhci->quirks |= XHCI_RESET_ON_RESUME;
+@@ -215,6 +227,11 @@ static void xhci_pci_remove(struct pci_d
+ usb_put_hcd(xhci->shared_hcd);
+ }
+ usb_hcd_pci_remove(dev);
++
++ /* Workaround for spurious wakeups at shutdown with HSW */
++ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
++ pci_set_power_state(dev, PCI_D3hot);
++
+ kfree(xhci);
+ }
+
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -779,12 +779,19 @@ void xhci_shutdown(struct usb_hcd *hcd)
+
+ spin_lock_irq(&xhci->lock);
+ xhci_halt(xhci);
++ /* Workaround for spurious wakeups at shutdown with HSW */
++ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
++ xhci_reset(xhci);
+ spin_unlock_irq(&xhci->lock);
+
+ xhci_cleanup_msix(xhci);
+
+ xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n",
+ xhci_readl(xhci, &xhci->op_regs->status));
++
++ /* Yet another workaround for spurious wakeups at shutdown with HSW */
++ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
++ pci_set_power_state(to_pci_dev(hcd->self.controller), PCI_D3hot);
+ }
+
+ #ifdef CONFIG_PM
+--- a/drivers/usb/host/xhci.h
++++ b/drivers/usb/host/xhci.h
+@@ -1510,6 +1510,7 @@ struct xhci_hcd {
+ #define XHCI_AVOID_BEI (1 << 15)
+ #define XHCI_PLAT (1 << 16)
+ #define XHCI_SLOW_SUSPEND (1 << 17)
++#define XHCI_SPURIOUS_WAKEUP (1 << 18)
+ 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 fb73858992fd24bad482aa5f4ceb839776d7c307 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 9 Dec 2013 14:53:36 +0100
+Subject: xhci: Limit the spurious wakeup fix only to HP machines
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 6962d914f317b119e0db7189199b21ec77a4b3e0 upstream.
+
+We've got regression reports that my previous fix for spurious wakeups
+after S5 on HP Haswell machines leads to the automatic reboot at
+shutdown on some machines. It turned out that the fix for one side
+triggers another BIOS bug in other side. So, it's exclusive.
+
+Since the original S5 wakeups have been confirmed only on HP machines,
+it'd be safer to apply it only to limited machines. As a wild guess,
+limiting to machines with HP PCI SSID should suffice.
+
+This patch should be backported to kernels as old as 3.12, that
+contain the commit 638298dc66ea36623dbc2757a24fc2c4ab41b016 "xhci: Fix
+spurious wakeups after S5 on Haswell".
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66171
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Tested-by: <dashing.meng@gmail.com>
+Reported-by: Niklas Schnelle <niklas@komani.de>
+Reported-by: Giorgos <ganastasiouGR@gmail.com>
+Reported-by: <art1@vhex.net>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-pci.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/host/xhci-pci.c
++++ b/drivers/usb/host/xhci-pci.c
+@@ -121,7 +121,12 @@ static void xhci_pci_quirks(struct devic
+ * any other sleep) on Haswell machines with LPT and LPT-LP
+ * with the new Intel BIOS
+ */
+- xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
++ /* Limit the quirk to only known vendors, as this triggers
++ * yet another BIOS bug on some other machines
++ * https://bugzilla.kernel.org/show_bug.cgi?id=66171
++ */
++ if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP)
++ xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
+ }
+ if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
+ pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
--- /dev/null
+From 455f58925247e8a1a1941e159f3636ad6ee4c90b Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oneukum@suse.de>
+Date: Mon, 30 Sep 2013 15:50:54 +0200
+Subject: xhci: quirk for extra long delay for S4
+
+From: Oliver Neukum <oneukum@suse.de>
+
+commit 455f58925247e8a1a1941e159f3636ad6ee4c90b upstream.
+
+It has been reported that this chipset really cannot
+sleep without this extraordinary delay.
+
+This patch should be backported, in order to ensure this host functions
+under stable kernels. The last quirk for Fresco Logic hosts (commit
+bba18e33f25072ebf70fd8f7f0cdbf8cdb59a746 "xhci: Extend Fresco Logic MSI
+quirk.") was backported to stable kernels as old as 2.6.36.
+
+Signed-off-by: Oliver Neukum <oneukum@suse.de>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+[bwh: Backported to 3.2:
+ - Adjust context
+ - Use xhci_dbg() instead of xhci_dbg_trace()]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+[yangyl: Backported to 3.4: Adjust context]
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/host/xhci-pci.c | 8 ++++++++
+ drivers/usb/host/xhci.c | 7 ++++++-
+ drivers/usb/host/xhci.h | 1 +
+ 3 files changed, 15 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/host/xhci-pci.c
++++ b/drivers/usb/host/xhci-pci.c
+@@ -67,6 +67,14 @@ static void xhci_pci_quirks(struct devic
+ xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure"
+ " endpoint cmd after reset endpoint\n");
+ }
++ if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK &&
++ pdev->revision == 0x4) {
++ xhci->quirks |= XHCI_SLOW_SUSPEND;
++ xhci_dbg(xhci,
++ "QUIRK: Fresco Logic xHC revision %u"
++ "must be suspended extra slowly",
++ pdev->revision);
++ }
+ /* Fresco Logic confirms: all revisions of this chip do not
+ * support MSI, even though some of them claim to in their PCI
+ * capabilities.
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -886,6 +886,7 @@ static void xhci_clear_command_ring(stru
+ int xhci_suspend(struct xhci_hcd *xhci)
+ {
+ int rc = 0;
++ unsigned int delay = XHCI_MAX_HALT_USEC;
+ struct usb_hcd *hcd = xhci_to_hcd(xhci);
+ u32 command;
+
+@@ -904,8 +905,12 @@ int xhci_suspend(struct xhci_hcd *xhci)
+ command = xhci_readl(xhci, &xhci->op_regs->command);
+ command &= ~CMD_RUN;
+ xhci_writel(xhci, command, &xhci->op_regs->command);
++
++ /* Some chips from Fresco Logic need an extraordinary delay */
++ delay *= (xhci->quirks & XHCI_SLOW_SUSPEND) ? 10 : 1;
++
+ if (handshake(xhci, &xhci->op_regs->status,
+- STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC)) {
++ STS_HALT, STS_HALT, delay)) {
+ xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n");
+ spin_unlock_irq(&xhci->lock);
+ return -ETIMEDOUT;
+--- a/drivers/usb/host/xhci.h
++++ b/drivers/usb/host/xhci.h
+@@ -1509,6 +1509,7 @@ struct xhci_hcd {
+ #define XHCI_COMP_MODE_QUIRK (1 << 14)
+ #define XHCI_AVOID_BEI (1 << 15)
+ #define XHCI_PLAT (1 << 16)
++#define XHCI_SLOW_SUSPEND (1 << 17)
+ unsigned int num_active_eps;
+ unsigned int limit_active_eps;
+ /* There are two roothubs to keep track of bus suspend info for */