Commit graph

9 commits

Author SHA1 Message Date
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