public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Greg Malysa <greg.malysa@timesys.com>, Marek Vasut <marex@denx.de>
Cc: u-boot@lists.denx.de,
	Nathan Barrett-Morrison <nathan.morrison@timesys.com>,
	Ian Roberts <ian.roberts@timesys.com>,
	Jonas Karlman <jonas@kwiboo.se>, Simon Glass <sjg@chromium.org>,
	Teik Heng Chong <teik.heng.chong@intel.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] usb: dwc2: Add in version 4xx compatibility
Date: Tue, 16 Apr 2024 11:06:43 +0200	[thread overview]
Message-ID: <87r0f54qxo.fsf@baylibre.com> (raw)
In-Reply-To: <CAAjXUap1DDPOSKQRc3-h0m5ybv_AHZePwW-vxRSeKW1STZp-0g@mail.gmail.com>

Hi Greg,

Thank you for the contribution.

On mar., mars 26, 2024 at 11:36, Greg Malysa <greg.malysa@timesys.com> wrote:

Please avoid top-posting when replying, it makes following the
discussion more difficult:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#use-trimmed-interleaved-replies-in-email-discussions

> I'd be happy with that change. Does anyone have access to the
> associated designware databook (I do not)? We could also check to see
> if those four bits are all always allocated to the 2/3/4/x version
> number. I can submit v2 with that change instead once we know.

I don't have access to the databooks either. I usually refer to the
linux kernel code since it's a more up to date version of this driver.

Looking at
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c

we can see that the following is added:
#define DWC2_CORE_REV_MASK	0x0000ffff

This makes me believe that the versioning follows a well known pattern.

>
> On Tue, Mar 26, 2024 at 7:50 AM Marek Vasut <marex@denx.de> wrote:
>>
>> On 3/26/24 3:32 AM, Greg Malysa wrote:
>> > From: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
>> >
>> > This adds the Synopsys device id for version 4xx of the designware
>> > IP block and extends the version check to include it to permit
>> > new hardware to run. It does not add any 4xx-specific features.
>> >
>> > Signed-off-by: Ian Roberts <ian.roberts@timesys.com>
>> > Signed-off-by: Greg Malysa <greg.malysa@timesys.com>
>> > Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
>> >
>> > ---
>> >
>> >
>> > ---
>> >   drivers/usb/host/dwc2.c | 3 ++-
>> >   drivers/usb/host/dwc2.h | 1 +
>> >   2 files changed, 3 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
>> > index 637eb2dd06..6fdde6a9a7 100644
>> > --- a/drivers/usb/host/dwc2.c
>> > +++ b/drivers/usb/host/dwc2.c
>> > @@ -1180,7 +1180,8 @@ static int dwc2_init_common(struct udevice *dev, struct dwc2_priv *priv)
>> >                snpsid >> 12 & 0xf, snpsid & 0xfff);
>> >
>> >       if ((snpsid & DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_2xx &&
>> > -         (snpsid & DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_3xx) {
>> > +         (snpsid & DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_3xx &&
>> > +         (snpsid & DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_4xx) {

Note that this change is also part of:
https://lore.kernel.org/all/20240328131811.94559-1-seashell11234455@gmail.com/

>> >               dev_info(dev, "SNPSID invalid (not DWC2 OTG device): %08x\n",
>> >                        snpsid);
>> >               return -ENODEV;
>> > diff --git a/drivers/usb/host/dwc2.h b/drivers/usb/host/dwc2.h
>> > index 6f022e33a1..f202d55eb2 100644
>> > --- a/drivers/usb/host/dwc2.h
>> > +++ b/drivers/usb/host/dwc2.h
>> > @@ -739,6 +739,7 @@ struct dwc2_core_regs {
>> >   #define DWC2_PCGCCTL_DEEP_SLEEP_OFFSET                      7
>> >   #define DWC2_SNPSID_DEVID_VER_2xx                   (0x4f542 << 12)
>> >   #define DWC2_SNPSID_DEVID_VER_3xx                   (0x4f543 << 12)
>> > +#define DWC2_SNPSID_DEVID_VER_4xx                    (0x4f544 << 12)
>> >   #define DWC2_SNPSID_DEVID_MASK                              (0xfffff << 12)
>> >   #define DWC2_SNPSID_DEVID_OFFSET                    12
>>
>> Maybe it would be better/easier/futureproof to simply check if (snpsid &
>> 0xffff0 == 0x4f540) ?
>
>
>
> -- 
> Greg Malysa
> Timesys Corporation

  reply	other threads:[~2024-04-16  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26  2:32 [PATCH] usb: dwc2: Add in version 4xx compatibility Greg Malysa
2024-03-26 11:50 ` Marek Vasut
2024-03-26 15:36   ` Greg Malysa
2024-04-16  9:06     ` Mattijs Korpershoek [this message]
2024-04-19 19:21       ` Greg Malysa
2024-04-23  7:09         ` Mattijs Korpershoek
2024-04-23 22:31           ` Marek Vasut
2024-05-07  7:32             ` Greg Malysa

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=87r0f54qxo.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=greg.malysa@timesys.com \
    --cc=ian.roberts@timesys.com \
    --cc=jonas@kwiboo.se \
    --cc=marex@denx.de \
    --cc=nathan.morrison@timesys.com \
    --cc=sjg@chromium.org \
    --cc=teik.heng.chong@intel.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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