]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/commit
usb: uas: Add workaround for DATA IN urb's returned with status -EAGAIN
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Fri, 30 Jun 2017 10:28:10 +0000 (15:58 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 10 Jul 2017 07:37:58 +0000 (09:37 +0200)
commitef875d2e98b626659f7e02cdedbbb20d5865b636
tree40657b0b7eaa063113f8fd5ddca6ce6e4ea41b04
parent95349da0010b6e58a5bdfa9aa4917000692404ea
usb: uas: Add workaround for DATA IN urb's returned with status -EAGAIN

dwc3 host controller has a bug where it fails to start processing
of TRB's present in DATA IN stream ring, because of this issue no
transfer events are generated for that stream ring and resulting
in a hang condition.
As a workaround for this issue, a timer is started for DATA IN
stream ring, which gets expired when host fails to process trbs
present in the stream ring. In that timeout handler, the urb on
which the issue occurred is stopped with urb->status set to -EAGAIN.
In UAS driver,uas_workaround() is called if urb->status == -EAGAIN.
As a part of error recovery sequence, uas_workaround() re-submits
the previous stopped URB and prepare & submit dummy sense, data in
and cmnd urb with command set to scsi standard inquiry command having
next available stream id tag. Once the trbs for the submitted urbs are
added to steam ring XHCI controller will start processing the trbs of
the re-submitted urb along with the trbs of dummy inquiry urb.

These below gives the overview of the ISSUE and workaround

ISSUE:
1. UAS submit DATA IN URB
2. XHCI fails to process trbs associated with URB
3. As a result no events are generated by host controller
4. Hang condition occur

WORKAROUND
1. UAS submit DATA IN URB
2. XHCI driver starts timer
3. XHCI fails to process trbs associated with URB
4. As a result no events generated
5. Timer timedout and timer handler gets triggered
5. XHCI driver sends urb back with status = -EAGAIN
6. UAS driver re-submits stopped URB on seeing -EAGAIN
7. UAS driver submits sense, data in & cmnd urb with scsi cmnd = inquiry
8. XHCI starts processing previous stopped URB along with inquiry cmnd urb

This patch adds the above said workaround.

NOTE: As we have already added support for usb Host streaming, this fix is
required to fix the issue that occur when UAS capable device is connected.
This fix is expected to change after the HW team comes with an alternate
workaround for this issue.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/storage/uas.c