-
Notifications
You must be signed in to change notification settings - Fork 8k
drivers: udc: stm32: cleanup how PHY type and speed are determined #96028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: udc: stm32: cleanup how PHY type and speed are determined #96028
Conversation
b78b0c4
to
e04d03d
Compare
Tested OK:
testusb resultsFor all result logs: testusb output
- dmesg output
+ Zephyr console output
./testusb: /dev/bus/usb/003/054 may see only control tests
full speed /dev/bus/usb/003/054 0
-[108265.467441] usbtest 3-5.1:1.0: TEST 0: NOP
/dev/bus/usb/003/054 test 0, 0.000005 secs
-[108265.468344] usbtest 3-5.1:1.0: TEST 1: write 1024 bytes 1000 times
/dev/bus/usb/003/054 test 1, 1.700393 secs
-[108267.169703] usbtest 3-5.1:1.0: TEST 2: read 1024 bytes 1000 times
/dev/bus/usb/003/054 test 2, 1.340087 secs
-[108268.510793] usbtest 3-5.1:1.0: TEST 3: write/512 0..1024 bytes 1000 times
/dev/bus/usb/003/054 test 3, 0.857838 secs
-[108269.369833] usbtest 3-5.1:1.0: TEST 4: read/512 0..1024 bytes 1000 times
/dev/bus/usb/003/054 test 4, 0.718781 secs
-[108270.089760] usbtest 3-5.1:1.0: TEST 5: write 1000 sglists 32 entries of 1024 bytes
/dev/bus/usb/003/054 test 5, 49.432600 secs
-[108319.523645] usbtest 3-5.1:1.0: TEST 6: read 1000 sglists 32 entries of 1024 bytes
/dev/bus/usb/003/054 test 6, 41.355880 secs
-[108360.880772] usbtest 3-5.1:1.0: TEST 7: write/512 1000 sglists 32 entries 0..1024 bytes
/dev/bus/usb/003/054 test 7, 25.589572 secs
-[108386.471525] usbtest 3-5.1:1.0: TEST 8: read/512 1000 sglists 32 entries 0..1024 bytes
/dev/bus/usb/003/054 test 8, 21.426146 secs
-[108407.898842] usbtest 3-5.1:1.0: TEST 9: ch9 (subset) control tests, 1000 times
/dev/bus/usb/003/054 test 9, 1.944577 secs
-[108409.844422] usbtest 3-5.1:1.0: TEST 10: queue 32 control calls, 1000 times
/dev/bus/usb/003/054 test 10, 6.821551 secs
-[108416.667107] usbtest 3-5.1:1.0: TEST 11: unlink 1000 reads of 1024
-[108416.678789] usbtest 3-5.1:1.0: unlink retry <---- this is repeated many times
/dev/bus/usb/003/054 test 11, 8.108794 secs
-[108424.777158] usbtest 3-5.1:1.0: TEST 12: unlink 1000 writes of 1024
-[108424.900437] usbtest 3-5.1:1.0: unlink retry <---- this is repeated many times
/dev/bus/usb/003/054 test 12, 7.672840 secs
-[108432.451190] usbtest 3-5.1:1.0: TEST 13: set/clear 1000 halts
-[108442.703917] usb 3-5.1: verify_not_halted failed, iterations left 0, status -110 (not 0)
-[108442.703962] usbtest 3-5.1:1.0: halts failed, iterations left 999
/dev/bus/usb/003/054 test 13 --> 22 (error 22)
-[108442.705366] usbtest 3-5.1:1.0: TEST 14: 1000 ep0out, 1..1024 vary 512
+[00:01:10.082,000] <err> udc_stm32: UDC Message queue overrun
+[00:01:10.088,000] <err> udc_stm32: UDC Message queue overrun
+[00:01:10.094,000] <err> udc_stm32: UDC Message queue overrun
+[00:01:10.101,000] <err> udc_stm32: UDC Message queue overrun
+0[00:01:10.107,000] <err> udc_stm32: UDC Message queue overrun
+[00:01:10.114,000] <err> udc_stm32: UDC Message queue overrun
+[00:01:10.120,000] <err> udc_stm32: UDC Message queue overrun
+74,000] <err> udc_stm32: ep 0x00 queue is empty
+[00:01:10.132,000] <err> udc_stm32: ep 0x00 queue is empty
+[00:01:10.138,000] <err> udc_stm32: ep 0x00 queue is empty
+[00:01:10.144,000] <err> udc_stm32: ep 0x00 queue is empty
+[00:01:10.150,000] <err> udc_stm32: ep 0x00 queue is empty
+[00:01:10.156,000] <err> udc_stm32: ep 0x00 queue is empty
+[00:01:10.163,000] <err> udc_stm32: ep 0x00 queue is empty
+[00:01:10.169,000] <err> udc_stm32: ep 0x00 queue is empty
+[00:01:10.175,000] <err> udc_stm32: ep 0x00 queue is empty
-[108447.824158] usbtest 3-5.1:1.0: ctrl_out read failed, code -110, count 0
/dev/bus/usb/003/054 test 14 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 15 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 16 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 17 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 18 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 19 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 20 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 21 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 22 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 23 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 24 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 25 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/054 test 26 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: TEST 27: bulk write 31Mbytes
+[00:xx:00.xxx,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:xx:00.xxx,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:xx:00.xxx,000] <err> usbd_ch9: Malformed setup packet
+[00:xx:00.xxx,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:xx:00.xxx,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:xx:00.xxx,000] <err> usbd_ch9: Malformed setup packet
+[00:xx:00.xxx,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:xx:00.xxx,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:xx:00.xxx,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/054 test 27, 48.889804 secs
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: TEST 28: bulk read 31Mbytes
+[00:xx:00.xxx,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:xx:00.xxx,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:xx:00.xxx,000] <err> usbd_ch9: Malformed setup packet
+[00:xx:00.xxx,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:xx:00.xxx,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:xx:00.xxx,000] <err> usbd_ch9: Malformed setup packet
+[00:xx:00.xxx,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:xx:00.xxx,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:xx:00.xxx,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/054 test 28, 41.245456 secs
-[109298.271437] usbtest 3-5.1:1.0: TEST 29: Clear toggle between bulk writes 1000 times
+[00:05:36.938,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:36.945,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:36.952,000] <err> usbd_ch9: Malformed setup packet
+[00:05:36.958,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:36.965,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:36.972,000] <err> usbd_ch9: Malformed setup packet
+[00:05:36.978,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:36.985,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:36.992,000] <err> usbd_ch9: Malformed setup packet
+[00:05:36.999,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:37.005,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:37.012,000] <err> usbd_ch9: Malformed setup packet
-[109298.291624] usbtest 3-5.1:1.0: ep 01 couldn't clear halt, -32
-[109298.291632] usbtest 3-5.1:1.0: toggle sync failed, iterations left 999
/dev/bus/usb/003/054 test 29 --> 32 (error 32)
./testusb: /dev/bus/usb/003/047 may see only control tests
full speed /dev/bus/usb/003/047 0
-[105937.077947] usbtest 3-5.1:1.0: TEST 0: NOP
/dev/bus/usb/003/047 test 0, 0.000003 secs
-[105937.078798] usbtest 3-5.1:1.0: TEST 1: write 1024 bytes 1000 times
/dev/bus/usb/003/047 test 1, 1.634248 secs
-[105938.714010] usbtest 3-5.1:1.0: TEST 2: read 1024 bytes 1000 times
/dev/bus/usb/003/047 test 2, 1.290493 secs
-[105940.005559] usbtest 3-5.1:1.0: TEST 3: write/512 0..1024 bytes 1000 times
/dev/bus/usb/003/047 test 3, 0.860289 secs
-[105940.866775] usbtest 3-5.1:1.0: TEST 4: read/512 0..1024 bytes 1000 times
/dev/bus/usb/003/047 test 4, 0.728755 secs
-[105941.596536] usbtest 3-5.1:1.0: TEST 5: write 1000 sglists 32 entries of 1024 bytes
/dev/bus/usb/003/047 test 5, 48.984239 secs
-[105990.581984] usbtest 3-5.1:1.0: TEST 6: read 1000 sglists 32 entries of 1024 bytes
/dev/bus/usb/003/047 test 6, 39.052892 secs
-[106029.636363] usbtest 3-5.1:1.0: TEST 7: write/512 1000 sglists 32 entries 0..1024 bytes
/dev/bus/usb/003/047 test 7, 25.327574 secs
-[106054.965050] usbtest 3-5.1:1.0: TEST 8: read/512 1000 sglists 32 entries 0..1024 bytes
/dev/bus/usb/003/047 test 8, 20.268981 secs
-[106075.234990] usbtest 3-5.1:1.0: TEST 9: ch9 (subset) control tests, 1000 times
/dev/bus/usb/003/047 test 9, 1.757893 secs
-[106076.993789] usbtest 3-5.1:1.0: TEST 10: queue 32 control calls, 1000 times
/dev/bus/usb/003/047 test 10, 6.681589 secs
-[106083.676377] usbtest 3-5.1:1.0: TEST 11: unlink 1000 reads of 1024
-[106084.754246] usbtest 3-5.1:1.0: unlink retry
/dev/bus/usb/003/047 test 11, 8.051909 secs
-[106091.729301] usbtest 3-5.1:1.0: TEST 12: unlink 1000 writes of 1024
-[106095.770477] usbtest 3-5.1:1.0: unlink retry <---- repeated many times
/dev/bus/usb/003/047 test 12, 8.043141 secs
- [106099.773512] usbtest 3-5.1:1.0: TEST 13: set/clear 1000 halts
/dev/bus/usb/003/047 test 13, 7.129598 secs
-[106106.904154] usbtest 3-5.1:1.0: TEST 14: 1000 ep0out, 1..1024 vary 512
-[106112.068645] usbtest 3-5.1:1.0: ctrl_out write failed, code -110, count 0
/dev/bus/usb/003/047 test 14 --> 110 (error 110)
-[106117.189157] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 15 --> 110 (error 110)
[106122.309363] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 16 --> 110 (error 110)
-[106127.429512] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 17 --> 110 (error 110)
-[106132.549499] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 18 --> 110 (error 110)
-[106137.669388] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 19 --> 110 (error 110)
-[106142.789532] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 20 --> 110 (error 110)
-[106147.909469] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 21 --> 110 (error 110)
-[106153.029323] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 22 --> 110 (error 110)
-[106158.149583] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 23 --> 110 (error 110)
-[106163.269702] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 24 --> 110 (error 110)
-[106168.389896] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 25 --> 110 (error 110)
-[106173.509669] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/047 test 26 --> 110 (error 110)
-[106173.570950] usbtest 3-5.1:1.0: TEST 27: bulk write 31Mbytes
+[00:04:06.658,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:06.665,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:06.672,000] <err> usbd_ch9: Malformed setup packet
+[00:04:06.678,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:06.685,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:06.692,000] <err> usbd_ch9: Malformed setup packet
+[00:04:06.698,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:06.705,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:06.712,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/047 test 27, 48.541857 secs
-[106222.174459] usbtest 3-5.1:1.0: TEST 28: bulk read 31Mbytes
+[00:04:55.234,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:55.241,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:55.248,000] <err> usbd_ch9: Malformed setup packet
+[00:04:55.254,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:55.261,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:55.268,000] <err> usbd_ch9: Malformed setup packet
+[00:04:55.274,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:55.281,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:55.288,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/047 test 28, 38.903385 secs
-[106261.139330] usbtest 3-5.1:1.0: TEST 29: Clear toggle between bulk writes 1000 times
+[00:05:34.177,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:34.184,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:34.191,000] <err> usbd_ch9: Malformed setup packet
+[00:05:34.197,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:34.204,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:34.211,000] <err> usbd_ch9: Malformed setup packet
+[00:05:34.217,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:34.224,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:34.231,000] <err> usbd_ch9: Malformed setup packet
+[00:05:34.238,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:34.244,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:34.251,000] <err> usbd_ch9: Malformed setup packet
-[106261.159504] usbtest 3-5.1:1.0: ep 01 couldn't clear halt, -32
-[106261.159525] usbtest 3-5.1:1.0: toggle sync failed, iterations left 999
/dev/bus/usb/003/047 test 29 --> 32 (error 32)
./testusb: /dev/bus/usb/003/049 may see only control tests
high speed /dev/bus/usb/003/049 0
-[106557.036683] usbtest 3-5.1:1.0: TEST 0: NOP
/dev/bus/usb/003/049 test 0, 0.000004 secs
-[106557.037422] usbtest 3-5.1:1.0: TEST 1: write 1024 bytes 1000 times
/dev/bus/usb/003/049 test 1, 0.238185 secs
-[106557.276530] usbtest 3-5.1:1.0: TEST 2: read 1024 bytes 1000 times
/dev/bus/usb/003/049 test 2, 0.132896 secs
-[106557.410360] usbtest 3-5.1:1.0: TEST 3: write/512 0..1024 bytes 1000 times
/dev/bus/usb/003/049 test 3, 0.125034 secs
-[106557.536218] usbtest 3-5.1:1.0: TEST 4: read/512 0..1024 bytes 1000 times
/dev/bus/usb/003/049 test 4, 0.068923 secs
-[106557.605983] usbtest 3-5.1:1.0: TEST 5: write 1000 sglists 32 entries of 1024 bytes
/dev/bus/usb/003/049 test 5, 6.256995 secs
-[106563.863993] usbtest 3-5.1:1.0: TEST 6: read 1000 sglists 32 entries of 1024 bytes
/dev/bus/usb/003/049 test 6, 4.687823 secs
-[106568.552696] usbtest 3-5.1:1.0: TEST 7: write/512 1000 sglists 32 entries 0..1024 bytes
/dev/bus/usb/003/049 test 7, 3.287116 secs
-[106571.840769] usbtest 3-5.1:1.0: TEST 8: read/512 1000 sglists 32 entries 0..1024 bytes
/dev/bus/usb/003/049 test 8, 2.571896 secs
-[106574.413692] usbtest 3-5.1:1.0: TEST 9: ch9 (subset) control tests, 1000 times
/dev/bus/usb/003/049 test 9, 0.845690 secs
-[106575.260287] usbtest 3-5.1:1.0: TEST 10: queue 32 control calls, 1000 times
/dev/bus/usb/003/049 test 10, 4.030215 secs
-[106579.291483] usbtest 3-5.1:1.0: TEST 11: unlink 1000 reads of 1024
-[106579.538683] usbtest 3-5.1:1.0: unlink retry <---- this is repeated many times
/dev/bus/usb/003/049 test 11, 4.139378 secs
-[106583.431782] usbtest 3-5.1:1.0: TEST 12: unlink 1000 writes of 1024
-[106584.540797] usbtest 3-5.1:1.0: unlink retry
-[106584.710800] usbtest 3-5.1:1.0: unlink retry
-[106584.862800] usbtest 3-5.1:1.0: unlink retry
-[106585.002797] usbtest 3-5.1:1.0: unlink retry
-[106585.066797] usbtest 3-5.1:1.0: unlink retry
-[106585.146800] usbtest 3-5.1:1.0: unlink retry
-[106585.210797] usbtest 3-5.1:1.0: unlink retry
-[106585.310797] usbtest 3-5.1:1.0: unlink retry
-[106585.426797] usbtest 3-5.1:1.0: unlink retry
-[106586.090800] usbtest 3-5.1:1.0: unlink retry
-[106586.098736] usbtest 3-5.1:1.0: unlink retry
-[106586.630826] usbtest 3-5.1:1.0: unlink retry
-[106587.226807] usbtest 3-5.1:1.0: unlink retry
-[106587.392827] usbtest 3-5.1:1.0: unlink retry
/dev/bus/usb/003/049 test 12, 4.043143 secs
-[106587.475927] usbtest 3-5.1:1.0: TEST 13: set/clear 1000 halts
-[106597.957008] usb 3-5.1: verify_not_halted failed, iterations left 0, status -110 (not 0)
-[106597.957017] usbtest 3-5.1:1.0: halts failed, iterations left 998
/dev/bus/usb/003/049 test 13 --> 22 (error 22)
-[106597.957911] usbtest 3-5.1:1.0: TEST 14: 1000 ep0out, 1..1024 vary 512
-[106603.077090] usbtest 3-5.1:1.0: ctrl_out write failed, code -110, count 0
/dev/bus/usb/003/049 test 14 --> 110 (error 110)
-[106608.197783] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 15 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 16 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 17 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 18 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 19 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 20 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 21 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 22 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 23 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 24 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 25 --> 110 (error 110)
-[xxxxxx.xxxxxx] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/049 test 26 --> 110 (error 110)
-[106664.578903] usbtest 3-5.1:1.0: TEST 27: bulk write 31Mbytes
+[00:02:00.808,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:00.815,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:00.822,000] <err> usbd_ch9: Malformed setup packet
+[00:02:00.828,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:00.835,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:00.842,000] <err> usbd_ch9: Malformed setup packet
+[00:02:00.848,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:00.855,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:00.862,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/049 test 27, 6.083958 secs
-[106670.724010] usbtest 3-5.1:1.0: TEST 28: bulk read 31Mbytes
+[00:02:06.953,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:06.960,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:06.967,000] <err> usbd_ch9: Malformed setup packet
+[00:02:06.973,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:06.980,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:06.987,000] <err> usbd_ch9: Malformed setup packet
+[00:02:06.993,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:07.000,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:07.007,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/049 test 28, 4.313595 secs
-[106675.098714] usbtest 3-5.1:1.0: TEST 29: Clear toggle between bulk writes 1000 times
-[106675.118806] usbtest 3-5.1:1.0: ep 01 couldn't clear halt, -32
-[106675.118815] usbtest 3-5.1:1.0: toggle sync failed, iterations left 999
+[00:02:11.328,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:11.334,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:11.342,000] <err> usbd_ch9: Malformed setup packet
+[00:02:11.348,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:11.355,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:11.362,000] <err> usbd_ch9: Malformed setup packet
+[00:02:11.368,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:11.375,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:11.382,000] <err> usbd_ch9: Malformed setup packet
+[00:02:11.388,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:02:11.395,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:02:11.402,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/049 test 29 --> 32 (error 32)
full speed /dev/bus/usb/003/050 0
-[107121.478380] usbtest 3-5.1:1.0: TEST 0: NOP
/dev/bus/usb/003/050 test 0, 0.000004 secs
-[107121.479227] usbtest 3-5.1:1.0: TEST 1: write 1024 bytes 1000 times
/dev/bus/usb/003/050 test 1, 1.628300 secs
-[107123.108468] usbtest 3-5.1:1.0: TEST 2: read 1024 bytes 1000 times
/dev/bus/usb/003/050 test 2, 1.299370 secs
-[107124.408859] usbtest 3-5.1:1.0: TEST 3: write/512 0..1024 bytes 1000 times
/dev/bus/usb/003/050 test 3, 0.848321 secs
-[107125.258233] usbtest 3-5.1:1.0: TEST 4: read/512 0..1024 bytes 1000 times
/dev/bus/usb/003/050 test 4, 0.742226 secs
-[107126.001494] usbtest 3-5.1:1.0: TEST 5: write 1000 sglists 32 entries of 1024 bytes
/dev/bus/usb/003/050 test 5, 48.762896 secs
-[107174.766059] usbtest 3-5.1:1.0: TEST 6: read 1000 sglists 32 entries of 1024 bytes
/dev/bus/usb/003/050 test 6, 38.868245 secs
-[107213.635512] usbtest 3-5.1:1.0: TEST 7: write/512 1000 sglists 32 entries 0..1024 bytes
/dev/bus/usb/003/050 test 7, 25.298610 secs
-[107238.935127] usbtest 3-5.1:1.0: TEST 8: read/512 1000 sglists 32 entries 0..1024 bytes
/dev/bus/usb/003/050 test 8, 20.182209 secs
-[107259.118604] usbtest 3-5.1:1.0: TEST 9: ch9 (subset) control tests, 1000 times
/dev/bus/usb/003/050 test 9, 1.643715 secs
-[107260.763254] usbtest 3-5.1:1.0: TEST 10: queue 32 control calls, 1000 times
/dev/bus/usb/003/050 test 10, 6.108007 secs
-[107266.872201] usbtest 3-5.1:1.0: TEST 11: unlink 1000 reads of 1024
/dev/bus/usb/003/050 test 11, 7.999943 secs
-[107274.873131] usbtest 3-5.1:1.0: TEST 12: unlink 1000 writes of 1024
-[107278.026179] usbtest 3-5.1:1.0: unlink retry <---- this is repeated many times
/dev/bus/usb/003/050 test 12, 7.925118 secs
-[107282.799448] usbtest 3-5.1:1.0: TEST 13: set/clear 1000 halts
/dev/bus/usb/003/050 test 13, 7.011495 secs
-[107289.811968] usbtest 3-5.1:1.0: TEST 14: 1000 ep0out, 1..1024 vary 512
-[107295.306505] usbtest 3-5.1:1.0: ctrl_out write failed, code -110, count 0
/dev/bus/usb/003/050 test 14 --> 110 (error 110)
-[107300.427210] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 15 --> 110 (error 110)
-[107305.547325] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 16 --> 110 (error 110)
-[107310.668246] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 17 --> 110 (error 110)
-[107315.787120] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 18 --> 110 (error 110)
-[107320.907481] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 19 --> 110 (error 110)
-[107326.027210] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 20 --> 110 (error 110)
-[107331.147132] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 21 --> 110 (error 110)
-[107336.267537] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 22 --> 110 (error 110)
-[107341.387322] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 23 --> 110 (error 110)
-[107346.507400] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 24 --> 110 (error 110)
-[107351.627589] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 25 --> 110 (error 110)
-[107356.748704] usbtest 3-5.1:1.0: set altsetting to 0 failed, -110
/dev/bus/usb/003/050 test 26 --> 110 (error 110)
-[107356.809756] usbtest 3-5.1:1.0: TEST 27: bulk write 31Mbytes
+[00:04:11.467,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:11.474,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:11.481,000] <err> usbd_ch9: Malformed setup packet
+[00:04:11.487,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:11.494,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:11.501,000] <err> usbd_ch9: Malformed setup packet
+[00:04:11.507,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:11.514,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:11.521,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/050 test 27, 48.364380 secs
-[107405.235710] usbtest 3-5.1:1.0: TEST 28: bulk read 31Mbytes
+[00:04:59.892,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:59.899,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:59.906,000] <err> usbd_ch9: Malformed setup packet
+[00:04:59.912,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:59.919,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:59.926,000] <err> usbd_ch9: Malformed setup packet
+[00:04:59.933,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:04:59.939,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:04:59.946,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/050 test 28, 38.719017 secs
-[107444.016135] usbtest 3-5.1:1.0: TEST 29: Clear toggle between bulk writes 1000 times
-[107444.036286] usbtest 3-5.1:1.0: ep 01 couldn't clear halt, -32
-[107444.036296] usbtest 3-5.1:1.0: toggle sync failed, iterations left 999
+[00:05:38.672,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:38.679,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:38.686,000] <err> usbd_ch9: Malformed setup packet
+[00:05:38.693,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:38.699,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:38.706,000] <err> usbd_ch9: Malformed setup packet
+[00:05:38.713,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:38.720,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:38.727,000] <err> usbd_ch9: Malformed setup packet
+[00:05:38.733,000] <err> udc: Failed to allocate net_buf 0, ep 0x80
+[00:05:38.740,000] <err> usbd_ch9: Buffer for data|status is missing
+[00:05:38.747,000] <err> usbd_ch9: Malformed setup packet
/dev/bus/usb/003/050 test 29 --> 32 (error 32) NOTE: to get diff --git a/drivers/usb/udc/udc_stm32.c b/drivers/usb/udc/udc_stm32.c
index 9840ac28406..f8ca49bb56f 100644
--- a/drivers/usb/udc/udc_stm32.c
+++ b/drivers/usb/udc/udc_stm32.c
@@ -1065,15 +1065,15 @@ static const struct udc_api udc_stm32_api = {
#if defined(USB) || defined(USB_DRD_FS)
#define EP0_MPS 64U
-#define EP_MPS 64U
+#define EP_MPS 512U
#define USB_BTABLE_SIZE (8 * USB_NUM_BIDIR_ENDPOINTS)
#define USB_RAM_SIZE DT_INST_PROP(0, ram_size)
#else /* USB_OTG_FS */
#define EP0_MPS USB_OTG_MAX_EP0_SIZE
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs)
-#define EP_MPS USB_OTG_HS_MAX_PACKET_SIZE
+#define EP_MPS 512 /* USB_OTG_HS_MAX_PACKET_SIZE */
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otgfs) || DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usb)
-#define EP_MPS USB_OTG_FS_MAX_PACKET_SIZE
+#define EP_MPS 512 /* USB_OTG_FS_MAX_PACKET_SIZE */
#endif
#define USB_RAM_SIZE DT_INST_PROP(0, ram_size)
#define USB_BTABLE_SIZE 0 |
cc @bearsh |
e04d03d
to
684e722
Compare
drivers/usb/device/usb_dc_stm32.c
Outdated
* For HS-capable instances, this may be one of: | ||
* - PCD_SPEED_HIGH: High-Speed mode | ||
* - PCD_SPEED_HIGH_IN_FULL: Full-Speed mode on HS instance | ||
* | ||
* PCD_SPEED_FULL is returned for instances that are not HS-capable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, the HAL never specifies if PCD_SPEED_HIGH_IN_FULL
corresponds to "OTG_HS
in FS Mode" or "OTG_HS
connected to HS PHY in FS Mode".
In practice, the HAL doesn't care about this value if embedded FS PHY is selected; PCD_SPEED_HIGH_IN_FULL
is fine even if the HAL really expected PCD_SPEED_FULL
(as a matter of fact, the only thing we need to get right is PCD_SPEED_HIGH
- any other value will select FS mode...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified by running testusb
on Nucleo-F207ZG (OTG_HS, embedded FS PHY)
I hope I'll be able to test it later this week on my U5 based hardware... |
684e722
to
1a14623
Compare
Rebased after merge of #95857 |
Architecture WG, 2025-09-25:
|
1a14623
to
bfa0aef
Compare
v2: should address all comments from @jfischer-no + things discussed in ArchWG. |
FTR this has been tested to build, run and pass MSC tests on:
+ indicates tests did not fully complete due to an error This has also been tested to build, run and (partially) pass the stm32h747i_disco
stm32n6570_dk
nucleo_u5a5zj_q
b_u5858i_iot02a./testusb: /dev/bus/usb/003/025 may see only control tests
full speed /dev/bus/usb/003/025 0
running all tests except:
24
/dev/bus/usb/003/025 test 0, 0.000006 secs
/dev/bus/usb/003/025 test 1, 1.674028 secs
/dev/bus/usb/003/025 test 2, 1.393876 secs
/dev/bus/usb/003/025 test 3, 0.893320 secs
/dev/bus/usb/003/025 test 4, 0.773165 secs
/dev/bus/usb/003/025 test 5, 48.628452 secs
/dev/bus/usb/003/025 test 6, 38.770267 secs
/dev/bus/usb/003/025 test 7, 24.762007 secs
/dev/bus/usb/003/025 test 8, 20.048083 secs
/dev/bus/usb/003/025 test 9, 1.881399 secs
/dev/bus/usb/003/025 test 10, 6.359480 secs
/dev/bus/usb/003/025 test 11, 8.557596 secs
/dev/bus/usb/003/025 test 12, 8.380726 secs
/dev/bus/usb/003/025 test 13, 6.976686 secs
/dev/bus/usb/003/025 test 14, 1.245724 secs
/dev/bus/usb/003/025 test 17, 1.570320 secs
/dev/bus/usb/003/025 test 18, 1.315128 secs
/dev/bus/usb/003/025 test 19, 1.594762 secs
/dev/bus/usb/003/025 test 20, 1.304126 secs
/dev/bus/usb/003/025 test 21, 1.321407 secs
/dev/bus/usb/003/025 test 27, 48.134062 secs
/dev/bus/usb/003/025 test 28, 38.436136 secs
/dev/bus/usb/003/025 test 29, 0.755952 secs
nucleo_l552ze_q
Note that test 24 Also note that the hack mentioned previously (increase max EP size by modifying driver) was applied here as well. |
…UPPORT The driver supports high-speed capable controllers. Select the appropriate Kconfig options to ensure that the stack does not optimize away high-speed support. Signed-off-by: Martin Gysel <me@bearsh.org>
bfa0aef
to
9eb058a
Compare
@jfischer-no PTAL whenever possible 🙂 |
} | ||
#elif defined(CONFIG_SOC_SERIES_STM32U5X) | ||
/* Sequence to enable the power of the OTG HS on a stm32U5 serie : Enable VDDUSB */ | ||
__ASSERT_NO_MSG(LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_PWR)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not look correct. LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_PWR));
has no effect when asserts are disabled, is that intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a functional change from existing code but in practice, the existing code is useless as the PWR clock is enabled unconditionally by SoC layer:
zephyr/soc/st/stm32/stm32u5x/soc.c
Lines 38 to 39 in 4a69c1b
/* Enable PWR */ | |
LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_PWR); |
I just kept the assert to help debugging in case for some reason the clock is disabled in another place, but from testing the old !pwr_clk
code path was never reached. I'm fine with keeping the old code but (imo) it just makes the function unnecessarily larger.
(FTR, we are also planning to rework how global clocks such as these are handled)
*/ | ||
#if !defined(PCD_SPEED_HIGH) | ||
#define PCD_SPEED_HIGH (PCD_SPEED_FULL + 1) | ||
#define PCD_SPEED_HIGH_IN_FULL (PCD_SPEED_HIGH + 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an unexpected value would be better, like UINT32_MAX
? (non blocking)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't really matter, it's impossible for these values to be assigned if the if !defined()
check succeeded. (they are only needed for e.g. the check in udc_stm32_device_speed
to compile)
k_sleep(K_MSEC(100)); | ||
} | ||
#elif defined(CONFIG_SOC_SERIES_STM32U5X) | ||
/* Sequence to enable the power of the OTG HS on a stm32U5 serie : Enable VDDUSB */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an inline comment to explain that PWR is always enable at SoC eraly inits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan to clean this up when reworking this whole topic globally, so not necessary IMO.
Rework the STM32 USB UDC driver to use HAL PCD macros for speed selection, as should have always been done since that is the library used by the shim driver. Also dummy definitions to ensure cross-series compatibility without many #if blocks in the driver. Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Rework how the driver performs PWR configuration and initializes HS PHYs. Originally, the initialization logic was split in half without any real logic. There were also attempts to share some logic but this resulted in code that was difficult to understand. Initialize PWR and PHY in well separated steps, and use explicit series and PHY type checks in each part to ensure the logic is easy to understand. Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
…ation Rework how the STM32 UDC driver determines the PHY used by a given instance and the speed at which the instance is able to and allowed to operate. The PHY determination now uses the 'phys' property instead of looking at whether nodes with a specific compatible were enabled. Similarly, the speed determination takes into account the 'maximum-speed' property, along with the selected PHY's and the instance's capabilities. Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
9eb058a
to
ec9be4d
Compare
|
092a082
into
zephyrproject-rtos:main
Rework how the STM32 USB driver determines the PHY type and operating speed. This approach is more solid, based on the
phys
property andcompatible
on the node itself, rather than looking at which nodes are enabled and hoping for the best.PCD_PHY_xxx
andPCD_SPEED_xxx
macros, which should be more portable, are also used now in place of the LL USB macros.Commit 7ff59b5 is cherry-picked from #89866; it is not strictly related to PR's contents, but HS does not work without it. Since this PR supersedes #89866, the commit could be merged as part of it; however, I don't mind #89866 being modified to only include this commit or a separate PR being opened...
This PR also partially supersedes #86100 (only a few cosmetic(?) changes are missing here).