All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Marek Vasut <marek.vasut@mailbox.org>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>
Subject: Re: [PATCH v5 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue
Date: Tue, 1 Sep 2026 01:17:46 +0000	[thread overview]
Message-ID: <apYmMt_vK5fbjBUJ@vbox> (raw)
In-Reply-To: <1fa4e305-5717-4a99-9e53-3a7fa1c5df1e@mailbox.org>

On Sat, Aug 29, 2026, Marek Vasut wrote:
> On 8/29/26 12:40 AM, Thinh Nguyen wrote:
> 
> Hello Thinh,
> 
> > On Fri, Aug 28, 2026, Marek Vasut wrote:
> > > On 8/28/26 8:30 PM, sashiko-bot@kernel.org wrote:
> > > > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > > > - [High] Missing 'maximum-speed' DT property incorrectly forces the controller into USB 2.0-only mode, overriding PHY-based detection.
> > > > --
> > > > 
> > > > commit 0727bb2cc9c155e4d5497db94c337bc5b2603464
> > > > Author: Thanh Quan <thanh.quan.xn@renesas.com>
> > > > usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue
> > > > 
> > > > This commit extends the generic DWC3 platform driver with glue logic for
> > > > Renesas R-Car Gen5 USB controllers. It handles hardware initialization and
> > > > evaluates PHY presence alongside device tree properties to determine maximum
> > > > supported USB speeds.
> > > > 
> > > > > diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
> > > > > index ca69ac0eb07ce..3994a6d93b9de 100644
> > > > > --- a/drivers/usb/dwc3/dwc3-generic-plat.c
> > > > > +++ b/drivers/usb/dwc3/dwc3-generic-plat.c
> > > > [ ... ]
> > > > > @@ -71,6 +71,55 @@ static int dwc3_eic7700_init(struct dwc3_generic *dwc3g)
> > > > >    	return 0;
> > > > >    }
> > > > > +static int dwc3_renesas_rcar_gen5_init(struct dwc3_generic *dwc3g)
> > > > > +{
> > > > > +	struct device *dev = dwc3g->dev;
> > > > > +	struct platform_device *pdev = to_platform_device(dev);
> > > > > +	enum usb_device_speed speed = usb_get_maximum_speed(dev);
> > > > > +	bool usb2only = false;
> > > > > +	void __iomem *glue;
> > > > > +
> > > > > +	/* Wireless USB is not supported */
> > > > > +	if (speed == USB_SPEED_WIRELESS)
> > > > > +		return dev_err_probe(dev, -EINVAL, "Wireless USB not supported\n");
> > > > > +
> > > > > +	/* No USB 3 PHY in DT means this is surely USB 2 controller */
> > > > > +	if (device_property_match_string(dev, "phy-names", "usb3-phy") < 0)
> > > > > +		usb2only = true;
> > > > > +
> > > > > +	if (speed <= USB_SPEED_HIGH)
> > > > > +		usb2only = true;
> > > > 
> > > > [Severity: High]
> > > > Will this condition inadvertently force the controller into USB 2.0 mode when
> > > > the maximum-speed property is missing from the device tree?
> > > > 
> > > > When the maximum-speed property is absent, usb_get_maximum_speed() returns
> > > > USB_SPEED_UNKNOWN, which evaluates to 0. Since 0 is less than USB_SPEED_HIGH,
> > > > this condition evaluates to true and unconditionally sets usb2only to true.
> > 
> > Right. I missed that.
> > 
> > > > 
> > > > This appears to override the preceding logic that correctly checked the
> > > > phy-names property to detect USB 3 capabilities. Could this cause hardware
> > > > with a USB 3 PHY to be improperly downgraded to USB 2.0 mode?
> > > 
> > > Thinh, maybe I should restore the V4 conditional here ?
> > 
> > Sure
> 
> I did that in V6.
> 
> > , but please drop the speed == USB_SPEED_WIRELESS check. This sanity
> > check is not necessary and would be flagged by dwc3 core if set anyway.
> Could you please point me to the code which filters the WIRELESS USB out ? I
> can't seem to find it in either DWC3 core or USB core, but maybe I am not
> looking for the right thing.
> 
> Thank you for your help !

You can find this in __dwc3_gadget_set_speed(). The switch statement
explicitly handles unsupported speeds, and setting the speed to
USB_SPEED_LOW or USB_SPEED_WIRELESS will trigger a complaint there.

BR,
Thinh

  reply	other threads:[~2026-09-01  1:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 18:23 [PATCH v5 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller Marek Vasut
2026-08-28 18:23 ` [PATCH v5 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
2026-08-28 18:30   ` sashiko-bot
2026-08-28 18:36     ` Marek Vasut
2026-08-28 22:40       ` Thinh Nguyen
2026-08-29  3:00         ` Marek Vasut
2026-09-01  1:17           ` Thinh Nguyen [this message]
2026-09-01  2:05             ` Marek Vasut
2026-09-02  2:29               ` Thinh Nguyen
2026-09-03 21:31                 ` Marek Vasut

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=apYmMt_vK5fbjBUJ@vbox \
    --to=thinh.nguyen@synopsys.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=marek.vasut@mailbox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.