From patchwork Tue Sep 15 17:52:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 53695 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 77D1622DEA for ; Tue, 15 Sep 2015 17:52:33 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf11050633wic.3 for ; Tue, 15 Sep 2015 10:52:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=RC8ko1ZunOYxPgba3auKKAZ2gFKbahplDkwT18TufFk=; b=kDjw3ynWgQjOs9UjHbK6UQ2cUHwZXdRkUkyloE80A3OzM7HZbzCpx3OExicYxBqtSv QHUoTiEbI6PEESr5hONvw+bpb+j5uYbDJsLGmxZows55fDrbi/iXm/VTcaa4aj1LeNE7 EU13BrmYQhvox3c+C8qHgs2S+avTLBkEq6s1nyvV6gvopyj+e5Gui+q649qRH28SUz90 NJdFiiYCVaMTE49S5tlSut2GWHNOzI4a/2++fX3GYAAZqJKciNq691pAboKrQi2/de+A XSN0K6N3qfcLg6/E0UyfCl69+dz6oqYh/WWehk41r7veupupnYa/6APpSAATq296RGEP hx+g== X-Gm-Message-State: ALoCoQl9Qjx2wa1cqERYC6ST51MHaV5a+Fp5NlhUm6TDFS2aDKi+GGqezx2pqPg4lRsHVTVmzYqF X-Received: by 10.194.115.135 with SMTP id jo7mr4532601wjb.7.1442339552695; Tue, 15 Sep 2015 10:52:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.166 with SMTP id w6ls16961lae.10.gmail; Tue, 15 Sep 2015 10:52:32 -0700 (PDT) X-Received: by 10.152.21.129 with SMTP id v1mr6739305lae.87.1442339552518; Tue, 15 Sep 2015 10:52:32 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id wp2si15095114lbb.136.2015.09.15.10.52.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 10:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lamp12 with SMTP id p12so111669384lam.0 for ; Tue, 15 Sep 2015 10:52:32 -0700 (PDT) X-Received: by 10.152.26.41 with SMTP id i9mr23345626lag.36.1442339552381; Tue, 15 Sep 2015 10:52:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1949304lbq; Tue, 15 Sep 2015 10:52:31 -0700 (PDT) X-Received: by 10.68.137.35 with SMTP id qf3mr49908097pbb.89.1442339551143; Tue, 15 Sep 2015 10:52:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qp7si33602949pbc.93.2015.09.15.10.52.30; Tue, 15 Sep 2015 10:52:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751612AbbIORw1 (ORCPT + 4 others); Tue, 15 Sep 2015 13:52:27 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:43662 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751622AbbIORw0 (ORCPT ); Tue, 15 Sep 2015 13:52:26 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8FHqQdx003758 for ; Tue, 15 Sep 2015 12:52:26 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FHqQ5E026427 for ; Tue, 15 Sep 2015 12:52:26 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Tue, 15 Sep 2015 12:52:26 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FHqPfs005472; Tue, 15 Sep 2015 12:52:25 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 2/5] usb: dwc3: gadget: start using Update Transfer more often Date: Tue, 15 Sep 2015 12:52:19 -0500 Message-ID: <1442339542-17090-3-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442339542-17090-1-git-send-email-balbi@ti.com> References: <1442339542-17090-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We can infer Update Transfer by the fact that req_queue is empty and DWC3_EP_BUSY isn't set. This let's us a) rely on Update Transfer more often (should be good for deeper queue lengths) and b) remove the extra start_new parameter (done on a follow-up patch) Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 14cb982235b7..a0d3a4e762c5 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -950,24 +950,20 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param, } dep->flags &= ~DWC3_EP_PENDING_REQUEST; + cmd = DWC3_DEPCMD_UPDATETRANSFER | + DWC3_DEPCMD_PARAM(cmd_param); + /* * If we are getting here after a short-out-packet we don't enqueue any * new requests as we try to set the IOC bit only on the last request. */ - if (start_new) { - if (list_empty(&dep->req_queued)) - dwc3_prepare_trbs(dep, start_new); - - /* req points to the first request which will be sent */ - req = next_request(&dep->req_queued); - } else { + if (list_empty(&dep->req_queued) && + !(dep->flags & DWC3_EP_BUSY)) { dwc3_prepare_trbs(dep, start_new); - - /* - * req points to the first request where HWO changed from 0 to 1 - */ - req = next_request(&dep->req_queued); + cmd = DWC3_DEPCMD_STARTTRANSFER; } + + req = next_request(&dep->req_queued); if (!req) { dep->flags |= DWC3_EP_PENDING_REQUEST; return 0; @@ -975,15 +971,11 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param, memset(¶ms, 0, sizeof(params)); - if (start_new) { + if (cmd == DWC3_DEPCMD_STARTTRANSFER) { params.param0 = upper_32_bits(req->trb_dma); params.param1 = lower_32_bits(req->trb_dma); - cmd = DWC3_DEPCMD_STARTTRANSFER; - } else { - cmd = DWC3_DEPCMD_UPDATETRANSFER; } - cmd |= DWC3_DEPCMD_PARAM(cmd_param); ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, ¶ms); if (ret < 0) { dev_dbg(dwc->dev, "failed to send STARTTRANSFER command\n");