From patchwork Wed Sep 17 01:13:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 37500 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8D3DD2057E for ; Wed, 17 Sep 2014 01:14:33 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf357679lbg.9 for ; Tue, 16 Sep 2014 18:14: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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=oRA/vKBOBqQu8KNfIqRyAx2cE9kXhR7gFIHbp3pJuw8=; b=JDze0a3dW7jYpGrpdOtEIsjzA3dpJ5AnPLiwJeBYuSUpzGO0Mji8yEuH2w2D4VzKfU Noru7GTOcL42/tfuinBDxRUXjBOG1Z1iHli/OdqwfE4rsBVkpKxQJ5CtXLZlyMZIVLqH e3lvtnDXe4FGIM8uyasHQFCnOumVpxnOcgAzJEJLVWePQTO4WI27oIEPSwL4m9EnzCwa iyb9QhMMZD3hTofLW3SR42Y42CxVstLoeW0JLaaa38fqFjXzGo+7qfA+CrZ1mzDTMisd wnhqhrund49Fj2szk+O+BmQSL+8XCCKrbskUyngwHtts0ToEPXQ3+pg5N1R+VAPCwc6U y3+A== X-Gm-Message-State: ALoCoQl281tFir+xINGK5VyhGNcBOVt5TeCXTDLUwQ/IlBCCnT5wbcv0bAr7mtbK5rVei0diVQtl X-Received: by 10.112.199.169 with SMTP id jl9mr4008lbc.24.1410916471965; Tue, 16 Sep 2014 18:14:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.101 with SMTP id l5ls51723lam.103.gmail; Tue, 16 Sep 2014 18:14:31 -0700 (PDT) X-Received: by 10.112.219.71 with SMTP id pm7mr38204670lbc.3.1410916471688; Tue, 16 Sep 2014 18:14:31 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by mx.google.com with ESMTPS id ep11si26500550lac.50.2014.09.16.18.14.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 18:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id gi9so903073lab.10 for ; Tue, 16 Sep 2014 18:14:31 -0700 (PDT) X-Received: by 10.112.48.100 with SMTP id k4mr42408lbn.95.1410916471575; Tue, 16 Sep 2014 18:14:31 -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.130.169 with SMTP id of9csp495577lbb; Tue, 16 Sep 2014 18:14:30 -0700 (PDT) X-Received: by 10.70.89.206 with SMTP id bq14mr33729393pdb.123.1410916470112; Tue, 16 Sep 2014 18:14:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gz10si32246191pbd.137.2014.09.16.18.14.29 for ; Tue, 16 Sep 2014 18:14:30 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754506AbaIQBO2 (ORCPT + 2 others); Tue, 16 Sep 2014 21:14:28 -0400 Received: from mail-bl2on0106.outbound.protection.outlook.com ([65.55.169.106]:24705 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753452AbaIQBO0 (ORCPT ); Tue, 16 Sep 2014 21:14:26 -0400 Received: from BN3PR0301CA0033.namprd03.prod.outlook.com (25.160.180.171) by CY1PR0301MB0778.namprd03.prod.outlook.com (25.160.160.139) with Microsoft SMTP Server (TLS) id 15.0.1029.13; Wed, 17 Sep 2014 01:14:23 +0000 Received: from BN1BFFO11FD028.protection.gbl (2a01:111:f400:7c10::1:187) by BN3PR0301CA0033.outlook.office365.com (2a01:111:e400:4000::43) with Microsoft SMTP Server (TLS) id 15.0.1029.13 via Frontend Transport; Wed, 17 Sep 2014 01:14:22 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD028.mail.protection.outlook.com (10.58.144.91) with Microsoft SMTP Server (TLS) id 15.0.1019.14 via Frontend Transport; Wed, 17 Sep 2014 01:14:22 +0000 Received: from peterchendt.ap.freescale.net ([10.192.185.57]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s8H1EDeT003539; Tue, 16 Sep 2014 18:14:19 -0700 From: Peter Chen To: CC: , , , Peter Chen Subject: [PATCH 01/17] usb: dwc3: gadget: use udc-core's reset notifier Date: Wed, 17 Sep 2014 09:13:54 +0800 Message-ID: <1410916450-31611-2-git-send-email-peter.chen@freescale.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1410916450-31611-1-git-send-email-peter.chen@freescale.com> References: <1410916450-31611-1-git-send-email-peter.chen@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(83322001)(19580395003)(83072002)(93916002)(21056001)(79102003)(95666004)(26826002)(229853001)(77982003)(6806004)(68736004)(85306004)(19580405001)(4396001)(106466001)(99396002)(74662003)(62966002)(74502003)(97736003)(31966008)(89996001)(88136002)(36756003)(81342003)(80022003)(46102003)(81542003)(104166001)(90102001)(104016003)(76482002)(76176999)(50466002)(33646002)(85852003)(20776003)(50986999)(87286001)(64706001)(92566001)(84676001)(50226001)(92726001)(105606002)(110136001)(48376002)(2351001)(87936001)(77156001)(86362001)(102836001)(107046002)(44976005)(47776003); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB0778; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 0337AFFE9A Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; X-OriginatorOrg: freescale.com 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: patch@linaro.org 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.51 as permitted sender) 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: Felipe Balbi Replace usb_gadget_driver's disconnect with udc-core's reset notifier at bus reset handler. Signed-off-by: Felipe Balbi Signed-off-by: Peter Chen --- drivers/usb/dwc3/gadget.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f2dbaca..90544a2 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2032,6 +2032,17 @@ static void dwc3_resume_gadget(struct dwc3 *dwc) if (dwc->gadget_driver && dwc->gadget_driver->resume) { spin_unlock(&dwc->lock); dwc->gadget_driver->resume(&dwc->gadget); + } +} + +static void dwc3_reset_gadget(struct dwc3 *dwc) +{ + if (!dwc->gadget_driver) + return; + + if (dwc->gadget.speed != USB_SPEED_UNKNOWN) { + spin_unlock(&dwc->lock); + usb_gadget_udc_reset(&dwc->gadget, dwc->gadget_driver); spin_lock(&dwc->lock); } } @@ -2175,11 +2186,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) dwc3_gadget_disconnect_interrupt(dwc); } - /* after reset -> Default State */ - usb_gadget_set_state(&dwc->gadget, USB_STATE_DEFAULT); - - if (dwc->gadget.speed != USB_SPEED_UNKNOWN) - dwc3_disconnect_gadget(dwc); + dwc3_reset_gadget(dwc); reg = dwc3_readl(dwc->regs, DWC3_DCTL); reg &= ~DWC3_DCTL_TSTCTRL_MASK;