From: Michal Simek <michal.simek@amd.com>
To: Sean Anderson <sean.anderson@linux.dev>,
Marek Vasut <marek.vasut@mailbox.org>,
u-boot@lists.denx.de,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Love Kumar <love.kumar@amd.com>
Subject: Re: [PATCH] usb: dwc3: Initialize Xilinx glue registers
Date: Thu, 22 Jan 2026 14:25:59 +0100 [thread overview]
Message-ID: <0d7fb416-2021-4b8a-a7b3-db72bb2ad05c@amd.com> (raw)
In-Reply-To: <ce3b1b60-4c05-4255-9a46-e32751a269a9@linux.dev>
+Love
On 1/16/26 17:14, Sean Anderson wrote:
> On 1/16/26 09:07, Marek Vasut wrote:
>> On 1/16/26 9:19 AM, Michal Simek wrote:
>>>
>>>
>>> On 1/6/26 23:17, Sean Anderson wrote:
>>>> These registers may have been initialized by SPL/FSBL, but program them
>>>> in case they have not. If they are left at their default values, the
>>>> controller will never exit reset.
>>>>
>>>> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
>>>>
>>>> ---
>>>>
>>>> drivers/usb/dwc3/dwc3-generic.c | 32 ++++++++++++++++++++++++++------
>>>> drivers/usb/dwc3/dwc3-generic.h | 2 ++
>>>> 2 files changed, 28 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3- generic.c
>>>> index c09014aec60..ce896db9532 100644
>>>> --- a/drivers/usb/dwc3/dwc3-generic.c
>>>> +++ b/drivers/usb/dwc3/dwc3-generic.c
>>>> @@ -501,6 +501,27 @@ struct dwc3_glue_ops rk_ops = {
>>>> .glue_get_ctrl_dev = dwc3_rk_glue_get_ctrl_dev,
>>>> };
>>>> +void dwc3_xlnx_glue_configure(struct udevice *dev, int index,
>>>> + enum usb_dr_mode mode)
>>>> +{
>>>> +/* USB glue registers */
>>>> +#define USB3_FPD_PIPE_CLK 0x7c
>>>> +#define USB3_FPD_POWER_PRSNT 0x80
>>>> + struct dwc3_glue_data *glue = dev_get_plat(dev);
>>>> + void *base = map_physmem(glue->regs, 0x10000, MAP_NOCACHE);
>>>> +
>>>> + if (generic_phy_valid(&glue->phy)) {
>>>> + writel(0, base + USB3_FPD_PIPE_CLK);
>>>> + writel(1, base + USB3_FPD_POWER_PRSNT);
>>>> + } else {
>>>> + writel(1, base + USB3_FPD_PIPE_CLK);
>>>> + }
>>>> +}
>>>> +
>>>> +struct dwc3_glue_ops xlnx_ops = {
>>>> + .glue_configure = dwc3_xlnx_glue_configure,
>>>> +};
>>>> +
>>>> static int dwc3_glue_bind_common(struct udevice *parent, ofnode node)
>>>> {
>>>> const char *name = ofnode_get_name(node);
>>>> @@ -621,11 +642,10 @@ int dwc3_glue_probe(struct udevice *dev)
>>>> struct udevice *child = NULL;
>>>> int index = 0;
>>>> int ret;
>>>> - struct phy phy;
>>>> - ret = generic_phy_get_by_name(dev, "usb3-phy", &phy);
>>>> + ret = generic_phy_get_by_name(dev, "usb3-phy", &glue->phy);
>>>> if (!ret) {
>>>> - ret = generic_phy_init(&phy);
>>>> + ret = generic_phy_init(&glue->phy);
>>>> if (ret)
>>>> return ret;
>>>> } else if (ret != -ENOENT && ret != -ENODATA) {
>>>> @@ -643,8 +663,8 @@ int dwc3_glue_probe(struct udevice *dev)
>>>> if (ret)
>>>> return ret;
>>>> - if (generic_phy_valid(&phy)) {
>>>> - ret = generic_phy_power_on(&phy);
>>>> + if (generic_phy_valid(&glue->phy)) {
>>>> + ret = generic_phy_power_on(&glue->phy);
>>>> if (ret)
>>>> return ret;
>>>> }
>>>> @@ -690,7 +710,7 @@ int dwc3_glue_remove(struct udevice *dev)
>>>> }
>>>> static const struct udevice_id dwc3_glue_ids[] = {
>>>> - { .compatible = "xlnx,zynqmp-dwc3" },
>>>> + { .compatible = "xlnx,zynqmp-dwc3", .data = (ulong)&xlnx_ops },
>>>> { .compatible = "xlnx,versal-dwc3" },
>>>> { .compatible = "ti,keystone-dwc3"},
>>>> { .compatible = "ti,dwc3", .data = (ulong)&ti_ops },
>>>> diff --git a/drivers/usb/dwc3/dwc3-generic.h b/drivers/usb/dwc3/dwc3- generic.h
>>>> index 40902c8923f..13f6391cae8 100644
>>>> --- a/drivers/usb/dwc3/dwc3-generic.h
>>>> +++ b/drivers/usb/dwc3/dwc3-generic.h
>>>> @@ -10,12 +10,14 @@
>>>> #define __DRIVERS_USB_DWC3_GENERIC_H
>>>> #include <clk.h>
>>>> +#include <generic-phy.h>
>>>> #include <reset.h>
>>>> #include <dwc3-uboot.h>
>>>> struct dwc3_glue_data {
>>>> struct clk_bulk clks;
>>>> struct reset_ctl_bulk resets;
>>>> + struct phy phy;
>>>> fdt_addr_t regs;
>>>> fdt_size_t size;
>>>> };
>>>
>>> I will let Marek to handle this. From my perspective we should take Jerome's patchset to update usb stack and then add this on the top.
>> Since this fixes a real bug and is isolated to xilinx platform, it would be good if xilinx at least provided feedback on this patch.
>>
>> +CC Ilias
>
> It's not a bug fix (hence no fixes tag). See [1,2] for details.
>
> --Sean
>
> [1] https://lore.kernel.org/linux-usb/8f0e04a5-49df-4fe3-9c76-9a1c0bd822a0@linux.dev/
> [2] https://lore.kernel.org/linux-usb/be8a566a-163f-4d20-b712-67de6f63a6b5@linux.dev/
Love: Can you please test this patch and provide your tested-by flag if it is
working.
Thanks,
Michal
next prev parent reply other threads:[~2026-01-22 13:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 22:17 [PATCH] usb: dwc3: Initialize Xilinx glue registers Sean Anderson
2026-01-16 8:19 ` Michal Simek
2026-01-16 14:07 ` Marek Vasut
2026-01-16 16:14 ` Sean Anderson
2026-01-22 13:25 ` Michal Simek [this message]
2026-02-17 8:48 ` Kumar, Love
2026-01-29 10:13 ` Michal Simek
2026-02-17 11:06 ` Michal Simek
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=0d7fb416-2021-4b8a-a7b3-db72bb2ad05c@amd.com \
--to=michal.simek@amd.com \
--cc=ilias.apalodimas@linaro.org \
--cc=love.kumar@amd.com \
--cc=marek.vasut@mailbox.org \
--cc=sean.anderson@linux.dev \
--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