Skip to content
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

Planned USB device/host support rework/enhancements #42066

Open
19 of 50 tasks
jfischer-no opened this issue Jan 22, 2022 · 35 comments
Open
19 of 50 tasks

Planned USB device/host support rework/enhancements #42066

jfischer-no opened this issue Jan 22, 2022 · 35 comments
Assignees
Labels
area: USB Universal Serial Bus Meta A collection of features, enhancements or bugs RFC Request For Comments: want input from the community

Comments

@jfischer-no
Copy link
Collaborator

jfischer-no commented Jan 22, 2022

This is a meta issue for maintainers and developers of relevant subsystems to track progress on new USB support.

Introduction

Currently we have only USB device support in Zephyr OS. Existing USB device support has many disadvantages and issues, like missing support for multiple driver instances, no endpoint (request) buffers management, missing class instances management and possibility to configure/enable class instance at runtime, not a good notification channel to the user/application, messy callback architecture, no API to set/reconfigure idVendor/iSerialNumber/bcdDevice at runtime, confusing usb_dc_ep_read()/usb_dc_ep_write() API, and more.

There is no USB host support in the project. It is asked again and again for it and there was effort like #30361, but that is far from suitable. USB device stack would also benefit from the host support and allow self-contained tests with emulated device and host controllers, and better support for USBIP.

Since many problems with the USB device support are due to the way it is designed (imported in Zephyr OS), we would like to redesign USB device support. That means USB device controller driver API and USB device stack will be rewritten in parallel and independent to existing implementation. Due to the need for testing/validation, USB host controller driver API and some parts of higher level will also be implemented.

Rough plan

Timeline for transitioning to USB device "next" support

  • Port remaining drivers to "next" (stragglers may be left behind if no maintainers step up)
  • Complete UHC USBIP implementation
  • Remove experimental label from device next
  • Remove samples that work only with the legacy stack
  • Evaluate the test coverage of the next stack
  • Deprecate the current USB between 3.7.0 and 4.0.0
  • Make device next the default in 4.0.0
  • Remove the current USB stack in 4.2.0

Main "switch":

menuconfig USB_DEVICE_STACK_NEXT

@jfischer-no jfischer-no added area: USB Universal Serial Bus RFC Request For Comments: want input from the community labels Jan 22, 2022
@jfischer-no jfischer-no self-assigned this Jan 22, 2022
@jfischer-no jfischer-no added this to To Do in Release Plan via automation Jan 22, 2022
@jfischer-no jfischer-no moved this from To Do to LTS3 in Release Plan Jan 22, 2022
@koffes
Copy link
Collaborator

koffes commented Jan 24, 2022

This is good news. I would like to link to this issue: #26857, and hopefully the high CPU load will be resolved here as well. FYI @alexsven
Also, any plans for async USB audio support?

@henrikbrixandersen henrikbrixandersen added the Meta A collection of features, enhancements or bugs label Jan 24, 2022
@qipengzha
Copy link
Contributor

For driver support, will you plan to enable Synopsys DWC USB2.0 OTG controller ? thx

@dleach02
Copy link
Member

dleach02 commented Mar 2, 2022

Do we need a separate tracking ticket for USB Host?

@jfischer-no
Copy link
Collaborator Author

Do we need a separate tracking ticket for USB Host?

No, not at this time. My plan is that host controller driver API immediately follows device controller API (+ device stack), details of host support come afterwards.

@dleach02
Copy link
Member

dleach02 commented Mar 9, 2022

@jfischer-no Is there any of this that can be parallelized if additional resources are made available?

Also, what forum are we to use to have some open discussions about the API changes and requirements?

@jfischer-no
Copy link
Collaborator Author

@jfischer-no Is there any of this that can be parallelized if additional resources are made available?

Not yet.

@jfischer-no
Copy link
Collaborator Author

Plan updated.

@carlescufi carlescufi moved this from LTS3 to v3.2 in Release Plan Jun 1, 2022
@lenghonglin
Copy link
Contributor

hello, i use usb audio these , and the usb audio leak some feature unit, like volume . It there have some plan to do this?

@fabiobaltieri
Copy link
Member

@jfischer-no do you think we should push this to the v3.3 milestone? (it's currently tagged for v3.2)

@troica65
Copy link

Hi, any estimate for when host support will be available ?

@hongshui3000
Copy link
Contributor

+1

@jfischer-no
Copy link
Collaborator Author

hello, i use usb audio these , and the usb audio leak some feature unit, like volume . It there have some plan to do this?

Yes, but it is not directly relevant to this topic.

Hi, any estimate for when host support will be available ?

ASAP!

@nashif nashif moved this from v3.2 to v3.3 in Release Plan Sep 21, 2022
@jfischer-no
Copy link
Collaborator Author

Virtual controller and host support has been separated from #38679 and moved to #50985. Updated the list of drivers and class implementations to be ported.

@raveslave
Copy link

@MaureenHelm any interest from NXP to support the mcux usb host (and device) drivers for LPC and i.MXRT in zephyr?

@koffes
Copy link
Collaborator

koffes commented Dec 6, 2022

Wrt. Audio. Could someone please enlighten me on the status/plans for async USB support? We need the SoC to poll the PC host for new Audio data.

@jfischer-no
Copy link
Collaborator Author

Wrt. Audio. Could someone please enlighten me on the status/plans for async USB support? We need the SoC to poll the PC host for new Audio data.

I commented to a similar question above. It would be nice if you open a well-described enhancement issue or discussion, but it does not belong here!

@MaureenHelm any interest from NXP to support the mcux usb host (and device) drivers for LPC and i.MXRT in zephyr?

It appeared to me in a dream that progress on NXP USB controller support is inversely proportional to how often you ask the same question in different topics.

@MaureenHelm
Copy link
Member

@MaureenHelm any interest from NXP to support the mcux usb host (and device) drivers for LPC and i.MXRT in zephyr?

I don't work at NXP anymore. Please contact @dleach02 for NXP-related questions.

@carlescufi carlescufi changed the title Planned USB device/host support rework/enhancements for 2022 Planned USB device/host support rework/enhancements Jan 4, 2023
@virginie0818

This comment was marked as spam.

@jgl-meta
Copy link
Collaborator

@jfischer-no What is the status of this? Is this on track to be finished before release 3.4?

@jfischer-no
Copy link
Collaborator Author

@jfischer-no What is the status of this? Is this on track to be finished before release 3.4?

Obviously only what is explicitly marked for the v3.4.0 #42066 (comment)

@tmon-nordic
Copy link
Contributor

Porting all classes is marked for 3.4.0, but considering feature freeze date (2023/05/26) is just in few weeks it might not be possible.

@faloj
Copy link
Contributor

faloj commented Aug 24, 2023

Some components support both device and host mode. This partition between uhc and udc may lead to code duplication for those components. What do you think of a third folder along with "uhc" and "udc" to hold shuch code ? (something like "common" or "core" maybe ?)

@dleach02
Copy link
Member

dleach02 commented Sep 6, 2023

@MaureenHelm any interest from NXP to support the mcux usb host (and device) drivers for LPC and i.MXRT in zephyr?

Yes, there is interest from NXP and USB host support.

@jfischer-no, what is the right forum to discuss this? Is it here in this ticket?

@jfischer-no
Copy link
Collaborator Author

jfischer-no commented Sep 14, 2023

Yes, there is interest from NXP and USB host support.

@jfischer-no, what is the right forum to discuss this? Is it here in this ticket?

@dleach02 Please not here, maybe discussions, but once you have started implementing a UHC driver, please add a note to the description or ask me for an update. However, the priority is and should be to get the new device support to a state where we can start calling the current stack legacy. This means there should be alternatives to all the class implementations we have for the current stack, and a few more drivers.

@dleach02
Copy link
Member

Okay @jfischer-no. My primary interest is USB host mode. Trying to figure out the pathway to getting this up and running on one of our platforms, maybe the RT5xxx.

@hswang914
Copy link

Hi, I saw the phrase "Introduction of USB device controller API." Does it mean that there is a resource available for me to study and understand the new USB device driver, such as a basic usage guide or a comparison with the old one? Thanks!

@MarkWangChinese
Copy link
Contributor

MarkWangChinese commented Mar 14, 2024

Hi @jfischer-no I am working on this task.

  • usb_dc_mcux -> udc_mcux

@MarkWangChinese
Copy link
Contributor

Hi @jfischer-no I (from NXP) want to contribute the USB host stack because NXP has interest for Zephyr USB host. What can I help for developing the Zephyr USB host stack? If you already have the overall thought about the host stack, I can help to do the implementation. In short, I want to contribute USB Host stack and accelerate its implementation. Thanks. Our team is the owner of the NXP SDK USB stack, so we have a lot of experience on USB2.0.

@jfischer-no
Copy link
Collaborator Author

Hi @jfischer-no I (from NXP) want to contribute the USB host stack because NXP has interest for Zephyr USB host. What can I help for developing the Zephyr USB host stack? If you already have the overall thought about the host stack, I can help to do the implementation. In short, I want to contribute USB Host stack and accelerate its implementation. Thanks. Our team is the owner of the NXP SDK USB stack, so we have a lot of experience on USB2.0.

Nice ❤️ . However, here is no independent USB host stack, it is part of the USB support, see my comment #42066 (comment). Thanks for the upcoming contribution to Zephyr's USB support, especially on ASAP porting NXP USB device driver to new UDC API where each NXP controller type has its own driver and not as clumsy as the existing usb_dc_mcux.

@dleach02
Copy link
Member

dleach02 commented Apr 1, 2024

@jfischer-no,

Yes, there is interest from NXP and USB host support.
@jfischer-no, what is the right forum to discuss this? Is it here in this ticket?

@dleach02 Please not here, maybe discussions, but once you have started implementing a UHC driver, please add a note to the description or ask me for an update. However, the priority is and should be to get the new device support to a state where we can start calling the current stack legacy. This means there should be alternatives to all the class implementations we have for the current stack, and a few more drivers.

If I look at the list of items for moving over to the new UDC it looks like mostly porting vendor's USB drivers. I think it makes sense to work in parallel on the host layer instead of serializing this effort. If we are blocked by other vendors conversions we may never get to the host work.

We have needs for host support and the resources available to assist in this effort. Just need some guidance on how you want this done.

@josuah
Copy link
Collaborator

josuah commented May 7, 2024

I got started with UVC.

For now a continuation of the Video driver interface. #72311

The recent UAC2 seems like a good reference for how to implement it. #70029

@ddavidebor
Copy link

is the USB-ip supposed to work with native_sim and the device_next stack?

@josuah
Copy link
Collaborator

josuah commented May 17, 2024

is the USB-ip supposed to work with native_sim and the device_next stack?

If it is about help for troubleshooting, feel free to join the Discord server, the Mailing lists, the Discussions section, or open a new issue if you encountered what appears to be a bug.
[EDIT: what I mean is I am up to discuss about USB/IP support (or did you mean CDC ECM?) but wish to avoid bloating this thread]

@henrikbrixandersen
Copy link
Member

is the USB-ip supposed to work with native_sim and the device_next stack?

Please see #74141

@tannewt
Copy link

tannewt commented Jun 25, 2024

Why not use TinyUSB instead of making a new stack? It has device and host support already. It has an OS abstraction layer as well. License is MIT.

Both Espressif and Raspberry Pi use it in their SDKs already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus Meta A collection of features, enhancements or bugs RFC Request For Comments: want input from the community
Projects
Status: Todo
Status: Future
Release Plan
  
v3.3
Development

No branches or pull requests