--- /dev/null
+From 8edcb0ba0d56f5914eef11eda6db8bfe74eb9ca8 Mon Sep 17 00:00:00 2001
+From: Stanislaw Gruszka <sgruszka@redhat.com>
+Date: Tue, 10 Jun 2014 12:51:06 +0200
+Subject: rt2x00: disable TKIP on USB
+
+From: Stanislaw Gruszka <sgruszka@redhat.com>
+
+commit 8edcb0ba0d56f5914eef11eda6db8bfe74eb9ca8 upstream.
+
+On USB we can not get atomically TKIP key. We have to disable support
+for TKIP acceleration on USB hardware to avoid bug as showed bellow.
+
+[ 860.827243] BUG: scheduling while atomic: hostapd/3397/0x00000002
+<snip>
+[ 860.827280] Call Trace:
+[ 860.827282] [<ffffffff81682ea6>] dump_stack+0x4d/0x66
+[ 860.827284] [<ffffffff8167eb9b>] __schedule_bug+0x47/0x55
+[ 860.827285] [<ffffffff81685bb3>] __schedule+0x733/0x7b0
+[ 860.827287] [<ffffffff81685c59>] schedule+0x29/0x70
+[ 860.827289] [<ffffffff81684f8a>] schedule_timeout+0x15a/0x2b0
+[ 860.827291] [<ffffffff8105ac50>] ? ftrace_raw_event_tick_stop+0xc0/0xc0
+[ 860.827294] [<ffffffff810c13c2>] ? __module_text_address+0x12/0x70
+[ 860.827296] [<ffffffff81686823>] wait_for_completion_timeout+0xb3/0x140
+[ 860.827298] [<ffffffff81080fc0>] ? wake_up_state+0x20/0x20
+[ 860.827301] [<ffffffff814d5b3d>] usb_start_wait_urb+0x7d/0x150
+[ 860.827303] [<ffffffff814d5cd5>] usb_control_msg+0xc5/0x110
+[ 860.827305] [<ffffffffa02fb0c6>] rt2x00usb_vendor_request+0xc6/0x160 [rt2x00usb]
+[ 860.827307] [<ffffffffa02fb215>] rt2x00usb_vendor_req_buff_lock+0x75/0x150 [rt2x00usb]
+[ 860.827309] [<ffffffffa02fb393>] rt2x00usb_vendor_request_buff+0xa3/0xe0 [rt2x00usb]
+[ 860.827311] [<ffffffffa023d1a3>] rt2x00usb_register_multiread+0x33/0x40 [rt2800usb]
+[ 860.827314] [<ffffffffa05805f9>] rt2800_get_tkip_seq+0x39/0x50 [rt2800lib]
+[ 860.827321] [<ffffffffa0480f88>] ieee80211_get_key+0x218/0x2a0 [mac80211]
+[ 860.827322] [<ffffffff815cc68c>] ? __nlmsg_put+0x6c/0x80
+[ 860.827329] [<ffffffffa051b02e>] nl80211_get_key+0x22e/0x360 [cfg80211]
+
+Reported-and-tested-by: Peter Wu <lekensteyn@gmail.com>
+Reported-and-tested-by: Pontus Fuchs <pontus.fuchs@gmail.com>
+Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/rt2x00/rt2x00mac.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
++++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
+@@ -517,6 +517,8 @@ int rt2x00mac_set_key(struct ieee80211_h
+ crypto.cipher = rt2x00crypto_key_to_cipher(key);
+ if (crypto.cipher == CIPHER_NONE)
+ return -EOPNOTSUPP;
++ if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
++ return -EOPNOTSUPP;
+
+ crypto.cmd = cmd;
+
--- /dev/null
+From 616a8394b5df8c88f4dd416f4527439a4e365034 Mon Sep 17 00:00:00 2001
+From: Stanislaw Gruszka <stf_xl@wp.pl>
+Date: Mon, 16 Jun 2014 18:45:15 +0200
+Subject: rt2x00: fix rfkill regression on rt2500pci
+
+From: Stanislaw Gruszka <stf_xl@wp.pl>
+
+commit 616a8394b5df8c88f4dd416f4527439a4e365034 upstream.
+
+As reported by Niels, starting rfkill polling during device probe
+(commit e2bc7c5, generally sane change) broke rfkill on rt2500pci
+device. I considered that bug as some initalization issue, which
+should be fixed on rt2500pci specific code. But after several
+attempts (see bug report for details) we fail to find working solution.
+Hence I decided to revert to old behaviour on rt2500pci to fix
+regression.
+
+Additionally patch also unregister rfkill on device remove instead
+of ifconfig down, what was another issue introduced by bad commit.
+
+Bug report:
+https://bugzilla.kernel.org/show_bug.cgi?id=73821
+
+Fixes: e2bc7c5f3cb8 ("rt2x00: Fix rfkill_polling register function.")
+Bisected-by: Niels <nille0386@googlemail.com>
+Reported-and-tested-by: Niels <nille0386@googlemail.com>
+Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/rt2x00/rt2500pci.c | 7 ++++++-
+ drivers/net/wireless/rt2x00/rt2x00.h | 1 +
+ drivers/net/wireless/rt2x00/rt2x00dev.c | 24 +++++++++++++++++++++---
+ 3 files changed, 28 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/wireless/rt2x00/rt2500pci.c
++++ b/drivers/net/wireless/rt2x00/rt2500pci.c
+@@ -1679,8 +1679,13 @@ static int rt2500pci_init_eeprom(struct
+ /*
+ * Detect if this device has an hardware controlled radio.
+ */
+- if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
++ if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) {
+ __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
++ /*
++ * On this device RFKILL initialized during probe does not work.
++ */
++ __set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags);
++ }
+
+ /*
+ * Check if the BBP tuning should be enabled.
+--- a/drivers/net/wireless/rt2x00/rt2x00.h
++++ b/drivers/net/wireless/rt2x00/rt2x00.h
+@@ -717,6 +717,7 @@ enum rt2x00_capability_flags {
+ REQUIRE_SW_SEQNO,
+ REQUIRE_HT_TX_DESC,
+ REQUIRE_PS_AUTOWAKE,
++ REQUIRE_DELAYED_RFKILL,
+
+ /*
+ * Capabilities
+--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
++++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
+@@ -1022,9 +1022,10 @@ static void rt2x00lib_uninitialize(struc
+ return;
+
+ /*
+- * Unregister extra components.
++ * Stop rfkill polling.
+ */
+- rt2x00rfkill_unregister(rt2x00dev);
++ if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
++ rt2x00rfkill_unregister(rt2x00dev);
+
+ /*
+ * Allow the HW to uninitialize.
+@@ -1062,6 +1063,12 @@ static int rt2x00lib_initialize(struct r
+
+ set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
+
++ /*
++ * Start rfkill polling.
++ */
++ if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
++ rt2x00rfkill_register(rt2x00dev);
++
+ return 0;
+ }
+
+@@ -1207,7 +1214,12 @@ int rt2x00lib_probe_dev(struct rt2x00_de
+ rt2x00link_register(rt2x00dev);
+ rt2x00leds_register(rt2x00dev);
+ rt2x00debug_register(rt2x00dev);
+- rt2x00rfkill_register(rt2x00dev);
++
++ /*
++ * Start rfkill polling.
++ */
++ if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
++ rt2x00rfkill_register(rt2x00dev);
+
+ return 0;
+
+@@ -1223,6 +1235,12 @@ void rt2x00lib_remove_dev(struct rt2x00_
+ clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
+
+ /*
++ * Stop rfkill polling.
++ */
++ if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
++ rt2x00rfkill_unregister(rt2x00dev);
++
++ /*
+ * Disable radio.
+ */
+ rt2x00lib_disable_radio(rt2x00dev);
ibmvscsi-abort-init-sequence-during-error-recovery.patch
+xhci-correct-burst-count-field-for-isoc-transfers-on-1.0-xhci-hosts.patch
+xhci-fix-runtime-suspended-xhci-from-blocking-system-suspend.patch
+usb-add-usb_device_interface_class-macro.patch
+usb-option-add-device-id-for-speedup-su9800-usb-3g-modem.patch
+usb-option-add-modify-olivetti-olicard-modems.patch
+usb-ftdi_sio-fix-null-deref-at-port-probe.patch
+usb-gadget-f_fs-fix-null-pointer-dereference-when-there-are-no-strings.patch
+rt2x00-disable-tkip-on-usb.patch
+rt2x00-fix-rfkill-regression-on-rt2500pci.patch
--- /dev/null
+From 17b72feb2be14e6d37023267dc0e199e8e0e3fdc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
+Date: Wed, 31 Oct 2012 06:08:39 +0100
+Subject: USB: add USB_DEVICE_INTERFACE_CLASS macro
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Bjørn Mork <bjorn@mork.no>
+
+commit 17b72feb2be14e6d37023267dc0e199e8e0e3fdc upstream.
+
+Matching on device and interface class with with unspecified
+subclass and protocol is sometimes useful. This is slightly
+different from USB_DEVICE_AND_INTERFACE_INFO which requires
+the full interface class/subclass/protocol triplet.
+
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/usb.h | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+--- a/include/linux/usb.h
++++ b/include/linux/usb.h
+@@ -715,6 +715,22 @@ static inline int usb_make_path(struct u
+ .bcdDevice_hi = (hi)
+
+ /**
++ * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class
++ * @vend: the 16 bit USB Vendor ID
++ * @prod: the 16 bit USB Product ID
++ * @cl: bInterfaceClass value
++ *
++ * This macro is used to create a struct usb_device_id that matches a
++ * specific interface class of devices.
++ */
++#define USB_DEVICE_INTERFACE_CLASS(vend, prod, cl) \
++ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
++ USB_DEVICE_ID_MATCH_INT_CLASS, \
++ .idVendor = (vend), \
++ .idProduct = (prod), \
++ .bInterfaceClass = (cl)
++
++/**
+ * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
+ * @vend: the 16 bit USB Vendor ID
+ * @prod: the 16 bit USB Product ID
--- /dev/null
+From aea1ae8760314e072bf1b773521e9de5d5dda10d Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Thu, 5 Jun 2014 16:05:52 +0200
+Subject: USB: ftdi_sio: fix null deref at port probe
+
+From: Johan Hovold <johan@kernel.org>
+
+commit aea1ae8760314e072bf1b773521e9de5d5dda10d upstream.
+
+Fix NULL-pointer dereference when probing an interface with no
+endpoints.
+
+These devices have two bulk endpoints per interface, but this avoids
+crashing the kernel if a user forces a non-FTDI device to be probed.
+
+Note that the iterator variable was made unsigned in order to avoid
+a maybe-uninitialized compiler warning for ep_desc after the loop.
+
+Fixes: 895f28badce9 ("USB: ftdi_sio: fix hi-speed device packet size
+calculation")
+
+Reported-by: Mike Remski <mremski@mutualink.net>
+Tested-by: Mike Remski <mremski@mutualink.net>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -1593,14 +1593,17 @@ static void ftdi_set_max_packet_size(str
+ struct usb_device *udev = serial->dev;
+
+ struct usb_interface *interface = serial->interface;
+- struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc;
++ struct usb_endpoint_descriptor *ep_desc;
+
+ unsigned num_endpoints;
+- int i;
++ unsigned i;
+
+ num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
+ dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints);
+
++ if (!num_endpoints)
++ return;
++
+ /* NOTE: some customers have programmed FT232R/FT245R devices
+ * with an endpoint size of 0 - not good. In this case, we
+ * want to override the endpoint descriptor setting and use a
--- /dev/null
+From f0688c8b81d2ea239c3fb0b848f623b579238d99 Mon Sep 17 00:00:00 2001
+From: Michal Nazarewicz <mina86@mina86.com>
+Date: Tue, 17 Jun 2014 17:47:41 +0200
+Subject: usb: gadget: f_fs: fix NULL pointer dereference when there are no strings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michal Nazarewicz <mina86@mina86.com>
+
+commit f0688c8b81d2ea239c3fb0b848f623b579238d99 upstream.
+
+If the descriptors do not need any strings and user space sends empty
+set of strings, the ffs->stringtabs field remains NULL. Thus
+*ffs->stringtabs in functionfs_bind leads to a NULL pointer
+dereferenece.
+
+The bug was introduced by commit [fd7c9a007f: “use usb_string_ids_n()”].
+
+While at it, remove double initialisation of lang local variable in
+that function.
+
+ffs->strings_count does not need to be checked in any way since in
+the above scenario it will remain zero and usb_string_ids_n() is
+a no-operation when colled with 0 argument.
+
+Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/gadget/f_fs.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+--- a/drivers/usb/gadget/f_fs.c
++++ b/drivers/usb/gadget/f_fs.c
+@@ -1361,11 +1361,13 @@ static int functionfs_bind(struct ffs_da
+ ffs->ep0req->context = ffs;
+
+ lang = ffs->stringtabs;
+- for (lang = ffs->stringtabs; *lang; ++lang) {
+- struct usb_string *str = (*lang)->strings;
+- int id = first_id;
+- for (; str->s; ++id, ++str)
+- str->id = id;
++ if (lang) {
++ for (; *lang; ++lang) {
++ struct usb_string *str = (*lang)->strings;
++ int id = first_id;
++ for (; str->s; ++id, ++str)
++ str->id = id;
++ }
+ }
+
+ ffs->gadget = cdev->gadget;
--- /dev/null
+From 1cab4c68e339086cdaff7535848e878e8f261fca Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oneukum@suse.de>
+Date: Tue, 20 May 2014 16:27:40 +0200
+Subject: USB: option: add device ID for SpeedUp SU9800 usb 3g modem
+
+From: Oliver Neukum <oneukum@suse.de>
+
+commit 1cab4c68e339086cdaff7535848e878e8f261fca upstream.
+
+Reported by Alif Mubarak Ahmad:
+
+This device vendor and product id is 1c9e:9800
+It is working as serial interface with generic usbserial driver.
+I thought it is more suitable to use usbserial option driver, which has
+better capability distinguishing between modem serial interface and
+micro sd storage interface.
+
+[ johan: style changes ]
+
+Signed-off-by: Oliver Neukum <oneukum@suse.de>
+Tested-by: Alif Mubarak Ahmad <alive4ever@live.com>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/option.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -357,6 +357,9 @@ static void option_instat_callback(struc
+ /* Zoom */
+ #define ZOOM_PRODUCT_4597 0x9607
+
++/* SpeedUp SU9800 usb 3g modem */
++#define SPEEDUP_PRODUCT_SU9800 0x9800
++
+ /* Haier products */
+ #define HAIER_VENDOR_ID 0x201e
+ #define HAIER_PRODUCT_CE100 0x2009
+@@ -1597,6 +1600,7 @@ static const struct usb_device_id option
+ { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
+ .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
+ },
++ { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
+ { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
+ { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
+ { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
--- /dev/null
+From b0ebef36e93703e59003ad6a1a20227e47714417 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
+Date: Fri, 6 Jun 2014 17:25:56 +0200
+Subject: usb: option: add/modify Olivetti Olicard modems
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Bjørn Mork <bjorn@mork.no>
+
+commit b0ebef36e93703e59003ad6a1a20227e47714417 upstream.
+
+Adding a couple of Olivetti modems and blacklisting the net
+function on a couple which are already supported.
+
+Reported-by: Lars Melin <larsm17@gmail.com>
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/option.c | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -380,8 +380,12 @@ static void option_instat_callback(struc
+ /* Olivetti products */
+ #define OLIVETTI_VENDOR_ID 0x0b3c
+ #define OLIVETTI_PRODUCT_OLICARD100 0xc000
++#define OLIVETTI_PRODUCT_OLICARD120 0xc001
++#define OLIVETTI_PRODUCT_OLICARD140 0xc002
+ #define OLIVETTI_PRODUCT_OLICARD145 0xc003
++#define OLIVETTI_PRODUCT_OLICARD155 0xc004
+ #define OLIVETTI_PRODUCT_OLICARD200 0xc005
++#define OLIVETTI_PRODUCT_OLICARD160 0xc00a
+ #define OLIVETTI_PRODUCT_OLICARD500 0xc00b
+
+ /* Celot products */
+@@ -1635,15 +1639,21 @@ static const struct usb_device_id option
+ { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
+ { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */
+ { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
+-
+- { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
++ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
++ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
++ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140),
++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
++ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155),
++ .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
+ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200),
+- .driver_info = (kernel_ulong_t)&net_intf6_blacklist
+- },
++ .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
++ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160),
++ .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
+ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500),
+- .driver_info = (kernel_ulong_t)&net_intf4_blacklist
+- },
++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+ { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
+ { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
+ { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
--- /dev/null
+From 3213b151387df0b95f4eada104f68eb1c1409cb3 Mon Sep 17 00:00:00 2001
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+Date: Tue, 24 Jun 2014 17:14:41 +0300
+Subject: xhci: correct burst count field for isoc transfers on 1.0 xhci hosts
+
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+
+commit 3213b151387df0b95f4eada104f68eb1c1409cb3 upstream.
+
+The transfer burst count (TBC) field in xhci 1.0 hosts should be set
+to the number of bursts needed to transfer all packets in a isoc TD.
+Supported values are 0-2 (1 to 3 bursts per service interval).
+
+Formula for TBC calculation is given in xhci spec section 4.11.2.3:
+TBC = roundup( Transfer Descriptor Packet Count / Max Burst Size +1 ) - 1
+
+This patch should be applied to stable kernels since 3.0 that contain
+the commit 5cd43e33b9519143f06f507dd7cbee6b7a621885
+"xhci 1.0: Set transfer burst count field."
+
+Suggested-by: ShiChun Ma <masc2008@qq.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-ring.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -3588,7 +3588,7 @@ static unsigned int xhci_get_burst_count
+ return 0;
+
+ max_burst = urb->ep->ss_ep_comp.bMaxBurst;
+- return roundup(total_packet_count, max_burst + 1) - 1;
++ return DIV_ROUND_UP(total_packet_count, max_burst + 1) - 1;
+ }
+
+ /*
--- /dev/null
+From d6236f6d1d885aa19d1cd7317346fe795227a3cc Mon Sep 17 00:00:00 2001
+From: "Wang, Yu" <yu.y.wang@intel.com>
+Date: Tue, 24 Jun 2014 17:14:44 +0300
+Subject: xhci: Fix runtime suspended xhci from blocking system suspend.
+
+From: "Wang, Yu" <yu.y.wang@intel.com>
+
+commit d6236f6d1d885aa19d1cd7317346fe795227a3cc upstream.
+
+The system suspend flow as following:
+1, Freeze all user processes and kenrel threads.
+
+2, Try to suspend all devices.
+
+2.1, If pci device is in RPM suspended state, then pci driver will try
+to resume it to RPM active state in the prepare stage.
+
+2.2, xhci_resume function calls usb_hcd_resume_root_hub to queue two
+workqueue items to resume usb2&usb3 roothub devices.
+
+2.3, Call suspend callbacks of devices.
+
+2.3.1, All suspend callbacks of all hcd's children, including
+roothub devices are called.
+
+2.3.2, Finally, hcd_pci_suspend callback is called.
+
+Due to workqueue threads were already frozen in step 1, the workqueue
+items can't be scheduled, and the roothub devices can't be resumed in
+this flow. The HCD_FLAG_WAKEUP_PENDING flag which is set in
+usb_hcd_resume_root_hub won't be cleared. Finally,
+hcd_pci_suspend will return -EBUSY, and system suspend fails.
+
+The reason why this issue doesn't show up very often is due to that
+choose_wakeup will be called in step 2.3.1. In step 2.3.1, if
+udev->do_remote_wakeup is not equal to device_may_wakeup(&udev->dev), then
+udev will resume to RPM active for changing the wakeup settings. This
+has been a lucky hit which hides this issue.
+
+For some special xHCI controllers which have no USB2 port, then roothub
+will not match hub driver due to probe failed. Then its
+do_remote_wakeup will be set to zero, and we won't be as lucky.
+
+xhci driver doesn't need to resume roothub devices everytime like in
+the above case. It's only needed when there are pending event TRBs.
+
+This patch should be back-ported to kernels as old as 3.2, that
+contains the commit f69e3120df82391a0ee8118e0a156239a06b2afb
+"USB: XHCI: resume root hubs when the controller resumes"
+
+Signed-off-by: Wang, Yu <yu.y.wang@intel.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+[use readl() instead of removed xhci_readl(), reword commit message -Mathias]
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -963,7 +963,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
+ */
+ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
+ {
+- u32 command, temp = 0;
++ u32 command, temp = 0, status;
+ struct usb_hcd *hcd = xhci_to_hcd(xhci);
+ struct usb_hcd *secondary_hcd;
+ int retval = 0;
+@@ -1087,8 +1087,12 @@ int xhci_resume(struct xhci_hcd *xhci, b
+
+ done:
+ if (retval == 0) {
+- usb_hcd_resume_root_hub(hcd);
+- usb_hcd_resume_root_hub(xhci->shared_hcd);
++ /* Resume root hubs only when have pending events. */
++ status = readl(&xhci->op_regs->status);
++ if (status & STS_EINT) {
++ usb_hcd_resume_root_hub(hcd);
++ usb_hcd_resume_root_hub(xhci->shared_hcd);
++ }
+ }
+
+ /*