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:36:59 +0000 [thread overview]
Message-ID: <20240607223656.q64isjf2gm3arhkh@synopsys.com> (raw)
In-Reply-To: <CAMtoTm3tSNKdv+LOCeQFtFpGq=6yNqTm8Jq=koFfAxT4UamOQg@mail.gmail.com>
On Fri, Jun 07, 2024, joswang wrote:
> On Thu, Jun 6, 2024 at 9:29 AM Thinh Nguyen <Thinh.Nguyen@synopsys.com> wrote:
> >
> > On Tue, Jun 04, 2024, joswang wrote:
> > > On Tue, Jun 4, 2024 at 8:07 AM Thinh Nguyen <Thinh.Nguyen@synopsys.com> wrote:
> > > >
> > > > On Mon, Jun 03, 2024, joswang wrote:
> > > > > From: joswang <joswang@lenovo.com>
> > > > >
> > > > > 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.
> >
> > I've confirmed internally. As you have noted, this applies to DWC_usb31
> > v2.00a for host mode only and DRD mode operating as host.
> >
> > >
> > > > >
> > > > > This workaround solution disable Clock Gating, sacrificing
> > > > > power consumption for normal operation.
> > > > >
> > > > > Signed-off-by: joswang <joswang@lenovo.com>
> > > > > ---
> > > > > 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
> >
> > Since there's another STAR, let's split the if-else case separately and
> > provide the comments separately.
> >
> OK
> > > > > + *
> > > > > + * WORKAROUND: DWC31 version 2.00a have an issue that would
> >
> > Can we use the full name DWC_usb31 instead of DWC31.
> >
> Subsequent V3 versions use DWC_usb31
> > > > > + * cause a CSR read timeout When CSR read coincides with RAM
> > > > > + * Clock Gating Entry.
> > > > > + *
> > > > > + * This workaround solution disable Clock Gating, sacrificing
> > > > > + * power consumption for normal operation.
> > > > > */
> > > > > if ((dwc->dr_mode == USB_DR_MODE_HOST ||
> > > > > dwc->dr_mode == USB_DR_MODE_OTG) &&
> > > > > DWC3_VER_IS_WITHIN(DWC3, 210A, 250A))
> > > > > reg |= DWC3_GCTL_DSBLCLKGTNG | DWC3_GCTL_SOFITPSYNC;
> > > > > + else if ((dwc->dr_mode == USB_DR_MODE_HOST ||
> > > > > + dwc->dr_mode == USB_DR_MODE_OTG) &&
> >
> > There's no OTG mode for DWC_usb31. Let's enable this workaround if the
> > HW mode is not DWC_GHWPARAMS0_MODE_GADGET.
> >
> > > > > + DWC3_VER_IS(DWC31, 200A))
> > > > > + reg |= DWC3_GCTL_DSBLCLKGTNG;
> > > > > else
> > > > > reg &= ~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 implemented.
> > > > > */
> > > > > reg |= DWC3_GCTL_GBLHIBERNATIONEN;
> > > > > +
> > > > > + /*
> > > > > + * WORKAROUND: DWC31 version 2.00a have an issue that would
> > > > > + * cause a CSR read timeout When CSR read coincides with RAM
> > > > > + * Clock Gating Entry.
> > > > > + *
> > > > > + * This workaround solution disable Clock Gating, sacrificing
> > > > > + * power consumption for normal operation.
> > > > > + */
> > > > > + if ((dwc->dr_mode == USB_DR_MODE_HOST ||
> > > > > + dwc->dr_mode == USB_DR_MODE_OTG) && DWC3_VER_IS(DWC31, 200A))
> > > > > + reg |= DWC3_GCTL_DSBLCLKGTNG;
> > > > > break;
> > > > > default:
> > > > > /* nothing */
> > > > > --
> > > > > 2.17.1
> > > > >
> > > >
> >
> > We have the same checks and comments here. Can we refactor?
> > Perhaps something this?
> >
> > power_opt = DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1);
> > switch (power_opt) {
> > ...
> > }
> >
> > /*
> > * <comment>
> > */
> > if (power_opt != DWC3_GHWPARAMS1_EN_PWROPT_NO) {
> > }
> >
> >
> > Thanks,
> > Thinh
>
> Thank you for your valuable suggestions.I can refactor according to
> your suggestion.
> Do I need to submit a V3 version patch separately, or should I submit
> a V3 version patch together with other cases?
I haven't reviewed the other case in detail yet. I'll get back on that.
It may be better if you can submit this separatedly so that the other
case won't hold this back (and it maybe easier for tracking too).
Thanks,
Thinh
next prev parent reply other threads:[~2024-06-07 22:37 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 [this message]
[not found] ` <CAMtoTm1roAvvWCu9LSfcbnozZnakMEexdUVxNyZ7N5KOG8tHcg@mail.gmail.com>
2024-06-07 22:49 ` Thinh Nguyen
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=20240607223656.q64isjf2gm3arhkh@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