Skip to content

Commit 8f97250

Browse files
matnymangregkh
authored andcommitted
xhci: Don't clear hub TT buffer on ep0 protocol stall
The default control endpoint ep0 can return a STALL indicating the device does not support the control transfer requests. This is called a protocol stall and does not halt the endpoint. xHC behaves a bit different. Its internal endpoint state will always be halted on any stall, even if the device side of the endpiont is not halted. So we do need to issue the reset endpoint command to clear the xHC host intenal endpoint halt state, but should not request the HS hub to clear the TT buffer unless device side of endpoint is halted. Clearing the hub TT buffer at protocol stall caused ep0 to become unresponsive for some FS/LS devices behind HS hubs, and class drivers failed to set the interface due to timeout: usb 1-2.1: 1:1: usb_set_interface failed (-110) Fixes: ef513be ("usb: xhci: Add Clear_TT_Buffer") Cc: <[email protected]> # v5.3 Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e9fb08d commit 8f97250

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,6 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
18761876
ep->ep_state |= EP_HARD_CLEAR_TOGGLE;
18771877
xhci_cleanup_stalled_ring(xhci, slot_id, ep_index, stream_id,
18781878
td);
1879-
xhci_clear_hub_tt_buffer(xhci, td, ep);
18801879
}
18811880
xhci_ring_cmd_db(xhci);
18821881
}
@@ -1997,11 +1996,18 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td,
19971996
if (trb_comp_code == COMP_STALL_ERROR ||
19981997
xhci_requires_manual_halt_cleanup(xhci, ep_ctx,
19991998
trb_comp_code)) {
2000-
/* Issue a reset endpoint command to clear the host side
2001-
* halt, followed by a set dequeue command to move the
2002-
* dequeue pointer past the TD.
2003-
* The class driver clears the device side halt later.
1999+
/*
2000+
* xhci internal endpoint state will go to a "halt" state for
2001+
* any stall, including default control pipe protocol stall.
2002+
* To clear the host side halt we need to issue a reset endpoint
2003+
* command, followed by a set dequeue command to move past the
2004+
* TD.
2005+
* Class drivers clear the device side halt from a functional
2006+
* stall later. Hub TT buffer should only be cleared for FS/LS
2007+
* devices behind HS hubs for functional stalls.
20042008
*/
2009+
if ((ep_index != 0) || (trb_comp_code != COMP_STALL_ERROR))
2010+
xhci_clear_hub_tt_buffer(xhci, td, ep);
20052011
xhci_cleanup_halted_endpoint(xhci, slot_id, ep_index,
20062012
ep_ring->stream_id, td, EP_HARD_RESET);
20072013
} else {

0 commit comments

Comments
 (0)