Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp298233pxx; Thu, 29 Oct 2020 02:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjNb0o+J+p0cuo9dmSQIrd15FFl+kdS4AqVEfYYN20G8LTxxw6THvWA/mh+80ASEzx/aMi X-Received: by 2002:a05:6402:17e4:: with SMTP id t4mr3168990edy.118.1603965536670; Thu, 29 Oct 2020 02:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603965536; cv=none; d=google.com; s=arc-20160816; b=LTQUCO6SdwEy91qthOyQ6W6PJiWREVrsOwOpmvdx/TKWO3m6/BvPfdIWgSaNLKZIus T/OoZppMSUhveJFL/L/ffDcgAPD39coV95g7O4X/57iCs8WnkX0O/fzqeV4pQMLmpwz9 JUMZYNTwhis6c3XivrhI8o5/28swk8/o+p+ikeSeh6V5X3mE0RUgmZNkTeGibOyqXh78 qRqsXXiWlDbsaO/U6CbfPaPM8JwHukj4oLOEa5k9cAQGWBMlGz3jBgzav0Pu3bBgXrRH XynhmZrR6a7SrK8bGDdEi9SzCdg/G9O6M3hFXa8IXGSr97TLioW3yRv0Is3ymJj84Tkz L6Hg== 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=Johbs0Z75egiQIroXUJ+H8W2j2ZD6gGHPT/5rOZ9E7c=; b=uDVTm7clWmpv/AWsXmuYIh2OsvMETB9MvVLghKJosCImJ9RAkyyqOqQHyizPiQY+/X 7+SGGIXdd1MWbIePo/ALF8LcWUoD5wwCIKq/KC6R/0w09i7c9kJsztOYenjjF9oLEM0u 9GWGNL53yjLqXfNCD3Cug2WgtnwWV4kq+FySR5+tOqWFImKamP0oQ5RIiL76BYPyJbtW qiHbeplSXA9X+oP8i3SIAn8ue4ahC9T6eWLEScCQLFXPB9zbwdjDoUTU0pv0mQHHlltA vCv06YrVvX6Pt1rdTOYma2p152w0ElU/EwVhEQoW871cjo/6Nrf8R8ztpNktiS67l3WE SkoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OoqhVhER; 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 bg10si1524661ejb.240.2020.10.29.02.58.34; Thu, 29 Oct 2020 02:58:56 -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=OoqhVhER; 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 S2389136AbgJ1Wlk (ORCPT + 99 others); Wed, 28 Oct 2020 18:41:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388979AbgJ1Wip (ORCPT ); Wed, 28 Oct 2020 18:38:45 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1C5BC0613CF; Wed, 28 Oct 2020 15:38:44 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id 13so668363pfy.4; Wed, 28 Oct 2020 15:38:44 -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=Johbs0Z75egiQIroXUJ+H8W2j2ZD6gGHPT/5rOZ9E7c=; b=OoqhVhER1UzX3UYvODFWFHzjIjN5ME0+4Stvf1J5DRaht5nxVCeMn5gZQmVEdTtXih tU9fU+LWsNZimK/PY/3B/a7/7Zimlqq2KXnQ50N1QT8lFCvmgrupewCjON3RmkhXTewc b6ZvuAWavkDTBO8xa9RM9aYCCqJ+k0tsm8CHCn703paAaKs6HBEzBJRIBoPm4eUT7l+O RFmYTVBV6k0YIdKg0cGPf22vp+OKfs0Nlv0/XZQnmNWIuAkW7+tjbvJbLoE6O+bz54i4 UfAxNuik86rIHqZnaiGpc+zuh74r4R3h82qyfK5d+kuQ50eB3gl42gS6Df1vw/3Yx83C Q77w== 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=Johbs0Z75egiQIroXUJ+H8W2j2ZD6gGHPT/5rOZ9E7c=; b=E6+bP9QWNAA35HuFT7Aso0s519Sk2++kxjoMyZ8wwG95cU04SO1wRo4r7jQyCMsFOM zoJMm/0QmKMu7YGKkN2LiXfxGdR/JR13g7Ocb9OBA/u60q9BtKunBZ/oIygWLPNWyg4U ji46zmqOjG3n9I41m6OU1pqMXdj3BkwdSZ9OkFseKcyNrZ241sR/zL/EVwH89pClMKC9 WBA24QUohT2qDqHTbFPhlloPCLPn+TPDjlyYPEbnzwyyhoizV53NRGnzGBirbAM3kaQ/ gV273eBW9spfsMULtXWPa+uSjTBpYTvAbXkHcj2oxcsVTQK08qM1/bD0dKHCyw+K19YD c3rw== X-Gm-Message-State: AOAM533nv7YdqfFDW2iaZQ2/Cspqh8B648WYU1SR5MnJABfobBhBc0rv wvxhQNC1F2GzvLneJdcOgD3Mkbyes8Xk5g== X-Received: by 2002:a63:9d04:: with SMTP id i4mr6401980pgd.375.1603892793062; Wed, 28 Oct 2020 06:46:33 -0700 (PDT) Received: from localhost (23.83.224.115.16clouds.com. [23.83.224.115]) by smtp.gmail.com with ESMTPSA id p22sm5176338pju.48.2020.10.28.06.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 06:46:32 -0700 (PDT) Date: Wed, 28 Oct 2020 21:46:29 +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: <20201028125812.GA59692@nuc8i5> References: <20201020135806.30268-1-zhengdejin5@gmail.com> <875z6wdq62.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875z6wdq62.fsf@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 10:33:09AM +0200, Felipe Balbi wrote: Hi Balbi: Thank you so much for your comment. > > Hi, > > 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! BR, Dejin > -- > balbi