[PATCH 42/45] USB: Fix usb_fill_int_urb for SuperSpeed devices

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg Kroah-Hartman
Date: Friday, March 19, 2010 - 8:19 am

From: Matthew Wilcox <willy@linux.intel.com>

USB 3 and Wireless USB specify a logarithmic encoding of the endpoint
interval that matches the USB 2 specification.  usb_fill_int_urb() didn't
know that and was filling in the interval as if it was USB 1.1.  Fix
usb_fill_int_urb() for SuperSpeed devices, but leave the wireless case
alone, because David Vrabel wants to keep the old encoding.

Update the struct urb kernel doc to note that SuperSpeed URBs must have
urb->interval specified in microframes.

Add a missing break statement in the usb_submit_urb() interrupt URB
checking, since wireless USB and SuperSpeed USB encode urb->interval
differently.  This allows xHCI roothubs to actually register with khubd.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/usb/core/urb.c |    1 +
 include/linux/usb.h    |   18 +++++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 2708056..45a32da 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -453,6 +453,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 			if (urb->interval > (1 << 15))
 				return -EINVAL;
 			max = 1 << 15;
+			break;
 		case USB_SPEED_WIRELESS:
 			if (urb->interval > 16)
 				return -EINVAL;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 8c9f053..ce1323c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1055,7 +1055,8 @@ typedef void (*usb_complete_t)(struct urb *);
  * @number_of_packets: Lists the number of ISO transfer buffers.
  * @interval: Specifies the polling interval for interrupt or isochronous
  *	transfers.  The units are frames (milliseconds) for full and low
- *	speed devices, and microframes (1/8 millisecond) for highspeed ones.
+ *	speed devices, and microframes (1/8 millisecond) for highspeed
+ *	and SuperSpeed devices.
  * @error_count: Returns the number of ISO transfers that reported errors.
  * @context: For use in completion functions.  This normally points to
  *	request-specific driver context.
@@ -1286,9 +1287,16 @@ static inline void usb_fill_bulk_urb(struct urb *urb,
  *
  * Initializes a interrupt urb with the proper information needed to submit
  * it to a device.
- * Note that high speed interrupt endpoints use a logarithmic encoding of
- * the endpoint interval, and express polling intervals in microframes
- * (eight per millisecond) rather than in frames (one per millisecond).
+ *
+ * Note that High Speed and SuperSpeed interrupt endpoints use a logarithmic
+ * encoding of the endpoint interval, and express polling intervals in
+ * microframes (eight per millisecond) rather than in frames (one per
+ * millisecond).
+ *
+ * Wireless USB also uses the logarithmic encoding, but specifies it in units of
+ * 128us instead of 125us.  For Wireless USB devices, the interval is passed
+ * through to the host controller, rather than being translated into microframe
+ * units.
  */
 static inline void usb_fill_int_urb(struct urb *urb,
 				    struct usb_device *dev,
@@ -1305,7 +1313,7 @@ static inline void usb_fill_int_urb(struct urb *urb,
 	urb->transfer_buffer_length = buffer_length;
 	urb->complete = complete_fn;
 	urb->context = context;
-	if (dev->speed == USB_SPEED_HIGH)
+	if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER)
 		urb->interval = 1 << (interval - 1);
 	else
 		urb->interval = interval;
-- 
1.7.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PATCH] USB fixes for 2.6.34-git, Greg KH, (Fri Mar 19, 8:13 am)
[PATCH 01/45] USB: fix usbfs regression, Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 02/45] USB: serial: fix error message on close in g ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 03/45] USB: serial: fix softint not being called on ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 04/45] USB: serial: use port endpoint size to deter ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 05/45] USB: unusual_devs.h: Fix capacity for SL11R- ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 06/45] USB: Option: Add support for a variant of DL ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 07/45] USB: EHCI: fix ITD list order, Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 08/45] USB: EHCI: adjust ehci_iso_stream for change ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 09/45] USB: cdc-acm: Fix stupid NULL pointer in res ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 10/45] USB: qcserial: add new device ids, Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 11/45] USB: musb: fix build error introduced by iso ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 12/45] USB: xhci: rename driver to xhci_hcd, Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 13/45] USB: xHCI: re-initialize cmd_completion, Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 14/45] USB: serial: ftdi: add CONTEC vendor and pro ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 15/45] USB: option: fix incorrect manufacturer name ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 16/45] USB: option: move hardcoded PID to a macro i ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 17/45] USB: option: add support for a new CMOTECH d ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 18/45] USB: Fix documentation for avoid_reset_quirk, Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 19/45] usb/gadget: fix compile error on r8a66597-udc.c, Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 20/45] usb: musb: Fix compile error for omaps for m ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 21/45] usb: musb: abstract out ULPI_BUSCONTROL regi ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 22/45] USB: musb: fix warnings in Blackfin regs, Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 23/45] usb: musb: core: declare mbase only where it ..., Greg Kroah-Hartman, (Fri Mar 19, 8:18 am)
[PATCH 24/45] usb: cdc-wdm: Fix race between write and dis ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 25/45] usb: cdc-wdm: Fix race between autosuspend a ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 26/45] usb: cdc-wdm: Fix race between disconnect an ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 27/45] usb: cdc-wdm: Fix submission of URB after su ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 28/45] usb: cdc-wdm:Fix loss of data due to autosuspend, Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 29/45] usb: cdc-wdm: Fix order in disconnect and fi ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 30/45] usb: cdc-wdm: Fix deadlock between write and ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 31/45] USB: serial: Fix module name typo for qcaux ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 32/45] USB: option.c: Add Pirelli VID/PID and indic ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 33/45] USB: goku_udc: remove potential null dereference, Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 34/45] USB: gadget: fix Blackfin builds after gadge ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 35/45] USB: g_mass_storage: fix section mismatch wa ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 36/45] USB: gadget: f_mass_storage::fsg_bind(): fix ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 37/45] USB: g_mass_storage: fixed module name in Kc ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 38/45] USB: ftdi_sio: Fix locking for change_speed( ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 39/45] USB: gadget: add gadget controller number fo ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 40/45] USB: Remove last bit of CONFIG_USB_BERRY_CHARGE, Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 41/45] USB: cp210x: Remove double usb_control_msg f ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 42/45] USB: Fix usb_fill_int_urb for SuperSpeed devices, Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 43/45] USB: xhci: Make endpoint interval debugging ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 44/45] usb: r8a66597-hcd: fix removed from an attac ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
[PATCH 45/45] USB: gadget/multi: cdc_do_config: remove red ..., Greg Kroah-Hartman, (Fri Mar 19, 8:19 am)
Re: [PATCH 10/45] USB: qcserial: add new device ids, Matthew Garrett, (Thu Apr 1, 2:14 pm)
Re: [PATCH 10/45] USB: qcserial: add new device ids, Bernhard Rosenkraenzer, (Thu Apr 1, 3:31 pm)
Re: [PATCH 10/45] USB: qcserial: add new device ids, Matthew Garrett, (Thu Apr 1, 4:18 pm)