diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-03-14 10:44:02 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-03-14 10:56:00 -0400 |
commit | 99509cc71e3aae777836180ffa2ce6359f67c134 (patch) | |
tree | 4b9c89985860f9eec3efa41acb784c1f852bea54 | |
parent | 601a0539a157b822651e21d53b8751f3b650d212 (diff) | |
download | longterm-queue-2.6.34-99509cc71e3aae777836180ffa2ce6359f67c134.tar.gz |
xhci: add commit to resolve regression
----
From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
This commit introduced a bug, so you will need this fix as well:
commit 340a3504fd39dad753ba908fb6f894ee81fc3ae2
Author: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Date: Mon Feb 13 14:42:11 2012 -0800
xhci: Fix encoding for HS bulk/control NAK rate.
----
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | queue/series | 1 | ||||
-rw-r--r-- | queue/xhci-Fix-encoding-for-HS-bulk-control-NAK-rate.patch | 96 |
2 files changed, 97 insertions, 0 deletions
diff --git a/queue/series b/queue/series index 985e44c..07e3e88 100644 --- a/queue/series +++ b/queue/series @@ -82,6 +82,7 @@ USB-EHCI-unlink-unused-QHs-when-the-controller-is-st.patch USB-fix-formatting-of-SuperSpeed-endpoints-in-proc-b.patch USB-xhci-fix-unsafe-macro-definitions.patch USB-xhci-fix-math-in-xhci_get_endpoint_interval.patch +xhci-Fix-encoding-for-HS-bulk-control-NAK-rate.patch x86-cpu-Fix-regression-in-AMD-errata-checking-code.patch net-ax25-fix-information-leak-to-userland-harder.patch diff --git a/queue/xhci-Fix-encoding-for-HS-bulk-control-NAK-rate.patch b/queue/xhci-Fix-encoding-for-HS-bulk-control-NAK-rate.patch new file mode 100644 index 0000000..7320ec5 --- /dev/null +++ b/queue/xhci-Fix-encoding-for-HS-bulk-control-NAK-rate.patch @@ -0,0 +1,96 @@ +From 554855569d092cfec217422477001968b5af0ba5 Mon Sep 17 00:00:00 2001 +From: Sarah Sharp <sarah.a.sharp@linux.intel.com> +Date: Mon, 13 Feb 2012 14:42:11 -0800 +Subject: [PATCH] xhci: Fix encoding for HS bulk/control NAK rate. + +commit 340a3504fd39dad753ba908fb6f894ee81fc3ae2 upstream. + +The xHCI 0.96 spec says that HS bulk and control endpoint NAK rate must +be encoded as an exponent of two number of microframes. The endpoint +descriptor has the NAK rate encoded in number of microframes. We were +just copying the value from the endpoint descriptor into the endpoint +context interval field, which was not correct. This lead to the VIA +host rejecting the add of a bulk OUT endpoint from any USB 2.0 mass +storage device. + +The fix is to use the correct encoding. Refactor the code to convert +number of frames to an exponential number of microframes, and make sure +we convert the number of microframes in HS bulk and control endpoints to +an exponent. + +This should be back ported to kernels as old as 2.6.31, that contain the +commit dfa49c4ad120a784ef1ff0717168aa79f55a483a "USB: xhci - fix math +in xhci_get_endpoint_interval" + +Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> +Tested-by: Felipe Contreras <felipe.contreras@gmail.com> +Suggested-by: Andiry Xu <andiry.xu@amd.com> +Cc: stable@vger.kernel.org +Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> + +diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c +index e1dbcc2..54a538d 100644 +--- a/drivers/usb/host/xhci-mem.c ++++ b/drivers/usb/host/xhci-mem.c +@@ -541,26 +541,42 @@ static unsigned int xhci_parse_exponent_interval(struct usb_device *udev, + } + + /* +- * Convert bInterval expressed in frames (in 1-255 range) to exponent of ++ * Convert bInterval expressed in microframes (in 1-255 range) to exponent of + * microframes, rounded down to nearest power of 2. + */ +-static unsigned int xhci_parse_frame_interval(struct usb_device *udev, +- struct usb_host_endpoint *ep) ++static unsigned int xhci_microframes_to_exponent(struct usb_device *udev, ++ struct usb_host_endpoint *ep, unsigned int desc_interval, ++ unsigned int min_exponent, unsigned int max_exponent) + { + unsigned int interval; + +- interval = fls(8 * ep->desc.bInterval) - 1; +- interval = clamp_val(interval, 3, 10); +- if ((1 << interval) != 8 * ep->desc.bInterval) ++ interval = fls(desc_interval) - 1; ++ interval = clamp_val(interval, min_exponent, max_exponent); ++ if ((1 << interval) != desc_interval) + dev_warn(&udev->dev, + "ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n", + ep->desc.bEndpointAddress, + 1 << interval, +- 8 * ep->desc.bInterval); ++ desc_interval); + + return interval; + } + ++static unsigned int xhci_parse_microframe_interval(struct usb_device *udev, ++ struct usb_host_endpoint *ep) ++{ ++ return xhci_microframes_to_exponent(udev, ep, ++ ep->desc.bInterval, 0, 15); ++} ++ ++ ++static unsigned int xhci_parse_frame_interval(struct usb_device *udev, ++ struct usb_host_endpoint *ep) ++{ ++ return xhci_microframes_to_exponent(udev, ep, ++ ep->desc.bInterval * 8, 3, 10); ++} ++ + /* Return the polling or NAK interval. + * + * The polling interval is expressed in "microframes". If xHCI's Interval field +@@ -579,7 +595,7 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, + /* Max NAK rate */ + if (usb_endpoint_xfer_control(&ep->desc) || + usb_endpoint_xfer_bulk(&ep->desc)) { +- interval = ep->desc.bInterval; ++ interval = xhci_parse_microframe_interval(udev, ep); + break; + } + /* Fall through - SS and HS isoc/int have same decoding */ +-- +1.7.9.3 + |