Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp109493lqb; Tue, 4 Jun 2024 06:37:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8GiUmfwKcanjQG/ZH33Jh6BjJ2z+FyQQsnayg9565UDKG08FzbStZs2nv/1Gp6R3Ba4twO6hMjIfJj5knHGQfTmP7r+cvLdU40jbdkg== X-Google-Smtp-Source: AGHT+IEtvCcyhaLLgbukuUkZBGnTal/7DyPYcYw/nF9u1gQwKRvrBF7inwDiW6quW7qgdoSTvYPY X-Received: by 2002:a50:d4cb:0:b0:57a:2ea0:406d with SMTP id 4fb4d7f45d1cf-57a363c022dmr6779249a12.8.1717508232287; Tue, 04 Jun 2024 06:37:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717508232; cv=pass; d=google.com; s=arc-20160816; b=CrkYWD/fZcHaUZFBAPSiMNIfkt6hw4e1CXjdROb4Lavop+vuJGw5506EE1mdqlQEkm IxQCggNSx8OltRrVIDSaUpKxfHuPNzYrenthzfT+67TaM5tKYkgm9KbXgCxF7ca7PaZm YrvKx4usgimCwt5bID112ZRCg1QH81djcUX40advg1JoJ8Vyajmqkg0BcRpowMZdwVE1 wnQ6cYJBu5l5B6WBc2ILH4BmU23hwCFv7FqMrlid85zQJ/u2v8iww/+1wFqDN+S3K1gw 3mzonu51Khqt8AfmYegibGssrwSTh1q9HvpPPtcW1S3F6a7BmRZwfN8T4QDar3mdRXlr A8PA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=WzS6KTisShtv8Dg9YtzrFz5oWI6sO/s5tabpbAk8Ij8=; fh=stpDeOVcSYUTlxZAXCN9Ma2Ay3WdjZyjhISlVgD/iSU=; b=IIiVMlf7jQoy5kfwAaj0Vjx82X1ZZTcF3Dc7pppLmGN/UM06Fb1oRS2PzrvfHPECvG RXoofKBVnwHAKX+JpEutG/LKNlkuYLXIze/QDGlH6Ttuede/ncpWdaluGs+qohhuo/BC SOAvCES0sv6O10H+HHhhBLjKTMgmf7BgvTIIIPTsFVmhPjVu+Jey572NPf6jTpnuueME AjAZhcXEdrZErNdvSzc2gD3tYJz+Jty1N547cRUhcf5TyAAFQ7lQpvajhGH6+jkLfpxG +DS0X2mVKzeThE8oTLhVMFyHPy3RYrEeybOEEXQ9Gz9KrKHkCrRBaKhF7VCH2ghiQbrj Fpyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VLZuIIpb; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-200716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31b80e87si5193534a12.36.2024.06.04.06.37.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 06:37:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VLZuIIpb; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-200716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D35731F21655 for ; Tue, 4 Jun 2024 13:37:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DEB21147C85; Tue, 4 Jun 2024 13:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VLZuIIpb" Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7504F1474A3; Tue, 4 Jun 2024 13:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717508211; cv=none; b=qPm+2wzRMKy/wlLa4OzEEW68hN3r1i6jcR9BQRIfrwvKpacRm3g0xkiExJ3Jru/wyGIbE3Ykk9fZ2Hdi7M/Pw+iIDDo+zz4ehpgL67h5YCl7g9nuLMUQR9Obf9m/ldPMUmL0UDJCxfAo2XIlC2ai+j7wj2CeQIWzE8yc6Ilo5n0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717508211; c=relaxed/simple; bh=/Fh87YqGPOi0FpXtXOrU3AOW/w8+cf58XYTZMBpqHdc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=eQcFZqp8mFvGAx8T3bLAfhaVsQbhvL3f/LTmUSFAaiKP/tf788zKRWPXZU7gvTRpFICAaO667NusBeMc2m5iMpdWt5fvm9712MVJ16FW9s1r/BW7opQa0wqSbCl6AI9TkAdVlBAKgGhR3TZ7bXyXodx3YomSe+ESs6s0l2wC5DI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VLZuIIpb; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a6265d3ba8fso106542666b.0; Tue, 04 Jun 2024 06:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717508208; x=1718113008; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WzS6KTisShtv8Dg9YtzrFz5oWI6sO/s5tabpbAk8Ij8=; b=VLZuIIpblRr2EEa5WJOPy+kQzApv0vdYTVwouOh8eIvpduHeIvLe/l9yy9fvxPNQsT yTF2UsHCJt3WC9IPrCXu5VsdkXR7R3+CQOhWz2NwhYKgyoL7jdIrKyEqtru2NK3jYETT RFAiWQl3b1Q5JzVB63EuHqD8hRv0fNUmPt0nasBxY2eGbA/P2tTgy7ddkYts1rFp3nqo C0sL0KpnyXwIsTFFb8EmqjUuJDoJiotKY+jcjJcNu13a3cIwL+XrZ5JSrtMy8fmH6uI8 sTRP5gNNSVC/R6rsXxG1COKaikN24/zgZU+8qeu80BpXAl+pmhAQhChDNpS14wBDoOdG 5kNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717508208; x=1718113008; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WzS6KTisShtv8Dg9YtzrFz5oWI6sO/s5tabpbAk8Ij8=; b=ZKIBqJkfdBTZRq2gr0n9CsncNHayesa2uiZLFW9NHf0C4wNNznI0/pEi7gHENtt1pQ 1u0CjkH2cWvbHEhGYd48B5pKOEW3XynnsvOIAHe08hYunCv5Ez37T6krMqATL1vOa1fo kreBu66xCbQuPdwZ/O/n1d6aS21lO19rIl/axSTADZDMHMBd5Johx8gcibZB2OM+qLq7 6HXXks8ZToek9JjCQsb76XjpZmP99yzAFEFgGfG3L5bpdHVzf4fBMi78f1iMJaJGCJCo 9k3ICYbcvd5Mf4a7SUb+KovWttMG95bu3d8m6fVJyjdSYQy/9+gwrqhhB997bcA/kxXP MUiw== X-Forwarded-Encrypted: i=1; AJvYcCW9d07Q/44OSvifWjx1eNMmwVIaBwHCrmwsB8swfxgk+HzHdihMUAwXXeMnAw9rXilV52qWXCQFlX95ozLcC0BCSWY4PkmVWzRzQfGRc2a1OeMo96r2+Je8cl322pdjYwxnupECUJSnb82j+89n/7je6qvCQYoTZx2SAqdmLqj0fLFtaA== X-Gm-Message-State: AOJu0YxRy9s1ribJveWAcS0SkQt5Kn9pxB7/L4Agw94iHp3ap4cSHY+y tk1Aa0k8rbrlK9UdkyovYhRzC3yEegWIKT15hDQ/I4MEmNkYt2ThZdHPtcwrcNfoSn5NxDPSaUz A7HMqIs+HJnRszLMP+aZWtYGYbcU= X-Received: by 2002:a17:906:12cc:b0:a66:87d7:39a7 with SMTP id a640c23a62f3a-a6821d6480emr767123066b.57.1717508207779; Tue, 04 Jun 2024 06:36:47 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240601092646.52139-1-joswang1221@gmail.com> <20240603130219.25825-1-joswang1221@gmail.com> <20240604000715.3rlmzxriof6wwksm@synopsys.com> In-Reply-To: <20240604000715.3rlmzxriof6wwksm@synopsys.com> From: joswang Date: Tue, 4 Jun 2024 21:36:37 +0800 Message-ID: Subject: Re: [PATCH v2, 3/3] usb: dwc3: core: Workaround for CSR read timeout To: Thinh Nguyen Cc: "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "balbi@kernel.org" , "devicetree@vger.kernel.org" , joswang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 4, 2024 at 8:07=E2=80=AFAM Thinh Nguyen wrote: > > On Mon, Jun 03, 2024, joswang wrote: > > From: joswang > > > > DWC31 version 2.00a have an issue that would cause > > a CSR read timeout When CSR read coincides with RAM > > Clock Gating Entry. > > Do you have the STAR issue number? > Thanks for reviewing the code. The STAR number provided by Synopsys is 4846132. Please help review further. > > > > This workaround solution disable Clock Gating, sacrificing > > power consumption for normal operation. > > > > Signed-off-by: joswang > > --- > > drivers/usb/dwc3/core.c | 23 +++++++++++++++++++++++ > > 1 file changed, 23 insertions(+) > > > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > > index 3a8fbc2d6b99..1df85c505c9e 100644 > > --- a/drivers/usb/dwc3/core.c > > +++ b/drivers/usb/dwc3/core.c > > @@ -978,11 +978,22 @@ static void dwc3_core_setup_global_control(struct= dwc3 *dwc) > > * > > * STAR#9000588375: Clock Gating, SOF Issues when ref_clk= -Based > > * SOF/ITP Mode Used > > + * > > + * WORKAROUND: DWC31 version 2.00a have an issue that wou= ld > > + * cause a CSR read timeout When CSR read coincides with = RAM > > + * Clock Gating Entry. > > + * > > + * This workaround solution disable Clock Gating, sacrifi= cing > > + * power consumption for normal operation. > > */ > > if ((dwc->dr_mode =3D=3D USB_DR_MODE_HOST || > > dwc->dr_mode =3D=3D USB_DR_MODE_OTG) && > > DWC3_VER_IS_WITHIN(DWC3, 210A, 250A)) > > reg |=3D DWC3_GCTL_DSBLCLKGTNG | DWC3_GCTL_SOFITP= SYNC; > > + else if ((dwc->dr_mode =3D=3D USB_DR_MODE_HOST || > > + dwc->dr_mode =3D=3D USB_DR_MODE_OTG) && > > + DWC3_VER_IS(DWC31, 200A)) > > + reg |=3D DWC3_GCTL_DSBLCLKGTNG; > > else > > reg &=3D ~DWC3_GCTL_DSBLCLKGTNG; > > break; > > @@ -992,6 +1003,18 @@ static void dwc3_core_setup_global_control(struct= dwc3 *dwc) > > * will work. Device-mode hibernation is not yet implemen= ted. > > */ > > reg |=3D DWC3_GCTL_GBLHIBERNATIONEN; > > + > > + /* > > + * WORKAROUND: DWC31 version 2.00a have an issue that wou= ld > > + * cause a CSR read timeout When CSR read coincides with = RAM > > + * Clock Gating Entry. > > + * > > + * This workaround solution disable Clock Gating, sacrifi= cing > > + * power consumption for normal operation. > > + */ > > + if ((dwc->dr_mode =3D=3D USB_DR_MODE_HOST || > > + dwc->dr_mode =3D=3D USB_DR_MODE_OTG) && DWC3_VER_IS(= DWC31, 200A)) > > + reg |=3D DWC3_GCTL_DSBLCLKGTNG; > > break; > > default: > > /* nothing */ > > -- > > 2.17.1 > > > > This doesn't seem like it should be applied globally. Please provide the > STAR number if you can so I can review further. If possible I'd prefer > to only target your platform. > Best Regards, Jos Wang > Thanks, > Thinh