Hi Alice, On Thu, Oct 09, 2025 at 10:34, "Alice Guo (OSS)" <[email protected]> wrote:
>> -----邮件原件----- >> 发件人: Mattijs Korpershoek <[email protected]> >> 发送时间: 2025年9月29日 16:47 >> 收件人: Alice Guo (OSS) <[email protected]>; Stefano Babic >> <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx >> <[email protected]>; Tom Rini <[email protected]>; Peng Fan >> <[email protected]>; Troy Kisky <[email protected]>; Adrian >> Alonso <[email protected]>; Lukasz Majewski <[email protected]>; Mattijs >> Korpershoek <[email protected]>; Marek Vasut <[email protected]>; >> [email protected]; Alice Guo <[email protected]> >> 抄送: [email protected] >> 主题: Re: [PATCH 5/6] usb: dwc3: gadget: Add delay after software writes DCTL >> in dwc3_gadget_run_stop() >> >> Hi Alice, >> >> Thank you for the patch. >> >> On Sun, Jul 20, 2025 at 06:13, "Alice Guo (OSS)" <[email protected]> >> wrote: >> >> > From: Alice Guo <[email protected]> >> > >> > When using NXP UUU to download flash.bin to i.MX95 19x19 evk board, it >> > will get stuck in a loop at sdp_init() without this change. >> > >> > Signed-off-by: Alice Guo <[email protected]> >> >> I see that a similar change exist in the Linux kernel: >> https://lore.kernel.org/all/[email protected] >> / >> >> Please mention this change in the commit message for v2. >> See the following example: >> https://lore.kernel.org/all/[email protected] >> ch/ >> >> > --- >> > drivers/usb/dwc3/gadget.c | 1 + >> > 1 file changed, 1 insertion(+) >> > >> > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c >> > index 2b01113d54c..6b2b25c7aa5 100644 >> > --- a/drivers/usb/dwc3/gadget.c >> > +++ b/drivers/usb/dwc3/gadget.c >> > @@ -1423,6 +1423,7 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, >> int is_on, int suspend) >> > } >> > >> > dwc3_writel(dwc->regs, DWC3_DCTL, reg); >> > + mdelay(2); >> >> Can you elaborate on why 1ms is not enough? >> > > Apologies for the confusion that I previously replay this email from the > wrong email address. > > Hi Mattijs, > > Apologies for the confusion that I previously replay this email from the > wrong email address. No worries. > > This patch I submitted was indeed inspired by the change you mentioned in the > Linux kernel. The mdelay(2) value was determined empirically during testing > on our development board. > > However, after a deeper understanding of the driver, I believe the real root > cause is that the USB3 PHY was not properly initialized. When DWC3 is > configured to DWC3_DSTS_SUPERSPEED in dwc3_gadget_start(), enumeration fails > because the PHY is not ready and cannot complete the electrical and > protocol-level handshake required by USB 3.0. The delay acts as a workaround > to compensate for the missing hardware initialization or timing issues. Once > the PHY driver (phy-imx8mq-usb.c) is added and properly initializes the USB3 > PHY, the delay is no longer needed. > > The updated changes are included in the patch set titled "Enable USB and > ENETC on i.MX943 EVK", specifically in patch 6 and patch 7: > https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/ > https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/ > > Thanks for the feedback! I see, thanks for taking the time answer me. And glad you could solve this properly by enabling the PHY driver. > > Best regards, > Alice Guo

