Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3063222pxu; Mon, 19 Oct 2020 03:00:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRsjIAChESRskIcNldymznRXUYYSNnyOOCEjxUHEQbnOnsydx2ZRT7pSNcX+Vt0EFMMLfq X-Received: by 2002:a17:906:c293:: with SMTP id r19mr15886383ejz.63.1603101608551; Mon, 19 Oct 2020 03:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603101608; cv=none; d=google.com; s=arc-20160816; b=m3B+Ko8+nZKnAOpGMvH/N6D7XK1c7EJdBdi4fSzgpdxNqMCrYZKH7I5khyHgLjC7Mk NS1rErWTkF+z/WtUX8IpqnTur1JYVNl2N/nlVU/ePtc7xCOCwLV7S8m48aJAmByciTBP DVHQBOs/Q46d6cVdrJb+KVgISOpM+BlN/IJMWjpHsbiYnFPXURCL0z/XyCXjl/HevHiX WnE+Y+wo+/BJMwjSEo/3EGhI0sc/w6nLRhG+Yi3hVwcs4axd0OkA5D3U1zDozVn9OedV T+fiudzRHgCIimvniPWS5ZXICxDFvlRoRE2y/yXWDETgR6Wt7xorpToiB01ZxlmTU/Om yT0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YLHWIaul/DBFCQm+n/Gv9ezGO4oMICeIOh7ut+TCr4c=; b=B29UMXAC9RXJqXli9Y7bkK/aia9coOFG+qVP2Cgy6Tdye0dZsE0WLy/qZUQOmD0LKh UmUCtb91YEtoxzHUukEi1T7JmxcuABGFV/P4WWM1i/8eSvDZn96ts+YwCwuna/gJT3hH CrPN74AZq1F1g5zRGUQ/ZqZIMLNPb5Ogm8K6FsKAqQudQPYuXt6WFUuXqPA/I+PUzfwl uwcHLrIdT5nqyTWu0JXv/aUd5KA71sHmwkK6aDfprdgVAKLFchkrauYAmEYjIFSXu/Jc Ne+aVdliwn9YsWgoJhYakyhxlvUlhnIOhqRWH7jMyUsWCdEzQHZbH4daVdqgQGfFXq09 /uUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oJTrVl+C; 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 p18si7231764ejn.695.2020.10.19.02.59.46; Mon, 19 Oct 2020 03:00:08 -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=oJTrVl+C; 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 S1730877AbgJSCeo (ORCPT + 99 others); Sun, 18 Oct 2020 22:34:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728791AbgJSCeo (ORCPT ); Sun, 18 Oct 2020 22:34:44 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9135AC061755; Sun, 18 Oct 2020 19:34:42 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id t22so1274751plr.9; Sun, 18 Oct 2020 19:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YLHWIaul/DBFCQm+n/Gv9ezGO4oMICeIOh7ut+TCr4c=; b=oJTrVl+CfTRFU4ZbjUxGTkRrM2XLjDl0iZx7WqGIOL+Dqxt3t8hSw366RyeXtagEXA x0wcATwG7SMpUfG+PhnBsou0bAuH8Aq7Ib9Yjza5kY270Z3ymbV7J7EjeHM3FviKqrbn V4zKyhuTuaf3cBvuY8iD7I7IwRI+nyma1y1p/cJdNMx9qrLhgiymb8P2tM2T0jDmpQUo iok2Q9aqd1zebEKXhCq15bI8vw11b8rOp0xSCz9n1BV4qu9sekXDUrUp7Jdeiayoq5Sc hAuNy8+ThWKvuWQMT0XusutlJG70Dwfm/aK0ZLqfIuSfr6TGyVB2hqnGYuB1xrObUxu9 iI4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YLHWIaul/DBFCQm+n/Gv9ezGO4oMICeIOh7ut+TCr4c=; b=bK+8pbuYxfaLCtPozearGi8QQCgd1bv5HVytLNlXi2OOfd7JrU1LsriiKjcPagFc14 kS10LgdxbQ1PZ7l5aW8Y/K9JFFmiKsLgOuORpqNGfG/76mW3Y9sG+gGxYdVJIE/+14I4 nidPom7sm7yF0pRw/CF9+6jfA6RE34odBmns/L0P0HP76TiQbHvJJZOqs1dMcVluecTW iLrIUeppoeyDZavC8yShKXMJMmP4JEJZ3JfSbxOQNDeij5QxwN7/D6tYMqLHg3lJN4eQ 5MHdVaGu32ED7iZaGD7TjDztrWtLqxvAycN9yU0hbFj+OeGzchbWYpSAvjIfx2OnDmbu m18g== X-Gm-Message-State: AOAM532WvCWw2oO54gGLHEwUWrAvXDgoq0neU2HvYz5aov40YCVt7hBv x5ZYUCwC3GKrFoPSwP3PPK3S/rqpVMc= X-Received: by 2002:a17:90a:7089:: with SMTP id g9mr15488745pjk.4.1603074882130; Sun, 18 Oct 2020 19:34:42 -0700 (PDT) Received: from localhost (23.83.240.116.16clouds.com. [23.83.240.116]) by smtp.gmail.com with ESMTPSA id z5sm9816901pfn.20.2020.10.18.19.34.40 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Oct 2020 19:34:41 -0700 (PDT) From: Dejin Zheng To: balbi@kernel.org, gregkh@linuxfoundation.org, sergei.shtylyov@gmail.com, linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH v2] usb: dwc3: core: fix a issue about clear connect state Date: Mon, 19 Oct 2020 10:34:35 +0800 Message-Id: <20201019023435.5482-1-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes: f59dcab176293b6 ("usb: dwc3: core: improve reset sequence") Signed-off-by: Dejin Zheng --- v1 -> v2: * modify some commit messages by Sergei's suggest, Thanks very much for Sergei's help! drivers/usb/dwc3/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 2eb34c8b4065..239636c454c2 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -256,6 +256,7 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) reg = dwc3_readl(dwc->regs, DWC3_DCTL); reg |= DWC3_DCTL_CSFTRST; + reg &= ~DWC3_DCTL_RUN_STOP; dwc3_writel(dwc->regs, DWC3_DCTL, reg); /* -- 2.25.0