From patchwork Tue Feb 25 19:40:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 25310 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9597C2066E for ; Tue, 25 Feb 2014 19:42:26 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id hu8sf15505917vcb.2 for ; Tue, 25 Feb 2014 11:42:26 -0800 (PST) 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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=o2EivQP0Gc3DtVq4cCEOZ4KJSBZJISR2OivglhecSMU=; b=WPGIhgtdsZNMsJp94qz2j0T2tGv+1gBgNfcp74bbLILsHreeQ2e75iukP8cFd8GGDk vhMbhYugiwZeqUz3n+mapN8ERQGOZkpBBfgeW0SIhdG6H6GW4g6WwUFBwcdVHT/8Kt+j bqKEXt/AZni6RQHgEsX66YPPX1FlDr/cjIcnh+Ro0b69ARaMLrYoAWaZw36Z5h/s1AZC 19u4goToTLnb8/IEPmP/3ovU48Pcypz/PGq+5Y+PXxJ+OwUvew3qJcitQPo2EOQ73VF7 XzKo484P5bvaeqqXFehEvKqCCggfXakj6cNNeajgLvMsexnWnEz5nSlfGqyCsZSNFNQZ ro7Q== X-Gm-Message-State: ALoCoQk0aqhp1kyiNyJOwnRqPhlcabB09gDzxKDMTCiw1GcCpQuTpdfEKU1HMGhcYAGvW+S8VHs0 X-Received: by 10.58.171.135 with SMTP id au7mr1504409vec.22.1393357346349; Tue, 25 Feb 2014 11:42:26 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.9 with SMTP id l9ls2665416qga.13.gmail; Tue, 25 Feb 2014 11:42:26 -0800 (PST) X-Received: by 10.58.169.7 with SMTP id aa7mr2447211vec.24.1393357346212; Tue, 25 Feb 2014 11:42:26 -0800 (PST) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id cp10si7080779ved.134.2014.02.25.11.42.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 11:42:26 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hq11so7960650vcb.28 for ; Tue, 25 Feb 2014 11:42:26 -0800 (PST) X-Received: by 10.58.119.161 with SMTP id kv1mr2367510veb.21.1393357346057; Tue, 25 Feb 2014 11:42:26 -0800 (PST) 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.220.174.196 with SMTP id u4csp163122vcz; Tue, 25 Feb 2014 11:42:25 -0800 (PST) X-Received: by 10.69.31.97 with SMTP id kl1mr1753164pbd.62.1393357344854; Tue, 25 Feb 2014 11:42:24 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gp2si21476007pac.70.2014.02.25.11.42.24; Tue, 25 Feb 2014 11:42:24 -0800 (PST) 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 S1753535AbaBYTmV (ORCPT + 3 others); Tue, 25 Feb 2014 14:42:21 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:46907 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753421AbaBYTmU (ORCPT ); Tue, 25 Feb 2014 14:42:20 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s1PJgJIv026275; Tue, 25 Feb 2014 13:42:19 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s1PJgJSn005578; Tue, 25 Feb 2014 13:42:19 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Tue, 25 Feb 2014 13:42:18 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s1PJgI0m004288; Tue, 25 Feb 2014 13:42:18 -0600 From: Felipe Balbi To: Linux USB Mailing List CC: Paul Zimmerman , Paul Zimmerman , Felipe Balbi Subject: [PATCH 11/11] usb: dwc3: gadget: add 'force' argument to stop_active_transfer Date: Tue, 25 Feb 2014 13:40:43 -0600 Message-ID: <1393357243-2958-12-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1393357243-2958-1-git-send-email-balbi@ti.com> References: <1393357243-2958-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=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=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: , From: Paul Zimmerman It's not always we need to force a transfer to be removed from the core's internal cache. This extra argument will help differentiating those two cases. Signed-off-by: Paul Zimmerman Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index d307ad7..edc15cd 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -590,13 +590,13 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, return 0; } -static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum); +static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force); static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) { struct dwc3_request *req; if (!list_empty(&dep->req_queued)) { - dwc3_stop_active_transfer(dwc, dep->number); + dwc3_stop_active_transfer(dwc, dep->number, true); /* - giveback all requests to gadget driver */ while (!list_empty(&dep->req_queued)) { @@ -1119,7 +1119,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) */ if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { if (list_empty(&dep->req_queued)) { - dwc3_stop_active_transfer(dwc, dep->number); + dwc3_stop_active_transfer(dwc, dep->number, true); dep->flags = DWC3_EP_ENABLED; } return 0; @@ -1205,7 +1205,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, } if (r == req) { /* wait until it is processed */ - dwc3_stop_active_transfer(dwc, dep->number); + dwc3_stop_active_transfer(dwc, dep->number, true); goto out1; } dev_err(dwc->dev, "request %p was not queued to %s\n", @@ -1920,7 +1920,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, */ dep->flags = DWC3_EP_PENDING_REQUEST; } else { - dwc3_stop_active_transfer(dwc, dep->number); + dwc3_stop_active_transfer(dwc, dep->number, true); dep->flags = DWC3_EP_ENABLED; } return 1; @@ -2070,7 +2070,7 @@ static void dwc3_disconnect_gadget(struct dwc3 *dwc) } } -static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum) +static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force) { struct dwc3_ep *dep; struct dwc3_gadget_ep_cmd_params params; @@ -2102,7 +2102,8 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum) */ cmd = DWC3_DEPCMD_ENDTRANSFER; - cmd |= DWC3_DEPCMD_HIPRI_FORCERM | DWC3_DEPCMD_CMDIOC; + cmd |= force ? DWC3_DEPCMD_HIPRI_FORCERM : 0; + cmd |= DWC3_DEPCMD_CMDIOC; cmd |= DWC3_DEPCMD_PARAM(dep->resource_index); memset(¶ms, 0, sizeof(params)); ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, ¶ms);