Re: [PATCH 0/6] usb: dwc3: gadget: avoid EP command timeout

2024-05-16 Thread Mattijs Korpershoek
Hi,

On Fri, 12 Apr 2024 22:26:00 +0200, A. Sverdlin wrote:
> From: Alexander Sverdlin 
> 
> 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:
> 
> [...]

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu 
(u-boot-dfu)

[1/6] usb: dwc3: gadget: combine return points into a single one
  
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/13395507ca1f48de25e70f4d27f709b1a4fa0a82
[2/6] usb: dwc3: gadget: clear SUSPHY bit before ep cmds
  
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/967b31c3ccdc09284a4447ebc4577bb7ef06d500
[3/6] usb: dwc3: gadget: only resume USB2 PHY in <=HIGHSPEED
  
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/d107a5319e20d5e5be3bd8fa298aeca9ef4990a0
[4/6] usb: dwc3: gadget: Check ENBLSLPM before sending ep command
  
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/db11351a887e20ff86e3a4c1f466d3d8dd42754a
[5/6] usb: dwc3: gadget: properly check ep cmd
  
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/95b4d655a44626f888bf823a0561a175d456d33a
[6/6] usb: dwc3: gadget: Disable GUSB2PHYCFG.SUSPHY for End Transfer
  
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/30f39de786ff3a87006461903e41a48c811ee764

--
Mattijs


[PATCH 0/6] usb: dwc3: gadget: avoid EP command timeout

2024-04-12 Thread A. Sverdlin
From: Alexander Sverdlin 

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 +)
...
Trying to boot from DFU
dwc3-generic-peripheral usb@3100: found 16 IN and 16 OUT endpoints
dwc3-generic-peripheral usb@3100: Event buf 81e0a200 dma x length 
-2115984896
...
dwc3-generic-peripheral usb@3100: initializing ep0out
...
dwc3-generic-peripheral usb@3100: initializing ep15in
registering UDC driver []
dwc3-generic-peripheral usb@3100: gadget no-function data soft-connect
dwc3-generic-peripheral usb@3100: Enabling ep0out
dwc3-generic-peripheral usb@3100: Command Complete --> 0
dwc3-generic-peripheral usb@3100: 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-sjo...@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=SK-AM62

-- 
2.44.0