Thread (7 messages) 7 messages, 3 authors, 2021-01-05

Re: dwc2 gadget rejecting new AIO transfer when bus is suspended

From: Vincent Pelletier <hidden>
Date: 2021-01-05 13:48:01
Subsystem: designware usb2 drd ip driver, the rest, usb subsystem · Maintainers: Minas Harutyunyan, Linus Torvalds, Greg Kroah-Hartman

Hello Artur,

On Tue, 29 Dec 2020 07:29:27 +0000, Artur Petrosyan [off-list ref] wrote:
Refactoring the driver to always accept any EP request independent of 
the state (suspend), requires lot of investigation. We will decide and 
implement later.

For your case we suggest the following workaround in 
"dwc2_hsotg_ep_queue()" function to additionally check "hsotg->power_down":
I did test your change (with a trivial adaptation, see below) on
5.11.0-rc1 and I can confirm the AIO submission is accepted in my
use-case, despite a 4-seconds sleep between UDC being bound and AIO
submission to try to trigger the issue (which it does on an unpatched
5.10).

The gadget goes on to correctly respond to the host, so this looks good
to me.
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 0a0d11151cfb8..dc676f3b1d799 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1387,7 +1387,7 @@ static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
 		req->zero, req->short_not_ok);
 
 	/* Prevent new request submission when controller is suspended */
-	if (hs->lx_state != DWC2_L0) {
+	if (hs->lx_state != DWC2_L0 && hs->params.power_down) {
 		dev_dbg(hs->dev, "%s: submit request only in active state\n",
 			__func__);
 		return -EAGAIN;
Regards,
-- 
Vincent Pelletier
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help