public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: joswang <joswang1221@gmail.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"balbi@kernel.org" <balbi@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	joswang <joswang@lenovo.com>
Subject: Re: [PATCH v2, 3/3] usb: dwc3: core: Workaround for CSR read timeout
Date: Fri, 7 Jun 2024 22:49:48 +0000	[thread overview]
Message-ID: <20240607224946.wob7gfgzhozvg7gq@synopsys.com> (raw)
In-Reply-To: <CAMtoTm1roAvvWCu9LSfcbnozZnakMEexdUVxNyZ7N5KOG8tHcg@mail.gmail.com>

On Fri, Jun 07, 2024, joswang wrote:

> My initial idea was similar to yours,Please help review the following changes.


> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 3a8fbc2d6b99..8c6a09718737 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -961,11 +961,15 @@ static bool dwc3_core_is_valid(struct dwc3 *dwc)
>  static void dwc3_core_setup_global_control(struct dwc3 *dwc)
>  {
>         u32 reg;
> +       unsigned int power_opt;
> +       unsigned int hw_mode;

Use reverse christmas tree declaration style:

	type1 abcdefg
	type2 abcde
	type3 abc

>  
>         reg = dwc3_readl(dwc->regs, DWC3_GCTL);
>         reg &= ~DWC3_GCTL_SCALEDOWN_MASK;
> +       hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0);
> +       power_opt = DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1);
>  
> -       switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) {
> +       switch (power_opt) {
>         case DWC3_GHWPARAMS1_EN_PWROPT_CLK:
>                 /**
>                  * WORKAROUND: DWC3 revisions between 2.10a and 2.50a have an
> @@ -998,6 +1002,18 @@ static void dwc3_core_setup_global_control(struct dwc3
> *dwc)
>                 break;
>         }
>  
> +       /*
> +        * WORKAROUND: DWC_usb31 version 2.00a have an issue that would
> +        * cause a CSR read timeout When CSR read coincides with RAM
> +        * Clock Gating Entry.

Note in the comment and commit message that this applies while operating
as host mode. Add the STAR number reference in the commit message.

> +        *
> +        * This workaround solution disable Clock Gating, sacrificing
> +        * power consumption for normal operation.
> +        */
> +       if (power_opt != DWC3_GHWPARAMS1_EN_PWROPT_NO &&
> +           hw_mode != DWC3_GHWPARAMS0_MODE_GADGET && DWC3_VER_IS(DWC31, 200A))
> +               reg |= DWC3_GCTL_DSBLCLKGTNG;
> +

Thanks,
Thinh

  parent reply	other threads:[~2024-06-07 22:50 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01  9:26 [PATCH 1/2] usb: dwc3: core: add p3p2tranok quirk joswang
2024-06-01  9:32 ` [PATCH 2/2] usb: dwc3: core: Workaround for CSR read timeout joswang
2024-06-03 13:00 ` [PATCH v2, 1/3] dt-bindings: usb: dwc3: Add snps,p2p3tranok quirk joswang
2024-06-04  6:33   ` Krzysztof Kozlowski
2024-06-12 14:28     ` joswang
2024-06-13  6:09       ` Krzysztof Kozlowski
2024-06-03 13:01 ` [PATCH v2, 2/3] usb: dwc3: core: add p3p2tranok quirk joswang
2024-06-04  0:02   ` Thinh Nguyen
2024-06-05  4:49     ` joswang
2024-06-07 14:24     ` joswang
2024-06-19 11:56     ` joswang
2024-06-22  0:05       ` Thinh Nguyen
2024-06-25 13:31         ` joswang
2024-06-26  1:29           ` Thinh Nguyen
2024-07-01 11:48             ` joswang
2024-06-03 13:02 ` [PATCH v2, 3/3] usb: dwc3: core: Workaround for CSR read timeout joswang
2024-06-04  0:07   ` Thinh Nguyen
2024-06-04 13:36     ` joswang
2024-06-04 23:13       ` Thinh Nguyen
2024-06-06  1:29       ` Thinh Nguyen
2024-06-07 14:07         ` joswang
2024-06-07 22:36           ` Thinh Nguyen
     [not found]         ` <CAMtoTm1roAvvWCu9LSfcbnozZnakMEexdUVxNyZ7N5KOG8tHcg@mail.gmail.com>
2024-06-07 22:49           ` Thinh Nguyen [this message]
2024-06-11 14:29 ` [PATCH v3, " joswang
2024-06-12  7:58   ` Greg KH
2024-06-12 12:44     ` joswang
2024-06-12 13:52     ` joswang
2024-06-12 14:07       ` Greg KH
2024-06-12 14:15         ` joswang
2024-06-12  7:58   ` Greg KH
2024-06-12 12:47     ` joswang
2024-06-12 12:56       ` Greg KH
2024-06-12 13:39         ` joswang
2024-06-12 13:52           ` Greg KH
2024-06-12 14:54 ` [PATCH v3, 1/3] dt-bindings: usb: dwc3: Add snps,p2p3tranok quirk joswang
2024-06-12 15:07 ` [PATCH v3, 2/3] usb: dwc3: core: add p3p2tranok quirk joswang
2024-06-12 15:23 ` [PATCH v4, 1/3] dt-bindings: usb: dwc3: Add snps,p2p3tranok quirk joswang
2024-06-13  6:17   ` Krzysztof Kozlowski
2024-06-13 13:19     ` joswang
2024-06-13 14:03       ` Krzysztof Kozlowski
2024-06-12 15:36 ` [PATCH v4, 2/3] usb: dwc3: core: add p3p2tranok quirk joswang
2024-06-12 15:39 ` [PATCH v4, 3/3] usb: dwc3: core: Workaround for CSR read timeout joswang
2024-06-12 17:04   ` Greg KH
2024-06-12 17:13     ` Conor Dooley
2024-06-13 11:46     ` joswang
2024-06-18  0:05       ` Thinh Nguyen
2024-06-18  4:24         ` Jung Daehwan
2024-06-18 21:36           ` Thinh Nguyen
2024-06-19  1:34             ` Jung Daehwan
2024-06-18 12:47         ` joswang
2024-06-18 13:38           ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240607224946.wob7gfgzhozvg7gq@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joswang1221@gmail.com \
    --cc=joswang@lenovo.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox