uhc: dwc2: vendor quirks for nRF54LM20#95723
uhc: dwc2: vendor quirks for nRF54LM20#95723josuah wants to merge 5 commits intozephyrproject-rtos:mainfrom
Conversation
c6292fb to
c7b19bc
Compare
|
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
| 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.
Maybe it is better to keep the TODOs regarding the critical section, as it is important.
There was a problem hiding this comment.
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?
ee52eba to
d8a9b2e
Compare
92c7a85 to
123333d
Compare
5f5d57e to
89273ae
Compare
|
89273ae to
e8d3b99
Compare
|
Force-push: |
| int err; | ||
|
|
||
| /* TODO: not expected to be there */ | ||
| LOG_MODULE_DECLARE(uhc_dwc2, CONFIG_UHC_DRIVER_LOG_LEVEL); |
|
|
||
| if (!k_event_wait(&data->events, USBHS_VBUS_READY, false, K_NO_WAIT)) { | ||
| LOG_INF("VBUS is not ready, block udc_enable()"); | ||
| if (!k_event_wait(&data->events, USBHS_VBUS_READY, false, timeout)) { |
There was a problem hiding this comment.
Why do we need to wait USBHS_VBUS_READY two times: one with K_NO_WAIT and he second one with timeout?
Isn't the timeout only enough?
There was a problem hiding this comment.
That is from the UDC DWC2 quirk, the first one does not wait but allows to print a logging message. That does not seems to be right for the UHC.
There was a problem hiding this comment.
Done, only one k_event_wait() now.
The message was printed every time in practice...
Add 'gsnpsid' and 'ghwcfg3' to DWC2 USB peripheral in order to check that they are as expected at runtimne, which the host driver can use. Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Note: Control transfers only Add initial usb host driver for Synopsys DWC2 with vendor quirks. Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
|
Force-push:
Not sure why this is needed, but it helps to do this: diff --git a/drivers/usb/uhc/uhc_dwc2.c b/drivers/usb/uhc/uhc_dwc2.c
index d4453c20cdd..c249674e5e9 100644
--- a/drivers/usb/uhc/uhc_dwc2.c
+++ b/drivers/usb/uhc/uhc_dwc2.c
@@ -847,7 +847,6 @@ static int uhc_dwc2_channel_configure(const struct device *const dev,
hcintmsk = sys_read32((mem_addr_t)&channel->regs->hcintmsk);
/* Enable transfer complete and channel halted interrupts */
- hcintmsk |= USB_DWC2_HCINT_XFERCOMPL;
hcintmsk |= USB_DWC2_HCINT_CHHLTD;
/* Enable error interrupts */
hcintmsk |= USB_DWC2_HCINT_ERRORS;
@@ -1304,6 +1303,8 @@ static int uhc_dwc2_bus_reset(const struct device *const dev)
k_msleep(RESET_RECOVERY_MS);
/* Finish the port config for the appeared device */
+ dwc2_hal_set_fifo_sizes(dwc2, config->ghwcfg2, config->ghwcfg3);
+
/* TODO: set frame list for the ISOC/INTR xfer */
/* TODO: enable periodic transfer */
This also matches what is described by the datasheet. |
Add vendor quirks for nRF54LM20 PHY configuration for DWC2 in host mode. Given the PHY is powered from USB, the PHY needs to be configured and powered on before registers can be accessed or the SoC freezes on any register access. Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Enable the DWC2 host controller, for now requiring external power to be provided to the VBUS pin, however usable. Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
|



Dependencies:
For testing, provide power externally using an USB OTG adapter with external power supply.