Commit graph

14 commits

Author SHA1 Message Date
Johann Fischer
4fe2c5bd5f drivers: udc: allow to use timeout Kconfig option on nRF54LM20A SoC
Kconfig option UDC_DWC2_USBHS_VBUS_READY_TIMEOUT depends on services
exclusively available for nRF54H20, but the option can also be used for
nRF54LM20A, where there are no service dependencies, and VREG can be
accessed by the driver directly. Let depend the option on the SOC
series, as the controller can be used by the different CPUs on the SOC.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-09-26 20:48:32 -04:00
Raffael Rostagno
41cac25632 drivers: usb: dwc2: esp32: Add support
Add USB device driver support for ESP32 devices with
USB-OTG peripheral.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-09-16 16:04:03 +02:00
Tomasz Moń
0748b4e47d drivers: udc_dwc2: Control D+ pull-up on nRF54H20
Disable D+ pull-up on core disable to make sure that device does not
indicate its presence to host before the stack is ready (software
initializes controller and clears SftDiscon bit).

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-09-16 14:05:18 +02:00
Tomasz Moń
66b938f93a drivers: udc_dwc2: Add nRF54LM20A vendor quirks
Initial implementation of nRF54L quirks necessary for nRF54LM20A.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-08-06 12:01:34 -04:00
Tomasz Moń
46b11f1fb2 drivers: udc_dwc2: Inline vendor quirks if possible
Constify vendor quirks structure to not keep it in RAM. Use constified
vendor quirks structure directly if there is only one snps,dwc2 instance
to allow compiler inlining quirk implementation.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-27 10:57:47 +02:00
Tomasz Moń
437983e2c9 drivers: udc_dwc2: Ensure overlapping USBHS reset
Wait for PHY clock before triggering START task to ensure overlapped
reset for PHY and DWC2 core.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-03-24 15:10:13 +01:00
Tomasz Moń
df36b162bd drivers: udc_dwc2: Wait for USBHS clock start
Accessing DWC2 otg core registers before the clock starts results in
complete system hang. Add a 1 us busy wait to make sure that software
won't access registers before the clock is started.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-11-29 11:44:26 +01:00
Aleksander Strzebonski
18fb3f9a32 usb: dwc2: Allow for enabling USB if the cable is disconnected
Adds CONFIG_UDC_DWC2_USBHS_VBUS_READY_TIMEOUT_MS that allows
for waiting for a USBHS VBUS ready event for a specified
amount of time. Earlier it waited forever and because of that,
the udc_enable() was blocked forever if the USB cable was
disconnected. Now the function returns error on timeout.

Signed-off-by: Aleksander Strzebonski <aleksander.strzebonski@nordicsemi.no>
2024-10-16 16:37:31 +01:00
Tomasz Moń
e2f2e448c7 drivers: udc_dwc2: Implement USBHS hibernation quirks
Use the quirk to keep only the necessary clocks running when the core is
hibernated. The quirk is necessary to bring the USB suspend current
below the USB 2.0 suspend current limit.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-09-26 03:33:52 -04:00
Tomasz Moń
e2afcafca5 drivers: udc_dwc2: Abort wait when PHY is not clocked
On nRF54H20DK the USB PHY is powered from VBUS. When the USB cable is
not connected, the PHY is not powered and the PHY clock disappears.

Because the GOUTNAKEFF and INEPNAKEFF can only ever be set when PHY
clock is active, the waits for these bits do timeout if cable is
disconnected. Workaround the issue by aborting the wait if vendor quirk
indicates that PHY clock has abruptly vanished.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-06-06 07:53:17 -04:00
Johann Fischer
715e4ce6f3 drivers: udc_dwc2: prevent access to registers if USBHS is not ready
On USBHS, we cannot access the DWC2 register until VBUS is detected and
valid. Kernel event API is used to block if a valid VBUS signal is not
present when the user tries to force usbd_enable().

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer
b117155320 drivers: udc_dwc2: add vendor quirks to support Nordic USBHS controller
Add vendor quirks to support Nordic USBHS controller.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer
efb286dfdf drivers: udc_dwc2: rework vendor quirks
Rework and rename vendor quirks to better reflect where they intended to
be called. Number of quirks probably not final and will be trimmed
later.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer
cc2fdf2053 drivers: udc: add initial support for DWC2 controller
The driver currently supports only dedicated FIFO mode (with
dynfifosizing if enabled). Control, bulk and interrupt transfers are
supported, isochronous transfers are not yet supported. The driver
accesses controller registers using sys_io.h, but for debugging purposes
one can get a register map from the driver's config, similar to the
usb_dc_dw.c driver.

Initial support also has vendor quirks for the STM32F4 SoC family.
Tested on NUCLEO-F413HG.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-18 09:48:58 +01:00