[PATCH] usb: xhci: reset endpoint on USB stall

Bin Meng bmeng.cn at gmail.com
Wed Feb 16 08:53:33 CET 2022


On Mon, Sep 27, 2021 at 8:43 PM Stefan Agner <stefan at agner.ch> wrote:
>
> 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 at agner.ch>
> ---
> This has been reported on the ML by Mike Hoogstraten a while ago:
> https://www.mail-archive.com/u-boot@lists.denx.de/msg390604.html
>
> FWIW, for the Arduino Mega R3 I also opened an issue:
> https://github.com/arduino/ArduinoCore-avr/issues/431
>
> --
> Stefan
>
>  drivers/usb/host/xhci-ring.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>

Sorry for the delay!

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>


More information about the U-Boot mailing list