public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 0/6] usb: dwc3: gadget: avoid EP command timeout
@ 2024-04-12 20:26 A. Sverdlin
  2024-04-12 20:26 ` [PATCH 1/6] usb: dwc3: gadget: combine return points into a single one A. Sverdlin
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: A. Sverdlin @ 2024-04-12 20:26 UTC (permalink / raw)
  To: u-boot
  Cc: Alexander Sverdlin, Marek Vasut, Felipe Balbi, Thinh Nguyen,
	Nishanth Menon, Sjoerd Simons

From: Alexander Sverdlin <alexander.sverdlin@siemens.com>

While there are happy users who successfully have been using DFU on TI
AM62x [1][2], there are also others who were not so lucky up to now [3].

I felt into latter category and was wondering why I observe this:

--
U-Boot SPL 2024.04-61876f393762 (Apr 11 2024 - 09:27:15 +0000)
...
Trying to boot from DFU
dwc3-generic-peripheral usb@31000000: found 16 IN and 16 OUT endpoints
dwc3-generic-peripheral usb@31000000: Event buf 81e0a200 dma 00000000x length -2115984896
...
dwc3-generic-peripheral usb@31000000: initializing ep0out
...
dwc3-generic-peripheral usb@31000000: initializing ep15in
registering UDC driver []
dwc3-generic-peripheral usb@31000000: gadget no-function data soft-connect
dwc3-generic-peripheral usb@31000000: Enabling ep0out
dwc3-generic-peripheral usb@31000000: Command Complete --> 0
dwc3-generic-peripheral usb@31000000: failed to enable ep0out
failed to start : -110
g_dnl_register: failed!, error: -110
g_dnl_register failedSPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
--

It turned out the timeout happened in dwc3_send_gadget_ep_cmd() on
DWC3_DEPCMD_SETEPCONFIG command and while the "timeout" has been increased
in Linux from 500 to 1000 and later 5000, in my case it took more than
77000 1us cycles to successfully complete.

It turns out that Linux DWC3 gadget code has been improved in the meanwhile
to follow DWC3 programming guide more precisely. Porting the following
Linux patches solved the timeout issue in U-Boot SPL on TI AM6232.

Strictly speaking
"usb: dwc3: gadget: Disable GUSB2PHYCFG.SUSPHY for End Transfer" and
"usb: dwc3: gadget: properly check ep cmd" are not required to tackle
the observed timeout, but it keeps the whole code block in sync with
Linux v6.8.

Felipe Balbi (4):
  usb: dwc3: gadget: combine return points into a single one
  usb: dwc3: gadget: clear SUSPHY bit before ep cmds
  usb: dwc3: gadget: only resume USB2 PHY in <=HIGHSPEED
  usb: dwc3: gadget: properly check ep cmd

Thinh Nguyen (2):
  usb: dwc3: gadget: Check ENBLSLPM before sending ep command
  usb: dwc3: gadget: Disable GUSB2PHYCFG.SUSPHY for End Transfer

 drivers/usb/dwc3/core.h   |  2 ++
 drivers/usb/dwc3/gadget.c | 47 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 3 deletions(-)

1: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/tree/configs/am62x_evm_r5_usbdfu_defconfig?h=09.02.00.009
2: https://lore.kernel.org/all/20240112085317.1866449-1-sjoerd@collabora.com/T/
3: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1162644/sk-am62-am62-android-fastboot-0-issue?tisearch=e2e-sitesearch&keymatch=SK-AM62

-- 
2.44.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-05-16  6:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12 20:26 [PATCH 0/6] usb: dwc3: gadget: avoid EP command timeout A. Sverdlin
2024-04-12 20:26 ` [PATCH 1/6] usb: dwc3: gadget: combine return points into a single one A. Sverdlin
2024-05-14 12:48   ` Mattijs Korpershoek
2024-04-12 20:26 ` [PATCH 2/6] usb: dwc3: gadget: clear SUSPHY bit before ep cmds A. Sverdlin
2024-05-14 12:52   ` Mattijs Korpershoek
2024-04-12 20:26 ` [PATCH 3/6] usb: dwc3: gadget: only resume USB2 PHY in <=HIGHSPEED A. Sverdlin
2024-05-14 12:55   ` Mattijs Korpershoek
2024-04-12 20:26 ` [PATCH 4/6] usb: dwc3: gadget: Check ENBLSLPM before sending ep command A. Sverdlin
2024-05-14 12:57   ` Mattijs Korpershoek
2024-04-12 20:26 ` [PATCH 5/6] usb: dwc3: gadget: properly check ep cmd A. Sverdlin
2024-05-14 13:00   ` Mattijs Korpershoek
2024-04-12 20:26 ` [PATCH 6/6] usb: dwc3: gadget: Disable GUSB2PHYCFG.SUSPHY for End Transfer A. Sverdlin
2024-04-13  6:02   ` Greg Kroah-Hartman
2024-05-14 13:05   ` Mattijs Korpershoek
2024-05-16  6:40 ` [PATCH 0/6] usb: dwc3: gadget: avoid EP command timeout Mattijs Korpershoek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox