Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions boards/nordic/nrf54lm20dk/nrf54lm20_a_b_cpuapp_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ temp_sensor: &temp {
status = "okay";
};

zephyr_uhc0: &usbhs {
status = "okay";
};

zephyr_udc0: &usbhs {
status = "okay";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ supported:
- pwm
- spi
- usbd
- usbh
- watchdog
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ supported:
- pwm
- spi
- usbd
- usbh
- watchdog
vendor: nordic
sysbuild: true
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ supported:
- pwm
- spi
- usbd
- usbh
- watchdog
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ supported:
- pwm
- spi
- usbd
- usbh
- watchdog
vendor: nordic
sysbuild: true
5 changes: 5 additions & 0 deletions drivers/usb/common/usb_dwc2_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,12 @@ USB_DWC2_SET_FIELD_DEFINE(gnptxfsiz_nptxfstaddr, GNPTXFSIZ_NPTXFSTADDR)
#define USB_DWC2_GGPIO_STM32_PWRDWN BIT(USB_DWC2_GGPIO_STM32_PWRDWN_POS)

/* GSNPSID register */
#define USB_DWC2_GSNPSID_REV_4_20A 0x4F54420AUL
#define USB_DWC2_GSNPSID_REV_5_00A 0x4F54500AUL
#define USB_DWC2_GSNPSID_REV_POS 0UL
#define USB_DWC2_GSNPSID_REV_MASK (0xFFFFUL << USB_DWC2_GSNPSID_REV_POS)

USB_DWC2_GET_FIELD_DEFINE(gsnpsid_rev, GSNPSID_REV)

/* GHWCFG1 register */
#define USB_DWC2_GHWCFG1 0x0044UL
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/uhc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers/usb/common/)

zephyr_library_sources(uhc_common.c)
zephyr_library_sources_ifdef(CONFIG_UHC_DWC2 uhc_dwc2.c)
zephyr_library_sources_ifdef(CONFIG_UHC_MAX3421E uhc_max3421e.c)
zephyr_library_sources_ifdef(CONFIG_UHC_VIRTUAL uhc_virtual.c)
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_EHCI uhc_mcux_common.c uhc_mcux_ehci.c)
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/uhc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module = UHC_DRIVER
module-str = uhc drv
source "subsys/logging/Kconfig.template.log_config"

source "drivers/usb/uhc/Kconfig.dwc2"
source "drivers/usb/uhc/Kconfig.max3421e"
source "drivers/usb/uhc/Kconfig.virtual"
source "drivers/usb/uhc/Kconfig.mcux"
Expand Down
91 changes: 91 additions & 0 deletions drivers/usb/uhc/Kconfig.dwc2
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Copyright (c) 2026 Roman Leonov <jam_roma@yahoo.com>
# SPDX-License-Identifier: Apache-2.0

config UHC_DWC2
bool "DWC2 USB host controller driver"
depends on DT_HAS_SNPS_DWC2_ENABLED
default y
select EVENTS
select REGULATOR
help
DWC2 USB host controller driver.

if UHC_DWC2
config UHC_DWC2_MAX_CHANNELS
int "UHC DWC2 driver maximum supported number of channels"
default 16
range 1 16
help
Number of channels driver can support.
Reduce this value to save memory.
Increase to support more concurrent transfers.

config UHC_DWC2_STACK_SIZE
int "UHC DWC2 driver thread stack size"
default 512
help
DWC2 driver thread stack size.

config UHC_DWC2_THREAD_PRIORITY
int "UHC DWC2 driver thread priority"
default 8
help
DWC2 driver thread priority.

config UHC_DWC2_DEBOUNCE_DELAY_MS
int "Debounce delay in ms"
default 250
help
On connection of a USB device, the USB 2.0 specification requires
a "debounce interval with a minimum duration of 100ms" to allow the connection to stabilize
(see USB 2.0 chapter 7.1.7.3 for more details).
During the debounce interval, no new connection/disconnection events are registered.

The default value is set to 250 ms to be safe.

config UHC_DWC2_RESET_HOLD_MS
int "Reset hold in ms"
default 30
help
The reset signaling can be generated on any Hub or Host Controller port by request from
the USB System Software. The USB 2.0 specification requires that "the reset signaling must
be driven for a minimum of 10ms" (see USB 2.0 chapter 7.1.7.5 for more details).
After the reset, the hub port will transition to the Enabled state (refer to Section 11.5).

The default value is set to 30 ms to be safe.

config UHC_DWC2_RESET_RECOVERY_MS
int "Reset recovery delay in ms"
default 30
help
After a port stops driving the reset signal, the USB 2.0 specification requires that
the "USB System Software guarantees a minimum of 10 ms for reset recovery" before the
attached device is expected to respond to data transfers (see USB 2.0 chapter 7.1.7.3 for
more details).
The device may ignore any data transfers during the recovery interval.

The default value is set to 30 ms to be safe.


config UHC_DWC2_SET_ADDR_DELAY_MS
int "Delay after set device address"
default 10
help
"After successful completion of the Status stage, the device is allowed a SetAddress()
recovery interval of 2 ms. At the end of this interval, the device must be able to accept
Setup packets addressed to the new address. Also, at the end of the recovery interval, the
device must not respond to tokens sent to the old address (unless, of course, the old and new
address is the same)." See USB 2.0 chapter 9.2.6.3 for more details.

The default value is set to 10 ms to be safe.

config UHC_DWC2_USBHS_VBUS_READY_TIMEOUT
int "USBHS VBUS ready event timeout in ms"
depends on SOC_SERIES_NRF54L
default 0
help
VBUS ready event timeout for the USBHS variant of DWC2 found on nRF MCUs.
If the VBUS is not ready and the Nordic USBHS controller is used, the udc_enable() is
blocked for this amount of time. Set it to zero to wait forever.

endif # UHC_DWC2
Loading
Loading