andy-shev / linux

Linux kernel source tree
Other
25 stars 11 forks source link

eem gadget works only after cold reboot #31

Closed htot closed 3 years ago

htot commented 3 years ago

This was with your configurations rebased on 5.10.24 (LTS) https://github.com/edison-fw/linux/commits/eds-acpi-5.10.24 I have bitbake apply 2 other (relevant) patches:

SRC_URI_append = " file://0001-HACK-do-not-enumerated-SFI-devices.patch"
SRC_URI_append = " file://0001-usb-dwc3-pci-Enable-dis_uX_susphy_quirk-for-Intel-Me.patch"

I'll highlight the interesting bits and have some conclusions at the end:

This is to test eem ethernet gadget (Connector USB 2 shown as 2 on the photo).

afbeelding

In these tests I leave edison-arduino switch in gadget mode (Switch 1 in the position as shown on the photo). Communication with edison is through console (Connector USB 1 shown as 3 on the photo)

1) Cold boot (press Edison reset button 7 sec), with USB 2 unplugged, wait for prompt, login, plug USB 2

root@yuna:~# connmanctl services
*AO Wired                gadget_aabbccddeef1_usb
...

root@yuna:~# ifconfig
...

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 10.42.0.221  netmask 255.255.255.0  broadcast 10.42.0.255
        inet6 fe80::a8bb:ccff:fedd:eef1  prefixlen 64  scopeid 0x20<link>
        ether aa:bb:cc:dd:ee:f1  txqueuelen 1000  (Ethernet)
        RX packets 45  bytes 7074 (6.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 43  bytes 6173 (6.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@yuna:~# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.42.0.1, port 50840
[  5] local 10.42.0.221 port 5201 connected to 10.42.0.1 port 50842
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  23.1 MBytes   193 Mbits/sec
[  5]   1.00-2.00   sec  24.1 MBytes   202 Mbits/sec
[  5]   2.00-3.00   sec  24.4 MBytes   205 Mbits/sec
[  5]   3.00-4.00   sec  24.4 MBytes   205 Mbits/sec

On host (run 2 min, at 200Mb/sec Edison doesn't crash in other cases often does)

ferry@delfion:~$ iperf3 -c 10.42.0.221 -t 0
Connecting to host 10.42.0.221, port 5201
[  5] local 10.42.0.1 port 50842 connected to 10.42.0.221 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  26.7 MBytes   224 Mbits/sec    0   1.12 MBytes
[  5]   1.00-2.00   sec  23.8 MBytes   199 Mbits/sec   49   1.13 MBytes
[  5]   2.00-3.00   sec  23.8 MBytes   199 Mbits/sec    0   1.25 MBytes
[  5]   3.00-4.00   sec  25.0 MBytes   210 Mbits/sec    0   1.34 MBytes
[  5]   4.00-5.00   sec  23.8 MBytes   199 Mbits/sec    0   1.40 MBytes
[  5]   5.00-6.00   sec  25.0 MBytes   210 Mbits/sec   14   1.04 MBytes
...
[  5] 157.00-158.00 sec  0.00 Bytes  0.00 bits/sec    0   1.21 MBytes
[  5] 158.00-159.00 sec  0.00 Bytes  0.00 bits/sec    0   1.21 MBytes
^C[  5] 159.00-159.32 sec  0.00 Bytes  0.00 bits/sec    0   1.21 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-159.32 sec  3.41 GBytes   184 Mbits/sec  294             sender
[  5]   0.00-159.32 sec  0.00 Bytes  0.00 bits/sec                  receiver
iperf3: interrupt - the client has terminated

2) kill iperf3 on Edison, unplug USB 2, wait 5 sec, plug USB 2

root@yuna:~# connmanctl services
*AO Wired                gadget_aabbccddeef1_usb

(A = autoconnected, O connection pinged intel.com)

root@yuna:~# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.42.0.1, port 50914
[  5] local 10.42.0.221 port 5201 connected to 10.42.0.1 port 50916
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  4.62 MBytes  38.8 Mbits/sec
[  5]   1.00-2.00   sec  1017 KBytes  8.33 Mbits/sec
[  5]   2.00-3.00   sec   672 KBytes  5.50 Mbits/sec
[  5]   3.00-4.00   sec   342 KBytes  2.80 Mbits/sec
[  5]   4.00-5.00   sec   365 KBytes  2.99 Mbits/sec
[  5]   5.00-6.00   sec   380 KBytes  3.12 Mbits/sec
[  5]   6.00-7.00   sec   329 KBytes  2.70 Mbits/sec
[  5]   7.00-8.00   sec  90.5 KBytes   742 Kbits/sec
[  5]   8.00-9.00   sec  3.14 MBytes  26.3 Mbits/sec
[  5]   9.00-10.00  sec   126 KBytes  1.03 Mbits/sec
[  5]  10.00-11.00  sec   776 KBytes  6.36 Mbits/sec

On host

ferry@delfion:~$ iperf3 -c 10.42.0.221 -t 0
Connecting to host 10.42.0.221, port 5201
[  5] local 10.42.0.1 port 50916 connected to 10.42.0.221 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  6.18 MBytes  51.8 Mbits/sec    2    260 KBytes
[  5]   1.00-2.00   sec   827 KBytes  6.77 Mbits/sec    1    296 KBytes
[  5]   2.00-3.00   sec   827 KBytes  6.77 Mbits/sec    0    327 KBytes
[  5]   3.00-4.00   sec  0.00 Bytes  0.00 bits/sec    1    342 KBytes
[  5]   4.00-5.00   sec   891 KBytes  7.30 Mbits/sec    0    359 KBytes
[  5]   5.00-6.00   sec  0.00 Bytes  0.00 bits/sec    0    378 KBytes
[  5]   6.00-7.00   sec   891 KBytes  7.30 Mbits/sec    0    393 KBytes
[  5]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec    0    397 KBytes
[  5]   8.00-9.00   sec  4.41 MBytes  37.0 Mbits/sec    1    566 KBytes
[  5]   9.00-10.00  sec  0.00 Bytes  0.00 bits/sec    1    568 KBytes
...
[  5] 120.00-121.00 sec  0.00 Bytes  0.00 bits/sec    0   3.74 MBytes
[  5] 121.00-122.00 sec  0.00 Bytes  0.00 bits/sec    0   3.74 MBytes
[  5] 122.00-123.00 sec  0.00 Bytes  0.00 bits/sec    0   3.75 MBytes
[  5] 123.00-124.00 sec  0.00 Bytes  0.00 bits/sec    0   3.75 MBytes
[  5] 124.00-125.00 sec  1.25 MBytes  10.5 Mbits/sec    0   3.75 MBytes
^C[  5] 125.00-125.41 sec  0.00 Bytes  0.00 bits/sec    0   3.75 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-125.41 sec  53.9 MBytes  3.61 Mbits/sec  431             sender
[  5]   0.00-125.41 sec  0.00 Bytes  0.00 bits/sec                  receiver
iperf3: interrupt - the client has terminated

3) warm reboot Edison with USB 2 plugged: no change 4) warm reboot Edison with USB 2 unplugged: plug event seems not detected, other gadgets do not appear (sound, mass storage) But connman thinks gadget is there, powered, but not connected:

root@yuna:~# connmanctl technologies
...
/net/connman/technology/gadget
  Name = Gadget
  Type = gadget
  Powered = True
  Connected = False
  Tethering = False

And device is standbye (R) but not pinging intel.com.

root@yuna:~# connmanctl services
*AR Wired                gadget_aabbccddeef1_usb

Didn't receive correct config from dhcp (or not at all)

root@yuna:~# ifconfig
...

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 169.254.147.69  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::a8bb:ccff:fedd:eef1  prefixlen 64  scopeid 0x20<link>
        ether aa:bb:cc:dd:ee:f1  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

5) Cold reboot with USB 2 plugged: same as with cable unplugged. 6) Warm reboot with USB 2 plugged (network in good state): device is standbye (R) but not pinging intel.com.

7) Cold reboot, then Warm reboot with USB 2 unplugged, connected but bad:

ferry@delfion:~$ iperf3 -c 10.42.0.221 -t 0
Connecting to host 10.42.0.221, port 5201
[  5] local 10.42.0.1 port 51216 connected to 10.42.0.221 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  6.97 MBytes  58.4 Mbits/sec    2    303 KBytes
[  5]   1.00-2.00   sec  1.43 MBytes  12.0 Mbits/sec    1    361 KBytes
[  5]   2.00-3.00   sec  1.93 MBytes  16.2 Mbits/sec    0    419 KBytes
[  5]   3.00-4.00   sec  4.67 MBytes  39.2 Mbits/sec    0    605 KBytes
[  5]   4.00-5.00   sec  2.50 MBytes  21.0 Mbits/sec    1    707 KBytes
[  5]   5.00-6.00   sec  0.00 Bytes  0.00 bits/sec    0    731 KBytes

8) Cold reboot with USB 2 plugged:

root@yuna:~# connmanctl disable gadget

unplug USB 2, wait 5 sec, plug USB 2:

root@yuna:~# connmanctl enable gadget
ferry@delfion:~$ iperf3 -c 10.42.0.221 -t 0
Connecting to host 10.42.0.221, port 5201
[  5] local 10.42.0.1 port 40422 connected to 10.42.0.221 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  25.6 MBytes   215 Mbits/sec    0   1.10 MBytes       
[  5]   1.00-2.00   sec  25.0 MBytes   210 Mbits/sec   89   1.16 MBytes       
[  5]   2.00-3.00   sec  23.8 MBytes   199 Mbits/sec    0   1.28 MBytes       
[  5]   3.00-4.00   sec  23.8 MBytes   199 Mbits/sec    0   1.38 MBytes       
[  5]   4.00-5.00   sec  25.0 MBytes   210 Mbits/sec   11   1.02 MBytes       
[  5]   5.00-6.00   sec  25.0 MBytes   210 Mbits/sec    0   1.09 MBytes       
[  5]   6.00-7.00   sec  23.8 MBytes   199 Mbits/sec    0   1.14 MBytes       
^C[  5]   7.00-7.39   sec  10.0 MBytes   214 Mbits/sec    0   1.16 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-7.39   sec   182 MBytes   206 Mbits/sec  100             sender
[  5]   0.00-7.39   sec  0.00 Bytes  0.00 bits/sec                  receiver
iperf3: interrupt - the client has terminated

Conclusion

htot commented 3 years ago

I'm dropping trace and regdump after a cold and a warm boot captured according to instructions here: https://www.kernel.org/doc/html/latest/driver-api/usb/dwc3.html#reporting-bugs

boot.zip

htot commented 3 years ago

While the above traces in boot.zip allow compare which regs not correctly initialized on warm boot, I have also captured traces of unplug/plug. Here kernel is 5.10.27 (LTS), edison cold booted with USB cable plugged. Loggin via console, verified connection inet 10.42.0.221 netmask 255.255.255.0

root@yuna:~# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536  metric 1
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 44  bytes 3412 (3.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 3412 (3.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 10.42.0.221  netmask 255.255.255.0  broadcast 10.42.0.255
        inet6 fe80::a8bb:ccff:fedd:eef1  prefixlen 64  scopeid 0x20<link>
        ether aa:bb:cc:dd:ee:f1  txqueuelen 1000  (Ethernet)
        RX packets 61  bytes 8416 (8.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 54  bytes 7779 (7.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500  metric 1
        ether 78:4b:87:ad:4d:70  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Then trace unplug. Then trace plug.

plug-unplug.zip

htot commented 3 years ago

Now, with host updated to ubuntu kernel ppa 5.12.0-051200rc5-generic and edison to 5.12.0-rc5-edison-acpi-standard vanilla + 2 patches appearing in rc6:

htot commented 3 years ago

I added another 3:

The latter seems to solve the throttling, while the first 2 help to make switching from host -> device mode work (better).

htot commented 3 years ago

I retested usb-next (based 5.12-rc7) + "[PATCH v3] usb: dwc3: core: Do core softreset when switch mode". No throttling, but

htot commented 3 years ago

regdump in zip files empty, resend.. regdump.txt

htot commented 3 years ago

After flipping the first time the trace is empty see first-switch.zip

I found the gadget configuration script was not called, which normally gets called due to a udev rule:

ACTION=="add", KERNEL=="dwc3.0.auto", SUBSYSTEMS=="udc", ATTRS{state}=="not attached", RUN+="/usr/bin/conf-gadget.sh"

So I retried and see with udevadm monitor

flipping the switch from host->gadget

KERNEL[51.824914] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/enp0s17u1u1/queues/rx-0 (queues)
KERNEL[51.825682] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/enp0s17u1u1/queues/tx-0 (queues)
KERNEL[51.826226] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/enp0s17u1u1 (net)
KERNEL[51.836041] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:003/usb-001:003:01 (mdio_bus)
KERNEL[51.836709] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:003/usb-001:003:01 (mdio_bus)
KERNEL[51.837342] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:003 (mdio_bus)
KERNEL[51.837763] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0 (usb)
KERNEL[51.838116] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0 (usb)
KERNEL[51.873712] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1 (usb)
KERNEL[51.874000] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1 (usb)
KERNEL[51.874207] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1:1.0 (usb)
KERNEL[51.874431] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1:1.0 (usb)
KERNEL[51.897175] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1 (usb)
KERNEL[51.897486] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1 (usb)

stopped capture tracepoints here, then switch back to host

KERNEL[253.214406] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1 (usb)
KERNEL[253.263305] change   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1 (usb)
KERNEL[253.263687] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1:1.0 (usb)
KERNEL[253.328354] bind     /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1:1.0 (usb)
KERNEL[253.328734] bind     /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1 (usb)
KERNEL[253.699341] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1 (usb)
KERNEL[253.744911] change   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1 (usb)
KERNEL[253.745804] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0 (usb)
KERNEL[253.805307] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:005 (mdio_bus)
KERNEL[253.812978] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:005/usb-001:005:01 (mdio_bus)
KERNEL[253.814318] bind     /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:005/usb-001:005:01 (mdio_bus)
KERNEL[253.815386] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0 (net)
KERNEL[253.815552] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0/queues/rx-0 (queues)
KERNEL[253.815778] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0/queues/tx-0 (queues)
KERNEL[253.825279] bind     /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0 (usb)
KERNEL[253.825667] bind     /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1 (usb)

switch to gadget again

KERNEL[314.212144] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0/queues/rx-0 (queues)
KERNEL[314.212473] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0/queues/tx-0 (queues)
KERNEL[314.214691] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0 (net)

extcon event didn't show the first time

KERNEL[314.238385] change   /devices/pci0000:00/0000:00:13.0/INTC100E:00/mrfld_bcove_pwrsrc/extcon/extcon0 (extcon)
KERNEL[314.238677] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:005/usb-001:005:01 (mdio_bus)
KERNEL[314.238863] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:005/usb-001:005:01 (mdio_bus)
KERNEL[314.239015] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/mdio_bus/usb-001:005 (mdio_bus)
KERNEL[314.239205] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0 (usb)
KERNEL[314.239429] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1/1-1.1:1.0 (usb)
KERNEL[314.239666] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb2/2-0:1.0 (usb)
KERNEL[314.239933] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb2/2-0:1.0 (usb)
KERNEL[314.262713] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb2 (usb)
KERNEL[314.263030] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1 (usb)
KERNEL[314.263298] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb2 (usb)
KERNEL[314.263569] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1.1 (usb)
KERNEL[314.263815] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1:1.0 (usb)
KERNEL[314.264042] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1/1-1:1.0 (usb)
KERNEL[314.264753] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usbmon/usbmon2 (usbmon)
KERNEL[314.265019] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1 (usb)
KERNEL[314.265289] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-1 (usb)
KERNEL[314.288792] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-0:1.0 (usb)
KERNEL[314.289057] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1/1-0:1.0 (usb)
KERNEL[314.289327] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1 (usb)
KERNEL[314.289661] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usb1 (usb)
KERNEL[314.647375] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto/usbmon/usbmon1 (usbmon)
KERNEL[314.647816] unbind   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto (platform)
KERNEL[314.648143] remove   /kernel/software_nodes/node1 (software_nodes)
KERNEL[314.648672] remove   /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/xhci-hcd.2.auto (platform)

here is the event we were waiting for

KERNEL[314.649158] add      /devices/pci0000:00/0000:00:11.0/dwc3.0.auto/udc/dwc3.0.auto (udc)

after this gadget devices appear normally

htot commented 3 years ago

Also after some time (a few minutes) the connection drop but automatically reconnects. The following trace shows that near the end. lost-connection.zip

htot commented 3 years ago

In total there have appeared to be 5 separate issues, summury here:

Throttling

https://lore.kernel.org/linux-usb Caused by LPM

Failed plug

https://lore.kernel.org/linux-usb

USB port resets

Initially switch needs flipping 2x to go to device mode

andy-shev commented 3 years ago

So, as far as I understand we need only two patches now to fix all 5 issues, i.e. extcon + snps,usb2-gadget-lpm-disable. Correct?

htot commented 3 years ago

Yes. Thanks for reviewing, sent to ml.