All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG REPORT] usb: dwc3: Timeouts with USB 2.0 LPM active
@ 2021-05-03 13:12 Sebastian von Ohr
  2021-05-03 13:52 ` Felipe Balbi
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian von Ohr @ 2021-05-03 13:12 UTC (permalink / raw)
  To: felipe.balbi; +Cc: linux-usb

[-- Attachment #1: Type: text/plain, Size: 2157 bytes --]

I'm running an Intel Apollo Lake SoM (Celeron N3350E) which I want to use as 
a USB gadget with the functionFS gadget driver. I have created two bulk 
endpoints for sending and receiving data. The hardware and cabling is only USB 
2.0 capable. In one test case the receive side of the SoM is slowed down 
deliberately (200ms sleep between reads) while the host PC tries to send as 
fast as possible. This setup leads to send timeouts on every second 
transmission on the host PC.

I believe this is an issue with the USB 2.0 LPM feature, more specifically 
hardware LPM done by the host USB controller. I have tested different USB 
descriptors and the issue is gone when removing the USB_LPM_SUPPORT flag from 
the USB 2.0 extension descriptor (actually removing only USB_BESL_SUPPORT seems 
to suffice). Also the issue occurs only on some newer PCs and adding a hub 
(doesn't matter if 2.0 or 3.0 capable) makes the issue go away. I can 
reproduce this issue with a Windows 10 (1909) host running an Intel B360 
chipset. I use libusb v1.0.24 with the WinUSB driver on the host side to send 
data on the bulk endpoint.

See the attached dwc3 trace and registers. It was created using the current 
5.12.1 kernel version. It shows multiple WakeUp [U0] events in short succession 
but never any event showing different link states than U0. The host is doing 8 
transmissions of 16 bytes to the device, but the device only receives 4 of 
these transmissions. The first transmissions always succeeds while the next one 
will timeout on the host. I believe this is because the device is currently not 
ready to receive new data. But instead of sending the data when the delay on 
the receive side is over the request never finishes and times out after 1 
second (or even longer when I increase the timeout value).

Is the USB 2.0 LPM extension even supposed to work with the dwc3 controller? I 
can work around this issue currently by downgrading the device to USB 2.0 only 
(setting bcdUSB to 0x0200). But I believe USB 3.0 capable device must support 
LPM, so this issue might come up again when having USB 3.0 capable hardware.

[-- Attachment #2: dwc3_trace.tar.gz --]
[-- Type: application/x-gzip, Size: 15279 bytes --]

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

end of thread, other threads:[~2021-05-12  9:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 13:12 [BUG REPORT] usb: dwc3: Timeouts with USB 2.0 LPM active Sebastian von Ohr
2021-05-03 13:52 ` Felipe Balbi
2021-05-03 14:15   ` Sebastian von Ohr
2021-05-04  6:28     ` Felipe Balbi
2021-05-04  9:47       ` Sebastian von Ohr
2021-05-05 12:37         ` Felipe Balbi
2021-05-12  9:28           ` Sebastian von Ohr
2021-05-05  8:02   ` Mathias Nyman

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.