[PATCH] USB: musb: gadget_ep0: start up the first request in the queue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Cliff Cai <cliff.cai@xxxxxxxxxx>

After the recent tweaks to musb_gadget_set_halt(), running the gadget
zero bulk test sometimes hangs.  So have the gadget code start up the
request if it's the first in the queue.

Signed-off-by: Cliff Cai <cliff.cai@xxxxxxxxxx>
Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
---
 drivers/usb/musb/musb_gadget.c     |    2 +-
 drivers/usb/musb/musb_gadget.h     |    1 +
 drivers/usb/musb/musb_gadget_ep0.c |    8 ++++++++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 6fca870..9227c5a 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1081,7 +1081,7 @@ struct free_record {
 /*
  * Context: controller locked, IRQs blocked.
  */
-static void musb_ep_restart(struct musb *musb, struct musb_request *req)
+void musb_ep_restart(struct musb *musb, struct musb_request *req)
 {
 	DBG(3, "<== %s request %p len %u on hw_ep%d\n",
 		req->tx ? "TX/IN" : "RX/OUT",
diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h
index c8b1403..d7cbaaf 100644
--- a/drivers/usb/musb/musb_gadget.h
+++ b/drivers/usb/musb/musb_gadget.h
@@ -104,5 +104,6 @@ extern int musb_gadget_setup(struct musb *);
 extern void musb_gadget_cleanup(struct musb *);
 
 extern void musb_g_giveback(struct musb_ep *, struct usb_request *, int);
+extern void musb_ep_restart(struct musb *musb, struct musb_request *req);
 
 #endif		/* __MUSB_GADGET_H */
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
index 21b9788..f8409f2 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -264,6 +264,7 @@ __acquires(musb->lock)
 				void __iomem		*regs;
 				int			is_in;
 				u16			csr;
+				struct musb_request	*request;
 
 				if (epnum == 0 || epnum >= MUSB_C_NUM_EPS ||
 				    ctrlrequest->wValue != USB_ENDPOINT_HALT)
@@ -279,6 +280,8 @@ __acquires(musb->lock)
 				if (!musb_ep->desc)
 					break;
 
+				request = to_musb_request(next_request(musb_ep));
+
 				handled = 1;
 				/* Ignore request if endpoint is wedged */
 				if (musb_ep->wedged)
@@ -302,6 +305,11 @@ __acquires(musb->lock)
 					musb_writew(regs, MUSB_RXCSR, csr);
 				}
 
+				/* maybe start the first request in the queue */
+				if (!musb_ep->busy && request) {
+					DBG(3, "restarting the request\n");
+					musb_ep_restart(musb, request);
+				}
 				/* select ep0 again */
 				musb_ep_select(mbase, 0);
 				} break;
-- 
1.7.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux