U-boot Archive mirror
 help / color / mirror / Atom feed
From: "A. Sverdlin" <alexander.sverdlin@siemens.com>
To: u-boot@lists.denx.de
Cc: Alexander Sverdlin <alexander.sverdlin@siemens.com>,
	Marek Vasut <marex@denx.de>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Nishanth Menon <nm@ti.com>, Sjoerd Simons <sjoerd@collabora.com>
Subject: [PATCH 0/6] usb: dwc3: gadget: avoid EP command timeout
Date: Fri, 12 Apr 2024 22:26:00 +0200	[thread overview]
Message-ID: <20240412202611.3565052-1-alexander.sverdlin@siemens.com> (raw)

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


             reply	other threads:[~2024-04-12 20:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 20:26 A. Sverdlin [this message]
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

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=20240412202611.3565052-1-alexander.sverdlin@siemens.com \
    --to=alexander.sverdlin@siemens.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=marex@denx.de \
    --cc=nm@ti.com \
    --cc=sjoerd@collabora.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).