]> git.baikalelectronics.ru Git - uboot.git/commit
usb: xhci: reset endpoint on USB stall
authorStefan Agner <stefan@agner.ch>
Mon, 27 Sep 2021 12:42:58 +0000 (14:42 +0200)
committerMarek Vasut <marex@denx.de>
Wed, 16 Feb 2022 16:11:31 +0000 (17:11 +0100)
commitb0db52c84cca89cea5f7f415e24ddac64feae2ed
tree0a9cb49242da3eb315b4e459cb474c47a911b028
parenteef82b07e18ac21459f65ea194b3ff11cf3c9e75
usb: xhci: reset endpoint on USB stall

There are devices which cause a USB stall when trying to read strings.
Specifically Arduino Mega R3 stalls when trying to read the product
string.

The stall currently remains unhandled, and subsequent retries submit new
transfers on a stopped endpoint which ultimately cause a crash in
abort_td():
WARN halted endpoint, queueing URB anyway.
XHCI control transfer timed out, aborting...
Unexpected XHCI event TRB, skipping... (3affe040 00000000 13000000 02008401)
BUG at drivers/usb/host/xhci-ring.c:505/abort_td()!
BUG!
resetting ...

Linux seems to be able to recover from the stall by issuing a
TRB_RESET_EP command.

Introduce reset_ep() which issues a TRB_RESET_EP followed by setting the
transfer ring dequeue pointer via TRB_SET_DEQ. This allows to properly
recover from a USB stall error and continue communicating with the USB
device.

Signed-off-by: Stefan Agner <stefan@agner.ch>
drivers/usb/host/xhci-ring.c