From patchwork Tue Sep 15 19:16:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 53701 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 0470F22A0D for ; Tue, 15 Sep 2015 19:16:21 +0000 (UTC) Received: by wisv5 with SMTP id v5sf12046118wis.0 for ; Tue, 15 Sep 2015 12:16:20 -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=zWic0X5jlWrncTyGaN0Tv/8k6UrZIIDMT4caxIjXBpo=; b=lFrM89B1iaLhgymgWPE4Yhm67kqvZDg2u8KTdlIDTNbppe0B4BoL3dtGGHIy/wlqg1 Wap9KqlzgcKqLnKSFX/Yr3+UorHLVxMM6ZwZzzevaD8bERV7c71PYmjahUFOtmu/xooX YU7xmGMw/sMGir6U6rhlH+gu84+/zUxILp3//zBrQh81U6OFuz5yd9Kq2SlAy033YDz2 1yETEn/Ylvv9D/gmwRstfocQ8x2z3gV86KJb7/FldbGE94UxwFaExBkSDaSEvlwL/gnq SUpkmnTR9KD79ESw47/w+Cohk7HF7oktkaNNA50sJpG9Vhg7KQMVli/yXYuavccbk/rm aBxw== X-Gm-Message-State: ALoCoQk45htWqwLfOEVdH4NLL81flhcmJ8Wu2o3sYcPrkMUNOjQw0P2nD1zd0HocZET9jJqg3fJZ X-Received: by 10.112.26.212 with SMTP id n20mr4644854lbg.2.1442344580217; Tue, 15 Sep 2015 12:16:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.138 with SMTP id lc10ls493332lab.90.gmail; Tue, 15 Sep 2015 12:16:19 -0700 (PDT) X-Received: by 10.112.168.66 with SMTP id zu2mr23987016lbb.29.1442344579933; Tue, 15 Sep 2015 12:16:19 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id wp2si15439219lbb.136.2015.09.15.12.16.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 12:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbvu2 with SMTP id vu2so18958575lbb.0 for ; Tue, 15 Sep 2015 12:16:19 -0700 (PDT) X-Received: by 10.152.161.232 with SMTP id xv8mr24587250lab.32.1442344579829; Tue, 15 Sep 2015 12:16:19 -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 w3csp1990086lbq; Tue, 15 Sep 2015 12:16:18 -0700 (PDT) X-Received: by 10.50.143.10 with SMTP id sa10mr9018211igb.66.1442344577040; Tue, 15 Sep 2015 12:16:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si13572503igo.56.2015.09.15.12.16.16; Tue, 15 Sep 2015 12:16:17 -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 S1752025AbbIOTQO (ORCPT + 4 others); Tue, 15 Sep 2015 15:16:14 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:36347 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbbIOTQN (ORCPT ); Tue, 15 Sep 2015 15:16:13 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8FJGCI3020629 for ; Tue, 15 Sep 2015 14:16:12 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FJGC3q002744 for ; Tue, 15 Sep 2015 14:16:12 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Tue, 15 Sep 2015 14:16:12 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FJGBtS023906; Tue, 15 Sep 2015 14:16:12 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH v2 2/5] usb: dwc3: gadget: start using Update Transfer more often Date: Tue, 15 Sep 2015 14:16:05 -0500 Message-ID: <1442344568-1820-3-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442344568-1820-1-git-send-email-balbi@ti.com> References: <1442344568-1820-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.217.177 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 d28dc6df4e55..6df473427b6d 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");