Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753375AbdC1OMq (ORCPT ); Tue, 28 Mar 2017 10:12:46 -0400 Received: from smtprelay2.synopsys.com ([198.182.60.111]:57659 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800AbdC1OMo (ORCPT ); Tue, 28 Mar 2017 10:12:44 -0400 Date: Tue, 28 Mar 2017 22:04:34 +0400 Message-ID: <07102b18cb19dd576017b0259a2fb54a663af39f.1490723930.git.hminas@synopsys.com> From: Minas Harutyunyan Subject: [PATCH] dwc2: gadget: Fix in control write transfers To: John Youn , Felipe Balbi , "Greg Kroah-Hartman" , , CC: Minas Harutyunyan MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.13.184.19] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1764 Lines: 57 After data out stage gadget driver should not initate ZLP on control EP, because it is up to function driver. Signed-off-by: Minas Harutyunyan --- drivers/usb/dwc2/gadget.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 98a4a79e7f6e..b7520fa3725b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1369,6 +1369,11 @@ static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, return 0; } + /* Change EP direction if status phase request is after data out */ + if (!hs_ep->index && !req->length && !hs_ep->dir_in && + (hs->ep0_state == DWC2_EP0_DATA_OUT)) + hs_ep->dir_in = 1; + if (first) { if (!hs_ep->isochronous) { dwc2_hsotg_start_req(hs, hs_ep, hs_req, false); @@ -2327,14 +2332,6 @@ static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum) */ } - /* DDMA IN status phase will start from StsPhseRcvd interrupt */ - if (!using_desc_dma(hsotg) && epnum == 0 && - hsotg->ep0_state == DWC2_EP0_DATA_OUT) { - /* Move to STATUS IN */ - dwc2_hsotg_ep0_zlp(hsotg, true); - return; - } - /* * Slave mode OUT transfers do not go through XferComplete so * adjust the ISOC parity here. @@ -2997,14 +2994,9 @@ static void dwc2_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx, } } - if (ints & DXEPINT_STSPHSERCVD) { + if (ints & DXEPINT_STSPHSERCVD) dev_dbg(hsotg->dev, "%s: StsPhseRcvd\n", __func__); - /* Move to STATUS IN for DDMA */ - if (using_desc_dma(hsotg)) - dwc2_hsotg_ep0_zlp(hsotg, true); - } - if (ints & DXEPINT_BACK2BACKSETUP) dev_dbg(hsotg->dev, "%s: B2BSetup/INEPNakEff\n", __func__); -- 2.11.0