mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@mailbox.org>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	Thanh Quan <thanh.quan.xn@renesas.com>,
	Conor Dooley <conor+dt@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Rob Herring <robh@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue
Date: Tue, 11 Aug 2026 06:48:24 +0200	[thread overview]
Message-ID: <d81fc021-d7d3-4b80-8bed-f1d9ada2b167@mailbox.org> (raw)
In-Reply-To: <anpSU2q_jAssGb7_@vbox>

On 8/11/26 1:18 AM, Thinh Nguyen wrote:

>>>> +static int dwc3_renesas_rcar_gen5_init(struct dwc3_generic *dwc3g)
>>>> +{
>>>> +	struct device *dev = dwc3g->dev;
>>>> +	struct platform_device *pdev = to_platform_device(dev);
>>>> +	const char *maximum_speed;
>>>> +	bool use_usb3_flow;
>>>> +	void __iomem *glue;
>>>> +	int ret;
>>>> +
>>>> +	glue = devm_platform_ioremap_resource_byname(pdev, "glue");
>>>> +	if (IS_ERR(glue))
>>>> +		return PTR_ERR(glue);
>>>> +
>>>> +	ret = of_property_read_string(dev->of_node, "maximum-speed", &maximum_speed);
>>>> +	if (ret)
>>>> +		return dev_err_probe(dev, -ENODEV, "Failed to determine maximum speed\n");
>>>
>>> We shouldn't overload the generic "maximum-speed" definition.
>>>
>>> Can we check for the presence of the "usb3-phy" instead?
>> This could be made to work, but I don't think this would work nicely, please
>> see below.
>>
>> The Gen5 contains four DWC3 controllers, two are USB2-only and two are
>> combined USB2+USB3.2 ; the USB2-only controllers each use one PHY, the
>> USB2+USB3.2 controllers each use two PHYs -- one USB2 and one USB3 PHY.
>> -> The PHYs are always present and always connected inside the SoC, so I
>>     believe the PHYs should always be described in the SoC DT, and the
>>     DWC3 controller node should always have phandle(s) to its matching
>>     PHYs.
>>
>> The USB2-only controllers are a non-issue, there we could get away with
>> checking for the presence of "usb3-phy" and if this is missing in DT, apply
>> the magic code ("use_usb3_flow" is always false).
>>
>> It is the USB2+USB3.2 controllers that are more complicated. These
>> controllers can be downgraded to USB2-only mode. Currently, this is done via
>> this "maximum-speed" DT property, which, if set to "high-speed" or lower
>> triggers the application of the magic code. If the "maximum-speed" DT
>> property is "super-speed" or "super-speed-plus", the magic code is not
>> applied (this is the "use_usb3_flow").
>>
>> If we were to opt for checking for presence of "usb3-phy" , then the board
>> DTs (which include the SoC DT) for board which would require the USB2+USB3.2
>> controller to be downgraded to USB2-only mode would have to adjust the PHY
>> phandles of such controller DT node in board DT, which itself does not seem
>> right (DT describes the SoC hardware, and the PHY is still in the SoC and
>> connected to the controller, please see "->" above).
>>
>> That is why using "maximum-speed" is I think a bit better.
>>
>> But maybe there is yet another option that I missed ?
>>
>> Thank you for your help !
>>
> 
> I see.
> 
> My concern is that "maximum-speed" is a generic property that describes
> the maximum speed the controller is allowed to operate at. Per the
> binding, if it is not present the controller should default to its
> maximum HW capability.
> 
> Would this work for you? (Given that the usb3 phy phandle must be
> present)
> 
> 	if (!has_usb3_phy || maximum_speed <= USB_SPEED_HIGH)
> 		use_usb3_flow = false;
> 
> This way, "maximum-speed" retains its generic meaning as a speed limit
> rather than being used by itself to select Renesas specific flow.

This works nicely.

I will include a slightly reworked variant of this in V3.

Thank you !

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2026-08-11  4:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  5:03 [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller Marek Vasut
2026-08-06  5:03 ` [PATCH v2 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
2026-08-07 23:31   ` Thinh Nguyen
2026-08-08  4:15     ` Marek Vasut
2026-08-10 23:18       ` Thinh Nguyen
2026-08-11  4:48         ` Marek Vasut [this message]
2026-08-08  4:21 ` [PATCH v2 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller 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=d81fc021-d7d3-4b80-8bed-f1d9ada2b167@mailbox.org \
    --to=marek.vasut@mailbox.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=thanh.quan.xn@renesas.com \
    /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

all inboxes | Powered by JetHome®