From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: "André Draszik" <andre.draszik@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: gadget: fix writing NYET threshold
Date: Fri, 6 Dec 2024 19:27:45 +0000 [thread overview]
Message-ID: <20241206192745.hleuzue7kilari4x@synopsys.com> (raw)
In-Reply-To: <20241206192015.pwecvtssndjfi7qg@synopsys.com>
On Fri, Dec 06, 2024, Thinh Nguyen wrote:
> On Fri, Dec 06, 2024, André Draszik wrote:
> > Before writing a new value to the register, the old value needs to be
> > masked out for the new value to be programmed as intended.
> >
> > At the moment, the dwc3 core initialises the threshold to the maximum
> > value (0xf), with the option to override it via a DT. No upstream DTs
> > seem to override it, therefore this commit doesn't change behaviour for
> > any upstream platform. Nevertheless, the code should be fixed to have
> > the desired outcome.
> >
> > Do so.
> >
> > Signed-off-by: André Draszik <andre.draszik@linaro.org>
> > ---
> > drivers/usb/dwc3/core.h | 1 +
> > drivers/usb/dwc3/gadget.c | 4 +++-
> > 2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> > index ee73789326bc..9335fd095968 100644
> > --- a/drivers/usb/dwc3/core.h
> > +++ b/drivers/usb/dwc3/core.h
> > @@ -465,6 +465,7 @@
> >
> > /* These apply for core versions 1.94a and later */
> > #define DWC3_DCTL_NYET_THRES(n) (((n) & 0xf) << 20)
> > +#define DWC3_DCTL_NYET_THRES_MASK DWC3_DCTL_NYET_THRES(0xf)
>
> If you're going to define a mask macro this way, do this:
> DWC3_DCTL_NYET_THRES(~0)
>
Actually, let's keep it consistent as how the other masks are defined,
don't use DWC3_DCTL_NYET_THRES(n) to define the mask.
Use GENMASK or do something like this:
#define DWC3_DCTL_NYET_THRES_MASK (0xf << 20)
BR,
Thinh
prev parent reply other threads:[~2024-12-06 19:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 12:19 [PATCH] usb: dwc3: gadget: fix writing NYET threshold André Draszik
2024-12-06 19:20 ` Thinh Nguyen
2024-12-06 19:27 ` Thinh Nguyen [this message]
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=20241206192745.hleuzue7kilari4x@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=andre.draszik@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.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