diff mbox

musb_gadget: restart request on clearing endpoint halt

Message ID 201009112223.12768.sshtylyov@ru.mvista.com (mailing list archive)
State Accepted
Headers show

Commit Message

Sergei Shtylyov Sept. 11, 2010, 6:23 p.m. UTC
None
diff mbox

Patch

Index: linux-davinci/drivers/usb/musb/musb_gadget.c
===================================================================
--- linux-davinci.orig/drivers/usb/musb/musb_gadget.c
+++ linux-davinci/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",
Index: linux-davinci/drivers/usb/musb/musb_gadget.h
===================================================================
--- linux-davinci.orig/drivers/usb/musb/musb_gadget.h
+++ linux-davinci/drivers/usb/musb/musb_gadget.h
@@ -105,4 +105,6 @@  extern void musb_gadget_cleanup(struct m
 
 extern void musb_g_giveback(struct musb_ep *, struct usb_request *, int);
 
+extern void musb_ep_restart(struct musb *, struct musb_request *);
+
 #endif		/* __MUSB_GADGET_H */
Index: linux-davinci/drivers/usb/musb/musb_gadget_ep0.c
===================================================================
--- linux-davinci.orig/drivers/usb/musb/musb_gadget_ep0.c
+++ linux-davinci/drivers/usb/musb/musb_gadget_ep0.c
@@ -261,6 +261,7 @@  __acquires(musb->lock)
 					ctrlrequest->wIndex & 0x0f;
 				struct musb_ep		*musb_ep;
 				struct musb_hw_ep	*ep;
+				struct musb_request	*request;
 				void __iomem		*regs;
 				int			is_in;
 				u16			csr;
@@ -302,6 +303,14 @@  __acquires(musb->lock)
 					musb_writew(regs, MUSB_RXCSR, csr);
 				}
 
+				/* Maybe start the first request in the queue */
+				request = to_musb_request(
+						next_request(musb_ep));
+				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;