Skip to content

Commit abfa945

Browse files
MarkWangChinesekartben
authored andcommitted
drivers: uhc: implement nxp mcux uhc driver
It is based on SDK USB Host controller driver. Support NXP EHCI, KHCI, OHCI and IP3516HS controllers. Signed-off-by: Mark Wang <yichang.wang@nxp.com>
1 parent 7bbb834 commit abfa945

File tree

13 files changed

+1830
-4
lines changed

13 files changed

+1830
-4
lines changed

drivers/usb/udc/Kconfig.mcux

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config UDC_NXP_EHCI
88
select UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
99
select PINCTRL
1010
select NOCACHE_MEMORY if CPU_HAS_DCACHE
11+
select DYNAMIC_INTERRUPTS
1112
imply UDC_BUF_FORCE_NOCACHE
1213
imply UDC_WORKQUEUE
1314
help

drivers/usb/udc/udc_mcux_ehci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,10 +873,10 @@ static usb_phy_config_struct_t phy_config_##n = { \
873873
\
874874
static void udc_irq_enable_func##n(const struct device *dev) \
875875
{ \
876-
IRQ_CONNECT(DT_INST_IRQN(n), \
877-
DT_INST_IRQ(n, priority), \
878-
udc_mcux_isr, \
879-
DEVICE_DT_INST_GET(n), 0); \
876+
irq_connect_dynamic(DT_INST_IRQN(n), \
877+
DT_INST_IRQ(n, priority), \
878+
(void (*)(const void *))udc_mcux_isr, \
879+
DEVICE_DT_INST_GET(n), 0); \
880880
\
881881
irq_enable(DT_INST_IRQN(n)); \
882882
} \

drivers/usb/uhc/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Copyright (c) 2022 Nordic Semiconductor
2+
# Copyright 2024 NXP
23
# SPDX-License-Identifier: Apache-2.0
34

45
zephyr_library()
56

67
zephyr_library_sources(uhc_common.c)
78
zephyr_library_sources_ifdef(CONFIG_UHC_MAX3421E uhc_max3421e.c)
89
zephyr_library_sources_ifdef(CONFIG_UHC_VIRTUAL uhc_virtual.c)
10+
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_EHCI uhc_mcux_common.c uhc_mcux_ehci.c)
11+
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_KHCI uhc_mcux_common.c uhc_mcux_khci.c)
12+
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_OHCI uhc_mcux_common.c uhc_mcux_ohci.c)
13+
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_IP3516HS uhc_mcux_common.c uhc_mcux_ip3516hs.c)

drivers/usb/uhc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ source "subsys/logging/Kconfig.template.log_config"
3838

3939
source "drivers/usb/uhc/Kconfig.max3421e"
4040
source "drivers/usb/uhc/Kconfig.virtual"
41+
source "drivers/usb/uhc/Kconfig.mcux"
4142

4243
endif # UHC_DRIVER

drivers/usb/uhc/Kconfig.mcux

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2024 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config UHC_NXP_EHCI
5+
bool "NXP MCUX USB EHCI Host controller driver"
6+
default y
7+
depends on DT_HAS_NXP_UHC_EHCI_ENABLED
8+
select EVENTS
9+
select NOCACHE_MEMORY if CPU_HAS_DCACHE
10+
select DYNAMIC_INTERRUPTS
11+
help
12+
NXP MCUX USB Host Controller Driver for EHCI.
13+
14+
config UHC_NXP_KHCI
15+
bool "NXP MCUX USB KHCI Host controller driver"
16+
default y
17+
depends on DT_HAS_NXP_UHC_KHCI_ENABLED
18+
select EVENTS
19+
help
20+
NXP MCUX USB Host Controller Driver for KHCI.
21+
22+
config UHC_NXP_IP3516HS
23+
bool "NXP MCUX USB IP3516HS Host controller driver"
24+
default y
25+
depends on DT_HAS_NXP_UHC_IP3516HS_ENABLED
26+
select EVENTS
27+
help
28+
NXP MCUX USB Host Controller Driver for ip3516hs.
29+
30+
config UHC_NXP_OHCI
31+
bool "NXP MCUX USB IP3516HS Host controller driver"
32+
default y
33+
depends on DT_HAS_NXP_UHC_OHCI_ENABLED
34+
select EVENTS
35+
help
36+
NXP MCUX USB Host Controller Driver for ohci.
37+
38+
config HEAP_MEM_POOL_ADD_SIZE_UHC_MCUX
39+
int "The heap that NXP hal usb host controller drivers need"
40+
default 4096
41+
42+
config UHC_NXP_THREAD_STACK_SIZE
43+
int "MCUX UHC Driver internal thread stack size"
44+
default 2048
45+
help
46+
Size of the stack used in the driver.

0 commit comments

Comments
 (0)