Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp791468pxb; Thu, 17 Feb 2022 15:03:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWhjFZqqiaZ1k9sFz1T9vNrX3GotOmrjs941rU06yJz8zUFqvSpZzlfw8GTnQnVm1P7+ZU X-Received: by 2002:a05:6870:912c:b0:d3:44be:7256 with SMTP id o44-20020a056870912c00b000d344be7256mr2051614oae.73.1645139016674; Thu, 17 Feb 2022 15:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645139016; cv=none; d=google.com; s=arc-20160816; b=WD7/IBrCxAwL804NMVJgjZnKHiiUvAD3Ang88PimQUGlvZGAIBICo3kOROVhM9U9HC 7wFcO6w/XaTDPnaOcMOSomkJg20CDl6aPo7Pove1+ai1s1LbOo5WrhGDUY5a1o9Cxd8V cQmt7E9Amk5QIRVN8Vlio230AdlYxAIXtuvH8R4xU8Pxll8OwYVkLdhR0lwhC+Z3/sui H0uBah+2RgNhFtXol6XR8v7RTFAqKI4zFhUYeWdd2+YUucaFWHOm2Pxyzor/YQHmSdVn 7nXGPgcFFC6/ALYg9AA09NGhD4HN8QoL9MpJWhOH0tj8RKe4JRl4rTYBRQbLRtCp7Kyd WPRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:user-agent :in-reply-to:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=fE01e/NtX+AjCnJ40sfy/JMNDKNIr5kI5yo/skDy1Sw=; b=IYxTWk4HyeGBwBfQY3WPWBOYA2vS4KlvUpIBnQC2B1gRG4jM2iqjnp9u61kMvhGIY3 +8L0gS6UeXAqHqGUoHndwVPT/Y+/QSxG7y3PaAsw5sJ7Q2JpSWvOKku6+TuXDdAIpkGu j9Kg4C1vDO4qiJg6gnnNK/Wtk4CMwLvtOxbvk654OPWbXNkMg2+qTMuHz79gpcHLyoli NHRCF9uCACnSsZm3TF7J65zMZEn7YrAmmCjNEnAIBT5aZX4SoEIDjzvm4/7lstda/cZ7 dhBQpjhgrvr5w8WwrmGQONj1SfFKdDkjEYc/DceKVPG8Z6J3B50v7RSrzSHtzpaoY9Uv PywA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=INNWaamU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bk37si616892oib.236.2022.02.17.15.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:03:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=INNWaamU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7134127DF2B; Thu, 17 Feb 2022 14:59:13 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbiBQFzD (ORCPT + 99 others); Thu, 17 Feb 2022 00:55:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbiBQFzC (ORCPT ); Thu, 17 Feb 2022 00:55:02 -0500 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54B152838E6 for ; Wed, 16 Feb 2022 21:54:46 -0800 (PST) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220217055440epoutp047cb76c795a2327d2eab5e4e63b529b6f~UfRH5wWBy2654026540epoutp048 for ; Thu, 17 Feb 2022 05:54:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220217055440epoutp047cb76c795a2327d2eab5e4e63b529b6f~UfRH5wWBy2654026540epoutp048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1645077280; bh=fE01e/NtX+AjCnJ40sfy/JMNDKNIr5kI5yo/skDy1Sw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=INNWaamUzeQW+8xkk5GRTT3QS4BST+YmG1d7bRkBkfbAff1URLHCHGd+ZX8vd4OH2 60gddQkLKkCayz2GrIC5Awhdd8YZg+/qHskkxVB1m7/15PVT10/pXNS0PCXzJK2ePh UkH3kqxVymoCWAMw7+I5Js48IIwPYSvUEbn3gzuM= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220217055439epcas2p1b2a0d0dba45bf0e108a3aa5877e75106~UfRHTxurH2809228092epcas2p1G; Thu, 17 Feb 2022 05:54:39 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.91]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4JzkYT4V4zz4x9Pq; Thu, 17 Feb 2022 05:54:37 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id E8.DB.25540.0D0ED026; Thu, 17 Feb 2022 14:44:48 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20220217055434epcas2p3b85d195b91d2bbb4dcfea2787d50039b~UfRDFrghV1402214022epcas2p3S; Thu, 17 Feb 2022 05:54:34 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220217055434epsmtrp1432962b2c003b6df428bf4a23d2f711e~UfRDEqb591385113851epsmtrp1T; Thu, 17 Feb 2022 05:54:34 +0000 (GMT) X-AuditID: b6c32a47-81bff700000063c4-85-620de0d03253 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 1B.D3.08738.A13ED026; Thu, 17 Feb 2022 14:54:34 +0900 (KST) Received: from ubuntu (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220217055434epsmtip13561f8415a14f506e3e88d704e67e51d~UfRCzxXJ10186201862epsmtip1I; Thu, 17 Feb 2022 05:54:34 +0000 (GMT) Date: Thu, 17 Feb 2022 14:52:14 +0900 From: Jung Daehwan To: Wesley Cheng Cc: balbi@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, quic_jackp@quicinc.com, Thinh.Nguyen@synopsys.com Subject: Re: [RFC PATCH v2 3/3] usb: dwc3: Issue core soft reset before enabling run/stop Message-ID: <20220217055214.GA152781@ubuntu> MIME-Version: 1.0 In-Reply-To: <20220216000835.25400-4-quic_wcheng@quicinc.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOJsWRmVeSWpSXmKPExsWy7bCmue6FB7xJBt/brS2OtT1ht2hevJ7N 4vKuOWwWi5a1Mlvs+reIyWLT7j5Wi1ULDrA7sHtsWtXJ5rF/7hp2j4l76jy27P/M6PF5k1wA a1S2TUZqYkpqkUJqXnJ+SmZeuq2Sd3C8c7ypmYGhrqGlhbmSQl5ibqqtkotPgK5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WsxFxYkAltmHfSoEAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDLMWRmVeSWpSXmKPExsWy7bCSnK7UY94kgyNLtCyOtT1ht2hevJ7N 4vKuOWwWi5a1Mlvs+reIyWLT7j5Wi1ULDrA7sHtsWtXJ5rF/7hp2j4l76jy27P/M6PF5k1wA axSXTUpqTmZZapG+XQJXxpZLn9kLDohV7OsQaWBcJ9TFyMkhIWAi0de7nKmLkYtDSGAHo8TK le3sEAlJiaVzb0DZwhL3W46wQhQ9YpT4+fQ7M0iCRUBVYu/hdiYQm01AS+LejxNgcREg+86c +4wgDcwCCxglLk64wAaSEBaIlljSdAusiFdAR+LbgR6o1YcZJXZsbGGDSAhKnJz5hAXEZgaa dOPfS6AiDiBbWmL5Pw6QMKeArcTL9j9gYVEBFYlXB+snMArOQtI8C0nzLITmBYzMqxglUwuK c9Nziw0LjPJSy/WKE3OLS/PS9ZLzczcxgiNAS2sH455VH/QOMTJxMB5ilOBgVhLh/XCQN0mI NyWxsiq1KD++qDQntfgQozQHi5I474Wuk/FCAumJJanZqakFqUUwWSYOTqkGJocF1z/KimvX +fEeWikRn31wGseqCoXH5rI/cmeJ9V0sN2vROOmfYrj4UZtnLX/k9XnSokV/PCRY5lYd/hDe w3fiiRjvwlX2ja6x3x7UBQe0sVac+iJ0plMwafax2RdCdqy8/FusQsBfnWPZgeTb/+4t3s7v nK2yPfLPzXlyHyO703o3XPhZIe3w6FpEjkCS2BTljX76palBxVrb1YRSBM50imdvF5udH885 r3TepSMbp8m/kjnGtUrrRhLHuwPGDt8inpVfVbtU16hVP+fR/oKHVXsefz4552zkra7+LQ3f t/LWFfWXmjD0n5ANW7ksNESpZZ630p7/JnGBbBkxholKUrcPmp3atC+aw/ebEktxRqKhFnNR cSIAAS8eB+8CAAA= X-CMS-MailID: 20220217055434epcas2p3b85d195b91d2bbb4dcfea2787d50039b X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----mwmExhcEqaTMgLyfw452.zc-R1ZLcLBBgXcQdqrDAhnQ.X2v=_fe3cf_" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220216000912epcas2p419fb5d4f7044389451e28802dd471c5e References: <20220216000835.25400-1-quic_wcheng@quicinc.com> <20220216000835.25400-4-quic_wcheng@quicinc.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ------mwmExhcEqaTMgLyfw452.zc-R1ZLcLBBgXcQdqrDAhnQ.X2v=_fe3cf_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Hi wesley, On Tue, Feb 15, 2022 at 04:08:35PM -0800, Wesley Cheng wrote: > It is recommended by the Synopsis databook to issue a DCTL.CSftReset > when reconnecting from a device-initiated disconnect routine. This > resolves issues with enumeration during fast composition switching > cases, which result in an unknown device on the host. > > Signed-off-by: Wesley Cheng > --- > drivers/usb/dwc3/core.c | 4 +--- > drivers/usb/dwc3/core.h | 2 ++ > drivers/usb/dwc3/gadget.c | 11 +++++++++++ > 3 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index 18adddfba3da..02d10e1cb774 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -115,8 +115,6 @@ void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode) > dwc->current_dr_role = mode; > } > > -static int dwc3_core_soft_reset(struct dwc3 *dwc); > - > static void __dwc3_set_mode(struct work_struct *work) > { > struct dwc3 *dwc = work_to_dwc(work); > @@ -261,7 +259,7 @@ u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type) > * dwc3_core_soft_reset - Issues core soft reset and PHY reset > * @dwc: pointer to our context structure > */ > -static int dwc3_core_soft_reset(struct dwc3 *dwc) > +int dwc3_core_soft_reset(struct dwc3 *dwc) > { > u32 reg; > int retries = 1000; > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h > index 00348d6d479b..b27ad8dad317 100644 > --- a/drivers/usb/dwc3/core.h > +++ b/drivers/usb/dwc3/core.h > @@ -1532,6 +1532,8 @@ bool dwc3_has_imod(struct dwc3 *dwc); > int dwc3_event_buffers_setup(struct dwc3 *dwc); > void dwc3_event_buffers_cleanup(struct dwc3 *dwc); > > +int dwc3_core_soft_reset(struct dwc3 *dwc); > + > #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) > int dwc3_host_init(struct dwc3 *dwc); > void dwc3_host_exit(struct dwc3 *dwc); > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index 0c89baedf220..788889f924f9 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -2585,6 +2585,17 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) > dwc->ev_buf->length; > } > } else { > + /* > + * In the Synopsis DesignWare Cores USB3 Databook Rev. 1.90a > + * Section 4.1.9, it specifies that for a reconnect after a > + * device-initiated disconnect requires a core soft reset > + * (DCTL.CSftRst) before enabling the run/stop bit. > + */ > + spin_unlock_irqrestore(&dwc->lock, flags); > + dwc3_core_soft_reset(dwc); > + spin_lock_irqsave(&dwc->lock, flags); > + > + dwc3_event_buffers_setup(dwc); Could you tell me why you add dwc3_event_buffer_setup? Best Regards, Jung Daehwan > __dwc3_gadget_start(dwc); > } > > ------mwmExhcEqaTMgLyfw452.zc-R1ZLcLBBgXcQdqrDAhnQ.X2v=_fe3cf_ Content-Type: text/plain; charset="utf-8" ------mwmExhcEqaTMgLyfw452.zc-R1ZLcLBBgXcQdqrDAhnQ.X2v=_fe3cf_--