usb: dwc3: ep0: Ignore Data Stage after EP0 Stall/Restart
There are some requests which are not supported by our driver,
like vendor-specific requests. In this case, it was a vendor
request with wlen = 0 (so ep0_expect_in = FALSE). When we get
such requests, we issue a SETSTALL and STARTTRANSFER command
on the Ep0 OUT, expecting the next DWC3 event to be the completion
event for the setup packet of the next request. This is the c040
event (Tx complete on Ep0 OUT).
But when the SETSTALL command is issued, there could be a latency
in this actually taking effect, until then there could be packets
on the bus which can return unexpected events. In this particular
issue, there were IN tokens being sent by the host during STALL
and RESTART of EP0. These IN tokens were making the HW to queue
unexpected events like 20c2 (Ctrl Status Tx Not Ready on Ep0 IN)
and 10c2 (Ctrl DATA Tx Not Ready on Ep0 IN). As per the driver,
20c2 is ignored since the STALL and RESTART of Ep0 OUT has set
next_event as EP0_COMPLETE and we return with a No-OP.
But the 10c2 event does not have any such check. Hence it was giving
WRONGDR error (since ep0_expect_in = FALSE but data is getting expected
on Ep0 IN). We then go for another STALL and RESTART of Ep0 OUT and
this was causing HW and SW to go out-of-sync and yellow bang was observed.
On discussion with SNPS folks, they said that STALL will get cleared only
on receiving the next setup token. Till then, we should ignore any Ep0
specific event other than c040.
Change-Id: Ie1b67ea4ff0c289b0ff37e2749ec26672d60e66d
Signed-off-by:
Ajay Agarwal <ajaya@codeaurora.org>
Loading
Please register or sign in to comment