From patchwork Wed Apr 16 21:26:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 28510 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 80DFE206A6 for ; Wed, 16 Apr 2014 21:29:48 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id pa12sf41525311veb.8 for ; Wed, 16 Apr 2014 14:29:48 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=8p2OmplmnoT29RMZTLvgaZN65GXePP/qP8Dd4zLY314=; b=WFd46xtOD3bZd5OevbuvkaHjKiUxsJixvG/4FI8bPIejgIW+QAFgKaPmGEx0Me6/AU jkSN/nazbzrFfgvTA5SsCjzwUAowaRCKG/XPWvErTlvYtWyqnAiLWvB4J+jYHzf0Jg6s xHTsiPwhXyPcE13FInNndGC6hVHytrjYM9fomI0ctteHjnYJrO6sAjpqhSs+wc4DYI7P gefqmwbHfXgcYpa5Ojh8ZsvF8lXTx2J8iP23UdJYYfU1z/FhYNLP++Pnvk4QO3KT7VdE ob5t94VcSS0LpjIb25QSQGHm861ql07JOa3aPE2FuORVeJ6QyLzrZt1Ipd0MyG/wsnDH bP4A== X-Gm-Message-State: ALoCoQnLzmXDOeGYrJqo4Cx7CWG/Z4UnqVmfetWeBuNSVX0BlU2pyBO0jl4Ur0xRYJQNfKStNJcF X-Received: by 10.236.144.136 with SMTP id n8mr4744219yhj.22.1397683788274; Wed, 16 Apr 2014 14:29:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.69 with SMTP id e63ls875115qgd.29.gmail; Wed, 16 Apr 2014 14:29:48 -0700 (PDT) X-Received: by 10.52.78.231 with SMTP id e7mr3260678vdx.28.1397683788169; Wed, 16 Apr 2014 14:29:48 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id u5si4071803vdo.130.2014.04.16.14.29.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Apr 2014 14:29:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id im17so11383279vcb.37 for ; Wed, 16 Apr 2014 14:29:48 -0700 (PDT) X-Received: by 10.58.38.166 with SMTP id h6mr3842456vek.22.1397683788068; Wed, 16 Apr 2014 14:29:48 -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.220.221.72 with SMTP id ib8csp343937vcb; Wed, 16 Apr 2014 14:29:47 -0700 (PDT) X-Received: by 10.68.200.133 with SMTP id js5mr11259239pbc.138.1397683787386; Wed, 16 Apr 2014 14:29:47 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wh4si13394265pbc.305.2014.04.16.14.29.46; Wed, 16 Apr 2014 14:29:46 -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 S1161228AbaDPV3j (ORCPT + 3 others); Wed, 16 Apr 2014 17:29:39 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:55904 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755156AbaDPV3R (ORCPT ); Wed, 16 Apr 2014 17:29:17 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3GLSqNO027483; Wed, 16 Apr 2014 16:28:52 -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 s3GLSqa9011284; Wed, 16 Apr 2014 16:28:52 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Wed, 16 Apr 2014 16:28:52 -0500 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 s3GLSpxS029919; Wed, 16 Apr 2014 16:28:51 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Greg KH , , Linux OMAP Mailing List , Kishon Vijay Abraham I , Roger Quadros , George Cherian , , , , , David Cohen , Felipe Balbi , Subject: [PATCH 1/8] usb: dwc3: gadget: clear stall when disabling endpoint Date: Wed, 16 Apr 2014 16:26:28 -0500 Message-ID: <1397683595-3606-2-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.9.2.459.g68773ac In-Reply-To: <1397683595-3606-1-git-send-email-balbi@ti.com> References: <1397683595-3606-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.178 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: , so it seems like DWC3 IP doesn't clear stalls automatically when we disable an endpoint, because of that, we _must_ make sure stalls are cleared before clearing the proper bit in DALEPENA register. Cc: # v3.4+ Reported-by: Johannes Stezenbach Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index a740eac..f0dc0ee 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -608,6 +608,10 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) dwc3_remove_requests(dwc, dep); + /* make sure HW endpoint isn't stalled */ + if (dep->flags & DWC3_EP_STALL) + __dwc3_gadget_ep_set_halt(dep, 0); + reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); reg &= ~DWC3_DALEPENA_EP(dep->number); dwc3_writel(dwc->regs, DWC3_DALEPENA, reg);