Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2346765iob; Fri, 6 May 2022 00:03:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBWwjPpn61MHYfwdlf4Yac2k4w4sQaX7gK4pylgdKQVcPsLpEL3cSNFfQkflB2xcIOO7rY X-Received: by 2002:a63:5c58:0:b0:3c2:f183:cbd7 with SMTP id n24-20020a635c58000000b003c2f183cbd7mr1602600pgm.33.1651820617687; Fri, 06 May 2022 00:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651820617; cv=none; d=google.com; s=arc-20160816; b=v3DDtWkhpxBTM+X/+VfcbrpWzweR3/pno0mJ72tfo69SGBvK77JTCdtyB9Kb+h4IYM x5IzxrsrjVRfbJsEc9AoRbhaWq268rCkNnAdX0vJezGTMvuvQI16QZjIgAK+OmLWGEI6 jVEIuM0oO4MeYdqCOJkjow/fLIuaAeOuEGFe4l/v6ysBmk+eWrG/AbvQEIE4LljCmiNw huIX8UHh6KyHc8zG3J4Fmyl46x1/DItTCI5Z20AvQM7AkLL/HNNLyXD0LwIEgxEFhaq+ tQn9UBkcSYl20dVqpBBbPI3+N/WgVT0nIZRiWaPFo2jU5grLReI0beGGBTvCBai73Amo aqqA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lXyHZmOi9/uDwTqX1g7ku6Z/WHj12cSM6SgJczL7+28=; b=Cq1+qrVt5Kg1CWMINI4RDk9xEMEiF2LQ5FADZkWxaAxWNOWWY6BKfQIrmD/yGfs3Y4 wmHS2KyfL8Cz86CRWN/mInnlTjKAwY78VpDCKxr0ZyORDiSBHdwWCroNqCBsu5VwHirm Yzn3v6oy91QK3QtNJ3YCEGynhtvEiySuDC5DkuZe5LgeR0qtTk69HKhBu0v/N1miG4XW A1GUDmVxVWsbRliYzzSGROVRKZL9/rVeqFj0EyDT6wWYeQjyc+ZfOgm+xlV9CQy3G1E6 vxyDGQUhbDiq6oZ3KfWNyEoH7ipulH2DrXnqrCQWnjhw2sT3dRhmOx+IOyQJ4+1OiGcn OjmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=grmLqi+M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a654143000000b0039d6172e359si3876296pgp.414.2022.05.06.00.03.21; Fri, 06 May 2022 00:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=grmLqi+M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357947AbiEDRPb (ORCPT + 99 others); Wed, 4 May 2022 13:15:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355474AbiEDRE2 (ORCPT ); Wed, 4 May 2022 13:04:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41A6A4EDD6; Wed, 4 May 2022 09:53:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7805E617A6; Wed, 4 May 2022 16:53:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDBC2C385AF; Wed, 4 May 2022 16:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683182; bh=4QKeYGFyuX8Lgug/SAeFGpeUU2oQDWxhq6HgOSzsGzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grmLqi+MyoIxH7qM0BpdEElu85xev/zMq7rCVbVFFzZTDnuSQ8Okb9mGDRE15sO3M 92aXehYT4Nwrh5hf9fKZ9YdWCXmJ6OVnp3xrtpc1cPT6SOGsZN84m2GYTf8fSCgOW9 wXEaFUm3uT1sZH+KaWnJJRatB0AXQ2e/Mr4VSLcM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen Subject: [PATCH 5.15 024/177] usb: dwc3: core: Only handle soft-reset in DCTL Date: Wed, 4 May 2022 18:43:37 +0200 Message-Id: <20220504153055.339503532@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Thinh Nguyen commit f4fd84ae0765a80494b28c43b756a95100351a94 upstream. Make sure not to set run_stop bit or link state change request while initiating soft-reset. Register read-modify-write operation may unintentionally start the controller before the initialization completes with its previous DCTL value, which can cause initialization failure. Fixes: f59dcab17629 ("usb: dwc3: core: improve reset sequence") Cc: Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/6aecbd78328f102003d40ccf18ceeebd411d3703.1650594792.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -275,7 +275,8 @@ static int dwc3_core_soft_reset(struct d reg = dwc3_readl(dwc->regs, DWC3_DCTL); reg |= DWC3_DCTL_CSFTRST; - dwc3_writel(dwc->regs, DWC3_DCTL, reg); + reg &= ~DWC3_DCTL_RUN_STOP; + dwc3_gadget_dctl_write_safe(dwc, reg); /* * For DWC_usb31 controller 1.90a and later, the DCTL.CSFRST bit