Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp227222pxx; Thu, 29 Oct 2020 00:39:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8UlUcZIxQ3/gwbF82+Ll7O0kj0nwKDYBmGTE1JH2X96RPDFsOMS4Uxez0iQXE4htUNvlb X-Received: by 2002:a17:906:cb81:: with SMTP id mf1mr1325113ejb.190.1603957159985; Thu, 29 Oct 2020 00:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603957159; cv=none; d=google.com; s=arc-20160816; b=0ZhViK/kebEXIhSyWsNBbFQcupcsqqefntWdOj9XSLZyz2zlnyXcJ5sY8GtKOvdce+ /yjdoAY4z0I7yc9LI9vsiuVxRuwqufts6G4/kLB0J++q3fcsoO1ODUKFNJERprEHTcEz /G0DehArKxJ60Ey5psWUZQWe6/jRxDPwxIilFxKU918Uc+RP82AjnxQzUeMd0BFSLQNC 0+QYbiYf4Z+zL+F6lODJFpKgUHAIqLojX0Rqh2ILZOIqs1+GON3LI/XZBoHWI0emyn8o yidiTEuwCixu2MIRXi69VKU+zyshfOOae7XmZSqUXph2Yk0nQ0eY4JIwfi12TGjirUCm awQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JuzDUdCe2w+w28rdeAmQTlU9jyTM7YJ+llzJx19PImc=; b=c9EThmsEwkRk9diqAN6J7rvGYyj8UBQavpcOqsC1XvR3/Fpem0qOoRENJ11gtYqzh7 wRo/qlxKIpgPE9JCvC+2IHfDaWYw21lWcwd7eMQYCdndwJTH29tsLqo7pKI/2G/7HQ7I sORUvQSQbk1AYJKJzye3f8agbuIxDQFk/SLgfMPvheGVc6qFvNu+L51q3DIjc5KmBcf/ G+c2Ur+67YJgKL1RRpn6Pkvi09+oCpxFfa6KKUPKPrs+sMXRnz9tsvrRUIIOmYqwAquv KRm0lr4k+WCPHhEyV7J10/5E0rVwU5TxzByWjgqj4VL7uRii6xDDyBwXxYHOTCKvz8Mv XM6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g9QU+Foc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si1651987edl.33.2020.10.29.00.38.58; Thu, 29 Oct 2020 00:39:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g9QU+Foc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733308AbgJ1W1g (ORCPT + 99 others); Wed, 28 Oct 2020 18:27:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733282AbgJ1W1e (ORCPT ); Wed, 28 Oct 2020 18:27:34 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50D79C0613CF; Wed, 28 Oct 2020 15:27:34 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id bl9so564938qvb.10; Wed, 28 Oct 2020 15:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JuzDUdCe2w+w28rdeAmQTlU9jyTM7YJ+llzJx19PImc=; b=g9QU+Foc/no8WnHkeWW+oiFQMFS/hiNSaIlXiN1wtlZuqLDY0oenJ64/CZStC35fsF Pl+0YZ18/sB+/oa3OPTLowJelNafPlRMP7AfI8yCyCEYL8z/IUSvdobX2KPkUdjxrdWA zfshLOj6udgSjmOJ1P/rGwdozTW62K6FlbFm+e6/+ST+78ilg5dtp3BqzW1qm7poWMOF 1ks1t6CHVp3zVV1wVMeb05dcSBNkYl0kc0hww3xg9Cl37Rn11d5FeCW/uYXIvoOnmFFs HByXVWBIJwFsSi0gQS305wwgEwXb8/VPr6KKJHjOJ+lCAg/nPXPfC8bpFUB3kaBCONOU a3Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JuzDUdCe2w+w28rdeAmQTlU9jyTM7YJ+llzJx19PImc=; b=spfWQxyDAldt5ef58KOXD+G+1G6gMK2yUkBenh8yk8jfWqK+sr6p/8Mc6parfBwmJW beBlYrtGV1HXiQoFgdam/HnvOJuW8Sga2heqL0vSJTe4wQiVmkRSzXeHjPM1n3TKVnUe wydve2W06KB13bQpJKiD74VZO9ds2QBtPQyuTzzFtsXWVgED1GAB8aWhnrZVZEXQy7bP 9/mUHrDjpY/qDts9rRsHP9C9pnXBiRLwd9wihykzH5RAtVQM01hPC7TU0sBhseiJJSJW eONr1vTgi0UEV7iVtSKFhDviEu+uTErMoNEA1LpU1C1+V4INMWWRLloewnMu5wqsEl2m mCwA== X-Gm-Message-State: AOAM533ycJpW07kKeCwLzXmNhXSniCiJrzNXu3kSq7yCp6Mhn9XKvXxw Nr/g7Ekc2hSDxR+fezARtg6f198vk1uK2g== X-Received: by 2002:aa7:9622:0:b029:160:7bc:4d00 with SMTP id r2-20020aa796220000b029016007bc4d00mr7761490pfg.51.1603896201478; Wed, 28 Oct 2020 07:43:21 -0700 (PDT) Received: from localhost (23.83.224.115.16clouds.com. [23.83.224.115]) by smtp.gmail.com with ESMTPSA id x7sm6285203pfr.61.2020.10.28.07.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 07:43:20 -0700 (PDT) Date: Wed, 28 Oct 2020 22:43:15 +0800 From: Dejin Zheng To: Felipe Balbi Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Thinh Nguyen Subject: Re: [PATCH v3] usb: dwc3: core: fix a issue about clear connect state Message-ID: <20201028144315.GA3766@nuc8i5> References: <20201020135806.30268-1-zhengdejin5@gmail.com> <875z6wdq62.fsf@kernel.org> <20201028125812.GA59692@nuc8i5> <87y2jqlahc.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y2jqlahc.fsf@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 28, 2020 at 03:57:03PM +0200, Felipe Balbi wrote: > > Hi, > > Dejin Zheng writes: > >> Dejin Zheng writes: > >> > According to Synopsys Programming Guide chapter 2.2 Register Resets, > >> > it cannot reset the DCTL register by setting DCTL.CSFTRST for core soft > >> > reset, if DWC3 controller as a slave device and stay connected with a usb > >> > host, then, while rebooting linux, it will fail to reinitialize dwc3 as a > >> > slave device when the DWC3 controller did not power off. because the > >> > connection status is incorrect, so we also need to clear DCTL.RUN_STOP > >> > bit for disabling connect when doing core soft reset. There will still > >> > be other stale configuration in DCTL, so reset the other fields of DCTL > >> > to the default value 0. > >> > >> This commit log is a bit hard to understand. When does this problem > >> actually happen? It seems like it's in the case of, perhaps, kexecing > >> into a new kernel, is that right? > >> > > It happens when entering the kernel for the second time after the reboot > > command. > > > >> At the time dwc3_core_soft_reset() is called, the assumption is that > >> we're starting with a clean core, from power up. If we have stale > >> configuration from a previous run, we should fix this on the exit > >> path. Note that if we're reaching probe with pull up connected, we > >> already have issues elsewhere. > >> > >> I think this is not the right fix for the problem. > >> > > I think you are right, Thinh also suggested me fix it on the exit path > > in the previous patch v2. Do you think I can do these cleanups in the > > shutdown hook of this driver? Balbi, is there a more suitable place to > > do this by your rich experience? Thanks! > > I don't think shutdown is called during removal, I'm not sure. I think > we had some fixes done in shutdown time, though. Test it out, but make > sure there are no issues with a regular modprobe cycle. > Balbi, thanks for your suggestions, I will do a test in the shutdown hook first. > -- > balbi