Skip to content

drivers: usb: common: Added uhc dwc2 initial files [part2]#102963

Closed
roma-jam wants to merge 1 commit intozephyrproject-rtos:mainfrom
roma-jam-lab:pr-add-dwc2-uhc-defs-and-api
Closed

drivers: usb: common: Added uhc dwc2 initial files [part2]#102963
roma-jam wants to merge 1 commit intozephyrproject-rtos:mainfrom
roma-jam-lab:pr-add-dwc2-uhc-defs-and-api

Conversation

@roma-jam
Copy link
Copy Markdown
Contributor

@roma-jam roma-jam commented Jan 27, 2026

Description

Added uhc dwc2 files with:

  • Driver API call signatures without implementation
  • DT multiinstance definition for uhc dwc2 (usb_otg peripheral)
  • Vendor quirks header file (with stubbed quirks for esp32)

Testing

  1. From the /samples/subsys/usb/shell folder, run
$ west build -b esp32s3_devkitc/esp32s3/procpu -- \
 -DCONFIG_SHELL=y \
 -DCONFIG_USB_HOST_STACK=y \
 -DCONFIG_USBH_SHELL=y \
 -DCONFIG_UDC_DWC2=n

and get:

... 

Successfully created ESP32-S3 image.
  1. Flash the binary with:
$ west flash --esp-device /dev/ttyACM0 && west espressif monitor -p /dev/ttyACM0

and get:

...

*** Booting Zephyr OS build 0e30ba353d11 ***
uart:~$
  1. Init usbh with
uart:~$ usbh init
host: Failed to initialize -88
[00:00:03.939,000] <wrn> uhc_dwc2: uhc_dwc2_init has not been implemented
[00:00:03.939,000] <err> uhs: Failed to init device driver
uart:~$ 

If the line uhc_dwc2: uhc_dwc2_init has not been implemented is present in the output, then the source files were build successfully and the driver is reachable.

Changes

Added

  • samples/subsys/usb/shell/boards/esp32s3_devkitc_procpu.overlay - ESP32-S3 project overlay for testing purpose
  • drivers/usb/uhc/KConfig.dwc2 - Specific host-related configuration
  • drivers/usb/uhc/uhc_dwc2.c
  • drivers/usb/uhc/uhc_dwc2.h
  • drivers/usb/uhc/uhc_dwc2_vendor_quirks.h

Updated

  • drivers/usb/uhc/CMakeLists.txt
  • drivers/usb/uhc/KConfig

Related

@josuah
Copy link
Copy Markdown
Contributor

josuah commented Jan 27, 2026

It seems like these instructions do not really work until [part3] because of lack of vendor quirks for ESP32? How about moving the instructions to [part3]?

@josuah josuah linked an issue Jan 27, 2026 that may be closed by this pull request
@roma-jam
Copy link
Copy Markdown
Contributor Author

Hi @josuah

It seems like these instructions do not really work until [part3] because of lack of vendor quirks for ESP32? How about moving the instructions to [part3]?

This is strange, I did it while I prepared the description and tried it again one more time right now.
Did you try it out? If yes, you can share the output so I can figure out the difference and consider it in the future.

I introduced this overlay in current [part4], because it make sense as there is some code to test. Here is just that the build is fine.
Although here (if we want to test it), we need to create an overlay manually (as I described in steps). Considering this, maybe I can move adding the overlay to this PR, just to make it easier.

Anyway, it is not that many changes in here, and there are much more to review in [part4].

Am I right, that when development will be finished, I need to delete this overlay file?

@roma-jam roma-jam force-pushed the pr-add-dwc2-uhc-defs-and-api branch from eb3f94a to c7f78ce Compare January 28, 2026 08:22
@zephyrbot zephyrbot added the area: Samples Samples label Jan 28, 2026
@roma-jam roma-jam changed the title [WIP] drivers: usb: common: Added uhc dwc2 initial files [part2] drivers: usb: common: Added uhc dwc2 initial files [part2] Jan 28, 2026
@roma-jam roma-jam marked this pull request as draft January 29, 2026 08:59
@roma-jam roma-jam changed the title drivers: usb: common: Added uhc dwc2 initial files [part2] [WIP] drivers: usb: common: Added uhc dwc2 initial files [part2] Jan 29, 2026
@roma-jam roma-jam force-pushed the pr-add-dwc2-uhc-defs-and-api branch from c7f78ce to ec9ffe2 Compare January 29, 2026 11:03
Copy link
Copy Markdown
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

I forgot to hit "Submit review" a few days ago, so here it is...

Comment thread drivers/usb/uhc/Kconfig.dwc2 Outdated
Comment thread drivers/usb/uhc/Kconfig.dwc2 Outdated
Comment thread drivers/usb/uhc/Kconfig.dwc2 Outdated
Comment thread drivers/usb/uhc/Kconfig.dwc2 Outdated
Comment thread drivers/usb/uhc/uhc_dwc2.c
Comment thread drivers/usb/uhc/uhc_dwc2.c Outdated
Comment thread drivers/usb/uhc/uhc_dwc2.c Outdated
Comment thread drivers/usb/uhc/uhc_dwc2.c Outdated
Comment thread drivers/usb/uhc/uhc_dwc2.c Outdated
@josuah
Copy link
Copy Markdown
Contributor

josuah commented Jan 30, 2026

Did you try it out?

No I did not try it out. I did not expect it to work, but I realize that there are placeholders for all the ESP32 vendor quirks, so my bad no problem.

[...] there is some code to test. Here is just that the build is fine.

Although here (if we want to test it), we need to create an overlay manually (as I described in steps). Considering this, maybe I can move adding the overlay to this PR, just to make it easier.

There should not need an overlay to test with build_all as it only relies on Kconfig and use of boards that have status = "okay";. Hence absence of .overlay file here: https://github.com/zephyrproject-rtos/zephyr/tree/main/tests/drivers/build_all/usb

Copy link
Copy Markdown
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

Would you like me to force-push to this branch (and part3) to take the bureaucracy part away and let you focus on what you planned to do?

Comment thread drivers/usb/uhc/uhc_dwc2.h Outdated
Comment thread drivers/usb/uhc/uhc_dwc2.c Outdated
@roma-jam
Copy link
Copy Markdown
Contributor Author

Hi @josuah,

thanks for moving the notes from the fork to the upstream PR to keep them all in one place.

Would you like me to force-push to this branch (and part3) to take the bureaucracy part away and let you focus on what you planned to do?

I would prefer to make it myself, because otherwise that means that you or someone else should do this every time.
I don't see any problem for me to align with such things (yes, it will take some time, but I hope that after that the cumulative pace will be better).

So, give me a moment, I will address all the notes soon.

@josuah
Copy link
Copy Markdown
Contributor

josuah commented Feb 1, 2026

Understood, no rush and thank you for the effort. I will try to stay reactive all I can.

@josuah
Copy link
Copy Markdown
Contributor

josuah commented Feb 22, 2026

Here are 2 variants for part2, which might also affect part3 but I think other parts would just need rebase, some few conflicts but no big refactor as function names remain the same.

The goal being not moving code bits of DWC2 from device -> device_next -> host if not needed.

It might be possible to first merge part2, then consider the above two PRs "future improvement" so that it does not impact the timeline on DWC2, or directly merge those above (if preferred) to reduce PR churn.

josuah
josuah previously approved these changes Feb 22, 2026
@josuah
Copy link
Copy Markdown
Contributor

josuah commented Feb 24, 2026

@roma-jam anything you planned to modify/add before review?
I'll start connecting nRF54LM20's quirks when this gets ready be merged.
Then I guess it is possible can pursue with the chain of PRs.

Thank you

@roma-jam
Copy link
Copy Markdown
Contributor Author

Hi @josuah,

anything you planned to modify/add before review?

not, don't think so. Might be marked as "ready for review".

Thanks for the poking.

@roma-jam roma-jam marked this pull request as ready for review February 24, 2026 12:48
@roma-jam roma-jam requested a review from tmon-nordic February 24, 2026 12:48
@sylvioalves
Copy link
Copy Markdown
Contributor

@roma-jam I see now all PRs are kind of incrementing.. So the comments in the other parts apply here as well.

@roma-jam roma-jam force-pushed the pr-add-dwc2-uhc-defs-and-api branch from 5d42b36 to fa0c009 Compare March 5, 2026 16:28
@josuah josuah self-requested a review March 5, 2026 16:28
Comment thread drivers/usb/uhc/CMakeLists.txt
@roma-jam roma-jam force-pushed the pr-add-dwc2-uhc-defs-and-api branch 2 times, most recently from 24a9a49 to 459ec1d Compare March 9, 2026 10:36
josuah
josuah previously approved these changes Mar 9, 2026
Added:
- Driver API signatures without implementation
- DT miltiinstance definition of uhc dwc2
- Stubbed vendor quirks calls for esp32
- Added the esp32s3 overlay for usb shell example for testing purpose

Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
@roma-jam roma-jam force-pushed the pr-add-dwc2-uhc-defs-and-api branch from 459ec1d to 008ce92 Compare March 9, 2026 10:41
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 9, 2026

@roma-jam
Copy link
Copy Markdown
Contributor Author

roma-jam commented Apr 9, 2026

Hi
@jfischer-no,
@tmon-nordic,
@josuah,

PTAL, this is a common initial API for uhc dwc2.

Let me know what you think and how I can push it forward. Thanks.

Copy link
Copy Markdown
Contributor

@jfischer-no jfischer-no left a comment

Choose a reason for hiding this comment

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

Let me know what you think and how I can push it forward. Thanks.

Sorry, I started looking at these PRs, but was interrupted by an urgent task. I wanted to comment on all of them, but perhaps this is not necessary.

We do not add unfinished drivers. Basically, a PR should contain a working driver on at least one platform. Please choose a PR with significant progress and include all the necessary commits. I will add it to the milestone of the next release. Then, please close all other PRs with a reference to the one where the work will be done. There will be increasing interest in this driver, so people can start looking at it for their adaptions/contributions. If you need my attention, please ping me directly on Discord. Thank you.

@roma-jam
Copy link
Copy Markdown
Contributor Author

Hi @jfischer-no,

thanks for returning back to me.
I'll connect you in discord.

@roma-jam
Copy link
Copy Markdown
Contributor Author

Closed because this PR doesn't introduce the working driver state, but just a prerequisites for it.

For the first working state of the driver, please refer #102967.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Samples Samples area: USB Universal Serial Bus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DWC2 USB Host controller (UHC)

7 participants