All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: "Alice Guo (OSS)" <alice.guo@oss.nxp.com>,
	Mattijs Korpershoek <mkorpershoek@kernel.org>,
	"Alice Guo (OSS)" <alice.guo@oss.nxp.com>,
	Stefano Babic <sbabic@nabladev.com>,
	Fabio Estevam <festevam@gmail.com>,
	dl-uboot-imx <uboot-imx@nxp.com>, Tom Rini <trini@konsulko.com>,
	Peng Fan <peng.fan@nxp.com>,
	Troy Kisky <troy.kisky@boundarydevices.com>,
	Adrian Alonso <adrian.alonso@nxp.com>,
	Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@denx.de>,
	"tharvey@gateworks.com" <tharvey@gateworks.com>,
	Alice Guo <alice.guo@nxp.com>
Cc: "u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: Re: 回复: [PATCH 5/6] usb: dwc3: gadget: Add delay after software writes DCTL in dwc3_gadget_run_stop()
Date: Thu, 09 Oct 2025 14:38:49 +0200	[thread overview]
Message-ID: <878qhkw8py.fsf@kernel.org> (raw)
In-Reply-To: <PAXPR04MB964469BED1917590C26B835DE2EEA@PAXPR04MB9644.eurprd04.prod.outlook.com>

Hi Alice,

On Thu, Oct 09, 2025 at 10:34, "Alice Guo (OSS)" <alice.guo@oss.nxp.com> wrote:

>> -----邮件原件-----
>> 发件人: Mattijs Korpershoek <mkorpershoek@kernel.org>
>> 发送时间: 2025年9月29日 16:47
>> 收件人: Alice Guo (OSS) <alice.guo@oss.nxp.com>; Stefano Babic
>> <sbabic@nabladev.com>; Fabio Estevam <festevam@gmail.com>; dl-uboot-imx
>> <uboot-imx@nxp.com>; Tom Rini <trini@konsulko.com>; Peng Fan
>> <peng.fan@nxp.com>; Troy Kisky <troy.kisky@boundarydevices.com>; Adrian
>> Alonso <adrian.alonso@nxp.com>; Lukasz Majewski <lukma@denx.de>; Mattijs
>> Korpershoek <mkorpershoek@kernel.org>; Marek Vasut <marex@denx.de>;
>> tharvey@gateworks.com; Alice Guo <alice.guo@nxp.com>
>> 抄送: u-boot@lists.denx.de
>> 主题: 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)" <alice.guo@oss.nxp.com>
>> wrote:
>> 
>> > From: Alice Guo <alice.guo@nxp.com>
>> >
>> > 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 <alice.guo@nxp.com>
>> 
>> I see that a similar change exist in the Linux kernel:
>> https://lore.kernel.org/all/20220901193625.8727-4-quic_wcheng@quicinc.com
>> /
>> 
>> Please mention this change in the commit message for v2.
>> See the following example:
>> https://lore.kernel.org/all/20250110-dwc2-dev-v4-7-987f4fd6f8b2@pigmoral.te
>> 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/20250923-usbnetc-v1-6-507cddbe7214@oss.nxp.com/
> https://patchwork.ozlabs.org/project/uboot/patch/20250923-usbnetc-v1-7-507cddbe7214@oss.nxp.com/
>
> 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

  reply	other threads:[~2025-10-09 12:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-19 22:13 [PATCH 0/6] imx95: support USB SDP on USB3 interface Alice Guo (OSS)
2025-07-19 22:13 ` [PATCH 1/6] Update VID/PID Alice Guo (OSS)
2025-07-31 19:08   ` Tim Harvey
2025-07-19 22:13 ` [PATCH 2/6] Add serial# for SPL SDP download Alice Guo (OSS)
2025-07-19 22:13 ` [PATCH 3/6] usb: f_sdp: Update SDP driver to support PQC container Alice Guo (OSS)
2025-07-19 22:13 ` [PATCH 4/6] imx95: Remove ROM info USB instance workaround for B0 Alice Guo (OSS)
2025-07-29 16:16   ` Tim Harvey
2025-07-19 22:13 ` [PATCH 5/6] usb: dwc3: gadget: Add delay after software writes DCTL in dwc3_gadget_run_stop() Alice Guo (OSS)
2025-09-29  8:46   ` Mattijs Korpershoek
2025-10-09 10:16     ` 回复: [EXT] " Alice Guo
2025-10-09 10:20     ` Alice Guo
2025-10-09 10:22     ` Alice Guo
2025-10-09 10:23     ` Alice Guo
2025-10-09 10:34     ` 回复: " Alice Guo (OSS)
2025-10-09 12:38       ` Mattijs Korpershoek [this message]
2025-07-19 22:13 ` [PATCH 6/6] imx95: Add support for booting from USB SDP on USB3 Alice Guo (OSS)

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=878qhkw8py.fsf@kernel.org \
    --to=mkorpershoek@kernel.org \
    --cc=adrian.alonso@nxp.com \
    --cc=alice.guo@nxp.com \
    --cc=alice.guo@oss.nxp.com \
    --cc=festevam@gmail.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@nabladev.com \
    --cc=tharvey@gateworks.com \
    --cc=trini@konsulko.com \
    --cc=troy.kisky@boundarydevices.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.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 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.