usb: dwc3: Stop active transfer on control endpoints

Currently glue driver tries to issue an end transfer for control
endpoints in case of usb disconnect or composition switch through
dwc3_ep0_end_control_data only if ep number is 1. Just before
issuing end transfer it checks the direction and based on that it
either issues end transfer for ep0 out or ep0 in through
dwc3_ep0_end_control_data. If remove requests will be called for
ep0 out endpoint then it doesn't issue an end transfer as resource
index will be zero for ep0out endpoint and end transfer will also
not be issued through dwc3_ep0_end_control_data as ep number is 0,
but glue driver unmaps and gives back all the requests. This
sometimes may lead to smmu fault as the requests were unmapped
before issuing an end transfer.

Fix this by issuing an end transfer from remove requests for
control endpoints if ep number is 0. In this scenario it can be
ensured that we issue end transfer for control endpoints before
unmapping and giving back the requests.

Change-Id: I6022c0b4e7cd62bfb7087313e39ff0ea3c9cc253
Signed-off-by: Rohith Kollalsi <rkollals@codeaurora.org>
This commit is contained in:
Rohith Kollalsi 2020-10-07 19:37:27 +05:30 committed by Gerrit - the friendly Code Review server
parent 9c2d2c1a88
commit 9508284969

View file

@ -812,7 +812,7 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
dbg_log_string("START for %s(%d)", dep->name, dep->number);
dwc3_stop_active_transfer(dwc, dep->number, true);
if (dep->number == 1 && dwc->ep0state != EP0_SETUP_PHASE) {
if (dep->number == 0 && dwc->ep0state != EP0_SETUP_PHASE) {
unsigned int dir;
dbg_log_string("CTRLPEND(%d)", dwc->ep0state);