From patchwork Sat Sep 11 18:23:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 172542 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8BIQ5HU018285 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 11 Sep 2010 18:26:27 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o8BIO2IE011053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Sep 2010 13:24:02 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id o8BIO1B0000931; Sat, 11 Sep 2010 13:24:01 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 7494C80627; Sat, 11 Sep 2010 13:24:01 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id D0CC980626 for ; Sat, 11 Sep 2010 13:23:59 -0500 (CDT) Received: from red.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id o8BINxLu029384 for ; Sat, 11 Sep 2010 13:23:59 -0500 (CDT) Received: from psmtp.com (na3sys009amx205.postini.com [74.125.149.45]) by red.ext.ti.com (8.13.7/8.13.7) with SMTP id o8BINwou025215 for ; Sat, 11 Sep 2010 13:23:58 -0500 Received: from source ([213.79.90.226]) by na3sys009amx205.postini.com ([74.125.148.10]) with SMTP; Sat, 11 Sep 2010 11:23:58 PDT Received: (qmail 12697 invoked from network); 11 Sep 2010 18:24:05 -0000 Received: from unknown (HELO wasted.dev.rtsoft.ru) (192.168.1.70) by 0 with SMTP; 11 Sep 2010 18:24:05 -0000 To: linux-usb@vger.kernel.org, balbi@ti.com Subject: [PATCH] musb_gadget: restart request on clearing endpoint halt Content-Disposition: inline From: Sergei Shtylyov Organization: MontaVista Software Inc. Date: Sat, 11 Sep 2010 22:23:12 +0400 MIME-Version: 1.0 Message-Id: <201009112223.12768.sshtylyov@ru.mvista.com> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:48.41627/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: davinci-linux-open-source@linux.davincidsp.com, gregkh@suse.de, stable@kernel.org X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 11 Sep 2010 18:26:27 +0000 (UTC) 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;