Skip to content

Commit b513d44

Browse files
Sarah Sharpgregkh
authored andcommitted
xhci: Fix full speed bInterval encoding.
Dmitry's patch dfa49c4 USB: xhci - fix math in xhci_get_endpoint_interval() introduced a bug. The USB 2.0 spec says that full speed isochronous endpoints' bInterval must be decoded as an exponent to a power of two (e.g. interval = 2^(bInterval - 1)). Full speed interrupt endpoints, on the other hand, don't use exponents, and the interval in frames is encoded straight into bInterval. Dmitry's patch was supposed to fix up the full speed isochronous to parse bInterval as an exponent, but instead it changed the *interrupt* endpoint bInterval decoding. The isochronous endpoint encoding was the same. This caused full speed devices with interrupt endpoints (including mice, hubs, and USB to ethernet devices) to fail under NEC 0.96 xHCI host controllers: [ 100.909818] xhci_hcd 0000:06:00.0: add ep 0x83, slot id 1, new drop flags = 0x0, new add flags = 0x99, new slot info = 0x38100000 [ 100.909821] xhci_hcd 0000:06:00.0: xhci_check_bandwidth called for udev ffff88011f0ea000 ... [ 100.910187] xhci_hcd 0000:06:00.0: ERROR: unexpected command completion code 0x11. [ 100.910190] xhci_hcd 0000:06:00.0: xhci_reset_bandwidth called for udev ffff88011f0ea000 When the interrupt endpoint was added and a Configure Endpoint command was issued to the host, the host controller would return a very odd error message (0x11 means "Slot Not Enabled", which isn't true because the slot was enabled). Probably the host controller was getting very confused with the bad encoding. Signed-off-by: Sarah Sharp <[email protected]> Cc: Dmitry Torokhov <[email protected]> Reported-by: Thomas Lindroth <[email protected]> Tested-by: Thomas Lindroth <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2efeaeb commit b513d44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/host/xhci-mem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,12 +1045,12 @@ static unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
10451045
break;
10461046

10471047
case USB_SPEED_FULL:
1048-
if (usb_endpoint_xfer_int(&ep->desc)) {
1048+
if (usb_endpoint_xfer_isoc(&ep->desc)) {
10491049
interval = xhci_parse_exponent_interval(udev, ep);
10501050
break;
10511051
}
10521052
/*
1053-
* Fall through for isochronous endpoint interval decoding
1053+
* Fall through for interrupt endpoint interval decoding
10541054
* since it uses the same rules as low speed interrupt
10551055
* endpoints.
10561056
*/

0 commit comments

Comments
 (0)