Received: by 2002:a19:651b:0:0:0:0:0 with SMTP id z27csp3610897lfb; Sun, 8 May 2022 23:59:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYQ0O3R5HnJale2uXahKBr1jNHWlOzzZtAJY2Iv9deavrSNmxqtl7p4kvEFEU1HApy8KN3 X-Received: by 2002:a17:902:d707:b0:15f:42a:bc62 with SMTP id w7-20020a170902d70700b0015f042abc62mr7254797ply.98.1652079579991; Sun, 08 May 2022 23:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652079579; cv=none; d=google.com; s=arc-20160816; b=exyEp/IrT88nhjTCNkJ+k7W230K0/hY5nl5mVwELELdE0/CdnqUuNVa3tX2ZcGfxeB 88NjAYAGr6tqO9PlmkpGF0iz4dty5PVeQtjQdRFe5OeMvfSrP7EUezPogSwSwfINWN7E Lcaz9suD8qMNEZSue+tDhSl9sXIU0aLw2pq4lhdIMwi+VZa5wY1M7iTwHXi/DmkLcHAP 4jxTHKMoWc3If3ufcIY9dGIWb4JNXA1mRNOQknnzGEM4S3wwOlOxjelXKwP5sCzsAk8o SBbqnwRB26Tog5ojARRd7N7/FajNUlD5nhWPmafZqCCL8FevJTypSI8mxLNKDFweotZx Uy0A== 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=pboE6n6iQyKaqVPeKkQEaUYWDFzTMU9F++5PUcQ9rKpK+5iuMbtu8EHaWdSvooFT9h BD/NBJ2mLMZGJTS+T5jpLDAAFuG46HYri/MT3dfCUpDgrdHCLqKpN0TWepc/8dYY+K3U 8bHsfA1eRma8LW7suBhMGH+vqxFYhJBXagqW8+FBKVMJEg6pSPGNKmxBzFtFMlx9/AZK FhMmLom7Gp+ZDmvkp+Ji6FJ5fjQsJeLg3elxod6Fky6g6fT8881CqxP2cx3GpuE1ulNn ejb7BBeKehIgO/BNHzJ3UZuLSYnV1ROLZTJxcnigeiDyNeOeP0oHu2axZdDVrwtpq+G1 QmFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ywhw2qVC; 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=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e10-20020a170902e0ca00b00156a95ac6efsi8636413pla.611.2022.05.08.23.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 23:59:39 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=Ywhw2qVC; 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=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1F9ED344E5; Sun, 8 May 2022 23:55:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354967AbiEDRDj (ORCPT + 99 others); Wed, 4 May 2022 13:03:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354576AbiEDQ6x (ORCPT ); Wed, 4 May 2022 12:58:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87C3118E15; Wed, 4 May 2022 09:50:34 -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 235846179D; Wed, 4 May 2022 16:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F0E0C385A5; Wed, 4 May 2022 16:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683033; bh=4QKeYGFyuX8Lgug/SAeFGpeUU2oQDWxhq6HgOSzsGzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ywhw2qVCWH5wgKBbCfSKMQ49uUqN1RMZ0abChdN5RR7/HYvqI5+1QMtu7im103BMW NwWyhSprPCUWAnbBpQkMjmndCDENiBl/t3MUpnxOa9TlbKMIYBVP/fkb+d+KPwh9dW j454z9eAxN54U2fkr/XHmW3GiVOUfG43hwdAbJP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen Subject: [PATCH 5.10 024/129] usb: dwc3: core: Only handle soft-reset in DCTL Date: Wed, 4 May 2022 18:43:36 +0200 Message-Id: <20220504153023.199211062@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@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=-2.6 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=unavailable 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