Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp262947rdf; Tue, 21 Nov 2023 01:50:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdeKcFWJ2R9MRQpvxmutHAqXm8UnVg8gbp7/CjBV4kd+BoscA6YEbhhA/eLsfdkRWxPS9F X-Received: by 2002:a17:90a:983:b0:280:37c3:3bcf with SMTP id 3-20020a17090a098300b0028037c33bcfmr3347110pjo.13.1700560252548; Tue, 21 Nov 2023 01:50:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700560252; cv=none; d=google.com; s=arc-20160816; b=r3mdnkvDuzIrdsFMy0CyZYUTYrhe/x5Dwne4MrTa1t4x2xnKUQp2puDAwdQT/nDtP4 HGOKDcEA2zY2TWc06RgP9SSCO0YwF5rdR+tMlUzidVoqCG++JtBbciPcELetwJ58DJJM ThmO9jziYi60n1k0VKpdiDa9Z2aSNsY4G73jp1ix6bh8KTmjj3/XUPdm5ODkeyjp74F/ vmU6AQ0pbVAeZ3OqcrXY1/KINbP4F4PgCDRjFWmumLIzJ4LrBu91TTzXsmd4/oBJ7Ta0 axob742qgbcRle0XGjPvcUtYyb1wx9s3Dyaj1pCT+Sey3fPX4UHvCr9xVHCxQGrMptsU Diig== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=VVEkp3Bfnnrh5RJDI1Xlb1Qdj4wYUKQF4xGHxqUM4cQ=; fh=ZQdxTC+kVTdxGXcdCCUuqKX5GyywIoqRrhLgHqSCwjE=; b=fem8n2GGrdCIo2iXMekD5trJaTjTFQD3hOjQCU79QoUI1fmejAtyWyyYC8ntZpY/u2 CspsdSKmEqeZ3qKrPMUmt/eFoetR6pTHoryeIvEoHeSmhgjwWeEApfeLx6UnATcMioHQ ZzNwl0DzKatj5JSvh4+OFgmuPeKIPtPpdjX0gL7enP8oyDk8tw7P0e3QS07lWX2DNbIW KN5STD92LIOkxJ5wgZapXyhu950rKxmoBSgaYkdkJhLD3JOwZMRI1m6rsbm8OjGwkYJp hiW93TIvzdbEoTiZCwT6iFKrjJRLhsgc3uo5f383s2refMVRSiRfYw5HwfGOlr88+r6+ Fyvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JmBUpE9u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id c14-20020a170903234e00b001cf67883f24si2655639plh.264.2023.11.21.01.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 01:50:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JmBUpE9u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 61BA2806B731; Tue, 21 Nov 2023 01:50:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234177AbjKUJts (ORCPT + 99 others); Tue, 21 Nov 2023 04:49:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234095AbjKUJti (ORCPT ); Tue, 21 Nov 2023 04:49:38 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54E1210FA; Tue, 21 Nov 2023 01:49:19 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id EBD971C0018; Tue, 21 Nov 2023 09:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700560158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VVEkp3Bfnnrh5RJDI1Xlb1Qdj4wYUKQF4xGHxqUM4cQ=; b=JmBUpE9uq6PZ+X/WdiEJxaNOlOT8Fqf1XyntNBFDTBO7n8bYWBZVQ9NmcCr9dcUNnlzU3y lM5xsFAHAi/WN7P//bc7ThdqCIJDrAaOJR7N4p7FzT01P7hJrU0gw7jyz8OyK/ALnBVvOC 8tLbZxeMID73FdYMAG55Ps5UERQgLPzQPbiDMa22dScue550yU1zAapvMgsuD7Buofw5FN kwV+8N/JOjcUutaNpe+2JCgSR3m7BPX6zO+Rvk7r+vbnUgYB9BChLCdmagG4o8IKiD9aOZ Ik1HIxwRxiumBRKQAve8v1CHCdKXsRRVCZlAMHWOEHXYlM2n1RrrZicYg8L6jg== Date: Tue, 21 Nov 2023 10:49:17 +0100 From: =?UTF-8?B?S8O2cnk=?= Maincent To: Thinh Nguyen Cc: Jisheng Zhang , Greg Kroah-Hartman , Lu jicong , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Thomas Petazzoni Subject: Re: [PATCH] usb: dwc3: don't reset device side if dwc3 was configured as host-only Message-ID: <20231121104917.0fd67952@kmaincent-XPS-13-7390> In-Reply-To: <20231117015527.jqoh6i3n4ywg7qui@synopsys.com> References: <20231116174206.1a823aa3@kmaincent-XPS-13-7390> <20231116175959.71f5d060@kmaincent-XPS-13-7390> <20231117014038.kbcfnpiefferqomk@synopsys.com> <20231117015527.jqoh6i3n4ywg7qui@synopsys.com> Organization: bootlin X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: kory.maincent@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 21 Nov 2023 01:50:16 -0800 (PST) Hello Thinh, On Fri, 17 Nov 2023 01:55:30 +0000 Thinh Nguyen wrote: > > How many ports do you use? Can you try this: > >=20 > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > > index 0328c86ef806..9921c2737829 100644 > > --- a/drivers/usb/dwc3/core.c > > +++ b/drivers/usb/dwc3/core.c > > @@ -296,23 +296,28 @@ int dwc3_core_soft_reset(struct dwc3 *dwc) > > if (dwc->dr_mode =3D=3D USB_DR_MODE_HOST) { > > u32 usb3_port; > > u32 usb2_port; > > + int i; > > =20 > > - usb3_port =3D dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); > > - usb3_port |=3D DWC3_GUSB3PIPECTL_PHYSOFTRST; > > - dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port); > > + for (i =3D 0; i < 16; i++) { > > + usb3_port =3D dwc3_readl(dwc->regs, > > DWC3_GUSB3PIPECTL(i)); > > + usb3_port |=3D DWC3_GUSB3PIPECTL_PHYSOFTRST; > > + dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(i), > > usb3_port);=20 > > - usb2_port =3D dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); > > - usb2_port |=3D DWC3_GUSB2PHYCFG_PHYSOFTRST; > > - dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port); > > + usb2_port =3D dwc3_readl(dwc->regs, > > DWC3_GUSB2PHYCFG(i)); > > + usb2_port |=3D DWC3_GUSB2PHYCFG_PHYSOFTRST; > > + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(i), > > usb2_port); > > + } > > =20 > > /* Small delay for phy reset assertion */ > > usleep_range(1000, 2000); > > =20 > > - usb3_port &=3D ~DWC3_GUSB3PIPECTL_PHYSOFTRST; > > - dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port); > > + for (i =3D 0; i < 16; i++) { > > + usb3_port &=3D ~DWC3_GUSB3PIPECTL_PHYSOFTRST; > > + dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(i), > > usb3_port);=20 > > - usb2_port &=3D ~DWC3_GUSB2PHYCFG_PHYSOFTRST; > > - dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port); > > + usb2_port &=3D ~DWC3_GUSB2PHYCFG_PHYSOFTRST; > > + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(i), > > usb2_port); > > + } > > =20 > > /* Wait for clock synchronization */ > > msleep(50); > > -- =20 Still not working on my side. Regards, --=20 K=C3=B6ry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com