Skip to content

Commit f26fd50

Browse files
committed
drivers: usb: uhc_dwc2: Added uhc_dwc2 driver with vendor quirks
Signed-off-by: Roman Leonov <[email protected]>
1 parent 5fc41da commit f26fd50

File tree

6 files changed

+2969
-0
lines changed

6 files changed

+2969
-0
lines changed

drivers/usb/uhc/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
zephyr_library()
6+
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers/usb/common/)
67

78
zephyr_library_sources(uhc_common.c)
9+
zephyr_library_sources_ifdef(CONFIG_UHC_DWC2 uhc_dwc2.c)
810
zephyr_library_sources_ifdef(CONFIG_UHC_MAX3421E uhc_max3421e.c)
911
zephyr_library_sources_ifdef(CONFIG_UHC_VIRTUAL uhc_virtual.c)
1012
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_EHCI uhc_mcux_common.c uhc_mcux_ehci.c)

drivers/usb/uhc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module = UHC_DRIVER
3636
module-str = uhc drv
3737
source "subsys/logging/Kconfig.template.log_config"
3838

39+
source "drivers/usb/uhc/Kconfig.dwc2"
3940
source "drivers/usb/uhc/Kconfig.max3421e"
4041
source "drivers/usb/uhc/Kconfig.virtual"
4142
source "drivers/usb/uhc/Kconfig.mcux"

drivers/usb/uhc/Kconfig.dwc2

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config UHC_DWC2
5+
bool "UHC DWC2 USB device controller driver"
6+
default n
7+
depends on DT_HAS_SNPS_DWC2_ENABLED
8+
select EVENTS
9+
help
10+
DWC2 USB host controller driver.
11+
12+
config UHC_DWC2_DMA
13+
bool "UHC DWC2 USB DMA support"
14+
default n
15+
depends on UHC_DWC2
16+
help
17+
Enable Buffer DMA if DWC2 USB controller supports Internal DMA.
18+
19+
config UHC_DWC2_STACK_SIZE
20+
int "UHC DWC2 driver internal thread stack size"
21+
depends on UHC_DWC2
22+
default 512
23+
help
24+
DWC2 driver internal thread stack size.
25+
26+
config UHC_DWC2_THREAD_PRIORITY
27+
int "UDC DWC2 driver thread priority"
28+
depends on UHC_DWC2
29+
default 8
30+
help
31+
DWC2 driver thread priority.
32+
33+
menu "Root port configuration"
34+
35+
config UHC_DWC2_PORT_DEBOUNCE_DELAY_MS
36+
int "Debounce delay in ms"
37+
default 250
38+
help
39+
On connection of a USB device, the USB 2.0 specification requires
40+
a "debounce interval with a minimum duration of 100ms" to allow the connection to stabilize
41+
(see USB 2.0 chapter 7.1.7.3 for more details).
42+
During the debounce interval, no new connection/disconnection events are registered.
43+
44+
The default value is set to 250 ms to be safe.
45+
46+
config UHC_DWC2_PORT_RESET_HOLD_MS
47+
int "Reset hold in ms"
48+
default 30
49+
help
50+
The reset signaling can be generated on any Hub or Host Controller port by request from
51+
the USB System Software. The USB 2.0 specification requires that "the reset signaling must
52+
be driven for a minimum of 10ms" (see USB 2.0 chapter 7.1.7.5 for more details).
53+
After the reset, the hub port will transition to the Enabled state (refer to Section 11.5).
54+
55+
The default value is set to 30 ms to be safe.
56+
57+
config UHC_DWC2_PORT_RESET_RECOVERY_MS
58+
int "Reset recovery delay in ms"
59+
default 30
60+
help
61+
After a port stops driving the reset signal, the USB 2.0 specification requires that
62+
the "USB System Software guarantees a minimum of 10 ms for reset recovery" before the
63+
attached device is expected to respond to data transfers (see USB 2.0 chapter 7.1.7.3 for
64+
more details).
65+
The device may ignore any data transfers during the recovery interval.
66+
67+
The default value is set to 30 ms to be safe.
68+
69+
config UHC_DWC2_PORT_SET_ADDR_DELAY_MS
70+
int "Delay after SetAddress()"
71+
default 10
72+
help
73+
"After successful completion of the Status stage, the device is allowed a SetAddress()
74+
recovery interval of 2 ms. At the end of this interval, the device must be able to accept
75+
Setup packets addressed to the new address. Also, at the end of the recovery interval, the
76+
device must not respond to tokens sent to the old address (unless, of course, the old and new
77+
address is the same)." See USB 2.0 chapter 9.2.6.3 for more details.
78+
79+
The default value is set to 10 ms to be safe.
80+
81+
endmenu #Root Hub configuration

0 commit comments

Comments
 (0)