-
Notifications
You must be signed in to change notification settings - Fork 8.4k
UHC: DWC2: host support for nRF54LM20 [WIP] #95723
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
base: main
Are you sure you want to change the base?
UHC: DWC2: host support for nRF54LM20 [WIP] #95723
Conversation
|
So far, only getting the IRQs upon connection/disconnection are working, and almost none of the content of |
c6292fb to
c7b19bc
Compare
|
This PR is now having all the content of # in addition to the nRF54LM20, and it will now be possible to progressively review what is present, to keep only what makes sense and what follows the databook/programmer manual. It is not yet possible to enumerate devices: But connection/disconnection events are still detected: |
|
Hi @josuah, But please, wait for a moment, I will remove the LL-layer completely and make everything udc_dwc2-alike soon. |
|
No problem. I am now pursuing with the host class API. |
|
Hi @josuah, I have removed the LL-layer, so please, feel free to rebase. Also, I can see that the log is from uhc and then in the end - the udc: Just in case - is that intentional? Because I didn't check the possibility to run udc after uhc, so there could be some moments, that need to be fixed. |
|
Thanks! I will do this soon.
No problem with you refactoring in the meantime, please feel free to keep doing so. |
|
Some script showing the difference in hardware configuration registers of ESP32-S3 and nRF54LM20. output |
c7b19bc to
520bbac
Compare
520bbac to
8e1b61a
Compare
|
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
8e1b61a to
89c6af5
Compare
aa033fb to
85e6c06
Compare
drivers/usb/uhc/uhc_dwc2.c
Outdated
| struct uhc_dwc2_data *priv = uhc_get_private(dev); | ||
| enum uhc_port_event port_event = UHC_PORT_EVENT_NONE; | ||
|
|
||
| /* TODO: enter critial section */ |
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 it is better to keep the TODOs regarding the critical section, as it is important.
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 tried to reduce everything to the minimal and might have trimmed important pieces accidentally.
The hope is that it's easier to add them back after the conversion rather than keep them while trying as hard to know what was historical baggage from the ESP32 export, or an optimization encountered in a different platform, or needed part of the operation etc. Thanks for helping seeing clear!
Regarding the critical section, I wonder:
- If we are in IRQs, it is not possible to lock IRQs or have blocking calls anyway
- If we are not in the IRQs, we are in the main thread or in an API call, and there is a global lock already.
Is there extra locking required in addition to this?
b518cfd to
939baa9
Compare
ee1cead to
cc5a2a9
Compare
commit 2a120d0Everything above contains ~100 bissectable mini-commits that slowly transform the original work passed from hand to hand into a hopefully more minimal and workable following a single coding/naming style and uniform structure ( Hopefully all the logic was retained. Test scripts:
n='
'
set -eux
west build -d build_esp32s3 -b esp32s3_devkitm/esp32s3/procpu samples/subsys/usb/shell/ \
-DEXTRA_CONF_FILE=host_prj.conf \
-DCONFIG_USB_DEVICE_STACK_NEXT=n \
-DCONFIG_UHC_DRIVER_LOG_LEVEL_DBG=y \
-DCONFIG_ASSERT=y \
west flash -d build_esp32s3 --esp-device "$1"
sleep 1
picocom --quiet --initstring "usbh init$n""usbh enable$n" --baud 115200 "$1"
n='
'
set -eux
west build -d build_nrf54lm20 -b nrf54lm20dk/nrf54lm20a/cpuapp samples/subsys/usb/shell/ \
-DEXTRA_CONF_FILE=host_prj.conf \
-DCONFIG_USB_DEVICE_STACK_NEXT=n \
-DCONFIG_UHC_DRIVER_LOG_LEVEL_DBG=y \
-DCONFIG_ASSERT=y \
west flash -d build_nrf54lm20
sleep 1
picocom --quiet --initstring "usbh init$n""usbh enable$n" --baud 115200 "$1"I will now squash everything and modify the driver to make it pass CI, then edit coding style a bit. |
80cda8f to
8c3e2a3
Compare
e5bc28d to
859825e
Compare
A new linting tool got introduced, and prior to submit new contributions to .dtsi files, files need to be made compliant. Signed-off-by: Josuah Demangeon <[email protected]>
Update the HAL to latest main version for support of USB Host Controller uhc_dwc2.c, needed for the vendor quirsk. Signed-off-by: Josuah Demangeon <[email protected]>
Add board support files needed to test the ESP32-S3 devkit with host support, as well as host_prj.conf used to test the USB shell with host support exclusively. Example build command: west build -b esp32s3_devkitm/esp32s3/procpu samples/subsys/usb/shell/ \ -DEXTRA_CONF_FILE=host_prj.conf -DCONFIG_USB_DEVICE_STACK_NEXT=n Signed-off-by: Roman Leonov <[email protected]>
Added register bitmask description with low-level abstraction Signed-off-by: Roman Leonov <[email protected]>
859825e to
dd5d9a1
Compare
Introduce an USB host driver for Synopsys Designware USB OTG controller (DWC2) with vendor quirks for nRF54LM20 and ESP32-S3, using the nRF54LM20-DK and ESP32-S3 DevitC. Both need VBUS supplied with an external +5V to power the USB device. The driver currently only support control commands on the control endpoint which is enough for the enumeration process. Signed-off-by: Roman Leonov <[email protected]> Co-authored-by: Josuah Demangeon <[email protected]>
dd5d9a1 to
6d38acb
Compare
|
|
@roma-jam it should be stable enough that it can be picked as a basis if you want, but if you notice that things are missing let me know. I don't really identify what came from the original driver and what you introduced on top. |
|
@josuah wow, I briefly check the changes....looks more Zephyr-style :) I also briefly checked the most critical parts and seems that that logic was kept (at least from the first glance). |
|
Hi @josuah, seems that I can return to this sooner than I expected. I can't say what a great part of the job you did with refactoring...Honestly, I'm impressed. Ok, back to the topic: would you mind if I cherry-pick your commits with refactoring to my branch and:
|
|
Thank you.
Please go ahead, this was the original intent of this PR: to let everyone working on DWC2 host keep going on a common ground.
I observe there is some problem while starting Zephyr and USB init/enable first, and plugging the USB device after. I can use the "bisectable commits" above to check which small change broke something if that helps.
I will have to switch to another project soon, hopefully this helps getting this branch stable as you start using it. I will keep this one as draft just for adding the nRF54LM20 and will rebase it on top of your changes as you publish them. |
|
@josuah ,
I remember I already had the same problem two times during the past time and both times I solved it. |



Dependencies:
Goals:
#94266until this PR becomes only additions, no deletion/modifications#94266when they are required.Non-goals:
#94266: propositions for improving this PR are to be done on a separate PRTo test:
For now I am testing with externally provided power supply using an USB OTG adapter with external power supply.