From patchwork Mon Jul 12 11:05:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minas Harutyunyan X-Patchwork-Id: 12370719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03F42C07E99 for ; Mon, 12 Jul 2021 11:05:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA1B661003 for ; Mon, 12 Jul 2021 11:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234966AbhGLLIb (ORCPT ); Mon, 12 Jul 2021 07:08:31 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:39392 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbhGLLI3 (ORCPT ); Mon, 12 Jul 2021 07:08:29 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 9A3B0C0556; Mon, 12 Jul 2021 11:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1626087941; bh=d0abQrR6HahCK2W+3V86zoqY2C2jJO+56m9oBkXVUGQ=; h=Date:From:Subject:To:Cc:From; b=Jc2o8Lpq7soSaPhWSSlCW1I3AkKxL1pWPeLNQfyQo02RvJ5f6TWI8HfEA1JhFFdDq RWYk9ZEFZt4TCrDA1nywcXuHWzx0WC8Gp2cI2k1Eq/76lbw1CtlfhPDTtDRyhf1svr k3FKbDsuN8FyvH5Wk56odyGeY3jUOyl2FNrx/1eexKca0lYNb8bujhuxJurshj83nq hze5dhmVenKYKgg7Rxgs/Y2+ZCEgdT+rY8VBUqc2cgui/rnMlT80e//ZZ7T3cbOGcY MWaHC2rPBl7bDamg9aQiOqVMKOMxAtPo571FYfF+Ev1ocXQ6QGqiDo4aGWIFe1YV6Q hOFkYaj7hRY0g== Received: from hminas-z420 (hminas-z420.internal.synopsys.com [10.116.75.77]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by mailhost.synopsys.com (Postfix) with ESMTPSA id 08164A005D; Mon, 12 Jul 2021 11:05:37 +0000 (UTC) Received: by hminas-z420 (sSMTP sendmail emulation); Mon, 12 Jul 2021 15:05:36 +0400 Date: Mon, 12 Jul 2021 15:05:36 +0400 Message-Id: <106acd249c1a5db9e106010d21b51cdda3a21354.1626087098.git.Minas.Harutyunyan@synopsys.com> X-SNPS-Relay: synopsys.com From: Minas Harutyunyan Subject: [PATCH v3] usb: dwc2: gadget: Fix sending zero length packet in DDMA mode. To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , Paul Zimmerman , linux-usb@vger.kernel.org, Mian Yousaf Kaukab , Gregory Herrero Cc: John Youn , Minas Harutyunyan , Robert Baldyga Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Sending zero length packet in DDMA mode perform by DMA descriptor by setting SP (short packet) flag. For DDMA in function dwc2_hsotg_complete_in() does not need to send zlp. Tested by USBCV MSC tests. Fixes: f71b5e2533de ("usb: dwc2: gadget: fix zero length packet transfers") Signed-off-by: Minas Harutyunyan --- Changes in v3: - Updated mail recipient list Changes in v2: - Minor typo correction in comments drivers/usb/dwc2/gadget.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) base-commit: 89c222503a5bda476be00a2668abd7ea435e1cfa diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index c581ee41ac81..bf456b4e191f 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2749,9 +2749,11 @@ static void dwc2_hsotg_complete_in(struct dwc2_hsotg *hsotg, return; } - /* Zlp for all endpoints, for ep0 only in DATA IN stage */ + /* Zlp for all endpoints in non DDMA, for ep0 only in DATA IN stage */ if (hs_ep->send_zlp) { - dwc2_hsotg_program_zlp(hsotg, hs_ep); + if (!using_desc_dma(hsotg)) + dwc2_hsotg_program_zlp(hsotg, hs_ep); + hs_ep->send_zlp = 0; /* transfer will be completed on next complete interrupt */ return;