Skip to content

usb: device_next: usb3 support #82801

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

josuah
Copy link
Collaborator

@josuah josuah commented Dec 10, 2024

This adds definitions needed for USB3 support.

There is no USB3 controller supported upstream yet. Should I wait to have the driver contributed in the same PR?

Here is the result of USB3CV for a this upcoming driver:
https://josuah.net/paste/rOzDHBjCbAIWO8d4qZu3/Chapter_9_Tests_USB_3_Gen_X_Failed_2024_12_10_08_18_16.html

It fails at SetFeature, as well as re-enumerating as USB2 (but this is related to the driver, not the USB3 handling).
But everything else is passing.

It also runs well with Twister on SuperSpeed configuration:

west twister --platform native_sim --scenario tests/subsys/usb/device_next/usb.device_next --inline-logs
Renaming output directory to /home/tinyvision/zephyrproject/zephyr/twister-out.1
INFO    - Using Ninja..
INFO    - Zephyr version: v4.0.0-1781-gbb86ae133c77
INFO    - Using 'zephyr' toolchain.
INFO    - Building initial testsuite list...
INFO    - Writing JSON report /home/tinyvision/zephyrproject/zephyr/twister-out/testplan.json
INFO    - JOBS: 1
INFO    - Adding tasks to the queue...
INFO    - Added initial list of jobs to queue
INFO    - Total complete:    1/   1  100%  built (not run):    0, filtered:    0, failed:    0, error:    0
INFO    - 1 test scenarios (1 configurations) selected, 0 configurations filtered (0 by static filter, 0 at runtime).
INFO    - 1 of 1 executed test configurations passed (100.00%), 0 built (not run), 0 failed, 0 errored, with no warnings in 25.02 seconds.
INFO    - 2 of 2 executed test cases passed (100.00%) on 1 out of total 880 platforms (0.11%).
INFO    - 1 test configurations executed on platforms, 0 test configurations were only built.
INFO    - Saving reports...
INFO    - Writing JSON report /home/tinyvision/zephyrproject/zephyr/twister-out/twister.json
INFO    - Writing xunit report /home/tinyvision/zephyrproject/zephyr/twister-out/twister.xml...
INFO    - Writing xunit report /home/tinyvision/zephyrproject/zephyr/twister-out/twister_report.xml...
INFO    - Run completed

@josuah josuah added the Experimental Experimental features not enabled by default label Dec 10, 2024
@zephyrbot zephyrbot added the area: USB Universal Serial Bus label Dec 10, 2024
@josuah josuah force-pushed the pr-usb3 branch 2 times, most recently from 74d2fa4 to d5fda25 Compare December 10, 2024 18:10
@josuah
Copy link
Collaborator Author

josuah commented Dec 10, 2024

force-push:

  • CI fixes
  • doc fixes

@josuah
Copy link
Collaborator Author

josuah commented Dec 19, 2024

force-push:

  • Fix a typo for the udc caps struct
  • Add SET_ISOCH_DELAY as a no-op, as the host informs the device of an end-to-end delay observed, not used at this stage, but it might help with compliance to support it even if it does nothing.

@josuah
Copy link
Collaborator Author

josuah commented Dec 19, 2024

The USB3 driver in question is soon to be contributed, and the implementation lives here in the meantime:

Copy link
Collaborator

@tmon-nordic tmon-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that Super-Speed requires bulk endpoints wMaxPacketSize to be 1024 makes #76255 even more important

@josuah josuah force-pushed the pr-usb3 branch 2 times, most recently from 74cf9e3 to 7249333 Compare January 11, 2025 18:10
@josuah
Copy link
Collaborator Author

josuah commented Jan 11, 2025

force-push:

  • Renamed udc_exit_latency into usb_system_exit_latency and moved it to usb_ch9.h
  • Added USB3 SuperSpeedPlus capability descriptor (untested)
  • Added USB_BOS_CAPABILITY_PRECISION_TIME_MEASUREMENT
  • Renamed and moved capabilities as requested.
  • Wording, and section number typo fixups

SuperSpeedPlus still lacks other modifications to be enabled: everywhere SuperSpeed (SS) is introduced, SuperSpeedPlus (SSP) needs to be introduced as well.

@josuah
Copy link
Collaborator Author

josuah commented Jan 11, 2025

The fact that Super-Speed requires bulk endpoints wMaxPacketSize to be 1024 makes #76255 even more important

Here is what this PR it looks like on top of #76255:
tmon-nordic/zephyr@max-speed...tinyvision-ai-inc:zephyr:pr-usb3-max-speed

I thought it would be more suited to wait #76255 to be rebased before force-pushing this here.
Thank you for this review, and thanks all for this long-term maintenance effort of the new USB stack!

@josuah
Copy link
Collaborator Author

josuah commented Jan 13, 2025

force-push:

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Mar 18, 2025
@tmon-nordic tmon-nordic removed the Stale label Mar 18, 2025
@josuah josuah marked this pull request as draft April 21, 2025 17:07
@josuah
Copy link
Collaborator Author

josuah commented Apr 21, 2025

Force-push:

  • Rebased on main, I will re-test it again on top of DWC3.

Should USB 3 Super-Speed Gen1x1/Gen1x2/Gen2x1/Gen2x2 naming be adopted anticipating the possibility of the FX5/FX5N/FX10/FX20 controllers joining?

[EDIT: wrong keybinding, I did not mean to close it]

@josuah
Copy link
Collaborator Author

josuah commented May 7, 2025

force-push:

@josuah
Copy link
Collaborator Author

josuah commented May 7, 2025

Super-Speed Gen1x1/Gen1x2/Gen2x1/Gen2x2 naming

It might be possible to dodge the problem by using:

  • USBD_SUPPORTS_SUPER_SPEED (Gen1x1, Gen1x2) introduced now (DWC3, FX5),
  • USBD_SUPPORTS_SUPER_SPEED_PLUS (Gen2x1, Gen2x2) added later (FX10/FX20),

Combined with this to describe the full Gen1x1, Gen1x2, Gen2x1, Gen2x2:

  • USBD_SUPPORTS_DUAL_LANE (Gen1x2, Gen2x2) added later (FX5N, FX20).

@josuah josuah force-pushed the pr-usb3 branch 3 times, most recently from 960448b to 9f6a4fd Compare May 8, 2025 01:09
Introduce definitions to enable USB3 device controllers to be written.
So far, USB 3 support got added to the subsystem, UDC common code, the
Loopback class, and the CDC-ACM class.

Signed-off-by: Josuah Demangeon <me@josuah.net>
@josuah
Copy link
Collaborator Author

josuah commented Jun 12, 2025

Force-push:

  • Fix CDC ACM which was not completely working anymore after the latest rebase

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus Experimental Experimental features not enabled by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants