From: Marek Vasut <marek.vasut@mailbox.org>
To: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: 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>,
linux-usb@vger.kernel.org, Rob Herring <robh@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v6 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue
Date: Sun, 30 Aug 2026 03:25:57 +0200 [thread overview]
Message-ID: <df54684e-6529-4e61-bd5e-170014fc1c3d@mailbox.org> (raw)
In-Reply-To: <d801ecb2-587f-480a-878e-8426239b7690@oss.qualcomm.com>
On 8/29/26 6:19 PM, Krishna Kurapati wrote:
Hi,
>> +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;
>> +
>
> Why not just set the maximum-speed property to "high-speed" instead of
> checking for "usb3-phy". That would be more clean.
Please see 1/2, maximum-speed DT property and the presence of the
usb3-phy are both optional, hence this code. Also, this was discussed in
previous version 2 of this patchset already.
>> + if (speed >= USB_SPEED_LOW && speed <= USB_SPEED_HIGH)
>> + usb2only = true;
>
> And this check can be removed as well if we use "maximum-speed" property
> in DT.
Please see above.
>> +
>> + glue = devm_platform_ioremap_resource_byname(pdev, "glue");
>> + if (IS_ERR(glue))
>> + return PTR_ERR(glue);
>> +
>> + /*
>> + * The datasheet describes initialization procedure without full
>> + * information about the registers. Therefore, the source code is
>> + * based on the bare metal code shared by the board team.
>> + */
>> + writew(0x211, glue + 0x26);
>> +
>> + /* USB2 does need additional register programming. */
>> + if (!usb2only)
>> + return 0;
>> +
>> + writew(0x11, glue + 0x81c);
>> + writew(0x0, glue + 0x81a);
>> + writew(0x1, glue + 0x802);
>> +
>> + usleep_range(10000, 20000);
>> +
>> + writew(0x0, glue + 0x802);
>> + writew(0x1, glue + 0x2a);
>> + writew(0x1, glue + 0x81a);
>> +
>> + usleep_range(10000, 20000);
>> +
>
> Use #defines for register offsets and register values like in
> dwc3_eic7700_init.
Please see the comment above this section, it clarifies why the magic
numbers, and it was discussed in previous version 1 of this patchset too.
prev parent reply other threads:[~2026-08-30 3:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 18:41 [PATCH v6 1/2] dt-bindings: usb: dwc3: Document Renesas R-Car Gen5 DWC3 xHCI USB controller Marek Vasut
2026-08-28 18:41 ` [PATCH v6 2/2] usb: dwc3: dwc3-generic-plat: Add Renesas R-Car Gen5 DWC3 xHCI USB controller glue Marek Vasut
2026-08-28 18:51 ` sashiko-bot
2026-08-29 16:19 ` Krishna Kurapati
2026-08-30 1:25 ` Marek Vasut [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=df54684e-6529-4e61-bd5e-170014fc1c3d@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=krishna.kurapati@oss.qualcomm.com \
--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