Skip to content
Merged
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/nxp/frdm_k22f/frdm_k22f.dts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ zephyr_udc0: &usbotg {
num-bidir-endpoints = <8>;
};

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

&gpioa {
status = "okay";
};
Expand Down
18 changes: 18 additions & 0 deletions boards/nxp/lpcxpresso55s28/lpcxpresso55s28-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,22 @@
};
};

pinmux_usbhfs: pinmux_usbhfs {
group0 {
pinmux = <USB0_VBUS_PIO0_22>,
<USB0_OVERCURRENTN_PIO0_28>,
<USB0_PORTPWRN_PIO1_12>;
bias-pull-up;
slew-rate = "standard";
};
};

pinmux_usbhhs: pinmux_usbhhs {
group0 {
pinmux = <USB1_OVERCURRENTN_PIO1_30>,
<USB1_PORTPWRN_PIO1_29>;
bias-pull-up;
slew-rate = "standard";
};
};
};
20 changes: 20 additions & 0 deletions boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,23 @@
zephyr_udc0: &usbhs {
status = "okay";
};

zephyr_uhc0: &usbhfs {
pinctrl-0 = <&pinmux_usbhfs>;
pinctrl-names = "default";
status = "okay";
};

zephyr_uhc1: &usbhhs {
pinctrl-0 = <&pinmux_usbhhs>;
pinctrl-names = "default";
status = "okay";
phy_handle = <&usbphy1>;
};

&usbphy1 {
status = "okay";
tx-d-cal = <5>;
tx-cal-45-dp-ohms = <10>;
tx-cal-45-dm-ohms = <10>;
};
21 changes: 20 additions & 1 deletion boards/nxp/lpcxpresso55s69/lpcxpresso55s69-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* NOTE: File generated by gen_board_pinctrl.py
* from LPCXpresso55S69.mex
*
* Copyright 2022 NXP
* Copyright 2022,2024 NXP
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -108,4 +108,23 @@
slew-rate = "standard";
};
};

pinmux_usbhfs: pinmux_usbhfs {
group0 {
pinmux = <USB0_VBUS_PIO0_22>,
<USB0_OVERCURRENTN_PIO0_28>,
<USB0_PORTPWRN_PIO1_12>;
bias-pull-up;
slew-rate = "standard";
};
};

pinmux_usbhhs: pinmux_usbhhs {
group0 {
pinmux = <USB1_OVERCURRENTN_PIO1_30>,
<USB1_PORTPWRN_PIO1_29>;
bias-pull-up;
slew-rate = "standard";
};
};
};
13 changes: 13 additions & 0 deletions boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,19 @@ zephyr_udc0: &usbhs {
phy-handle = <&usbphy1>;
};

zephyr_uhc0: &usbhfs {
pinctrl-0 = <&pinmux_usbhfs>;
pinctrl-names = "default";
status = "okay";
};

zephyr_uhc1: &usbhhs {
pinctrl-0 = <&pinmux_usbhhs>;
pinctrl-names = "default";
status = "okay";
phy_handle = <&usbphy1>;
};

&usbphy1 {
status = "okay";
tx-d-cal = <5>;
Expand Down
24 changes: 24 additions & 0 deletions boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,30 @@ zephyr_udc0: &usb1 {
status = "okay";
};

zephyr_uhc0: &usbh1 {
status = "okay";
phy_handle = <&usbphy1>;
};

zephyr_uhc1: &usbh2 {
status = "okay";
phy_handle = <&usbphy2>;
};

&usbphy1 {
status = "okay";
tx-d-cal = <12>;
tx-cal-45-dp-ohms = <6>;
tx-cal-45-dm-ohms = <6>;
};

&usbphy2 {
status = "okay";
tx-d-cal = <12>;
tx-cal-45-dp-ohms = <6>;
tx-cal-45-dm-ohms = <6>;
};

&usdhc1 {
status = "okay";
pwr-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
Expand Down
17 changes: 17 additions & 0 deletions boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,30 @@ zephyr_udc0: &usb1 {
phy-handle = <&usbphy1>;
};

zephyr_uhc0: &usbh1 {
status = "okay";
phy_handle = <&usbphy1>;
};

zephyr_uhc1: &usbh2 {
status = "okay";
phy_handle = <&usbphy2>;
};

&usbphy1 {
status = "okay";
tx-d-cal = <12>;
tx-cal-45-dp-ohms = <6>;
tx-cal-45-dm-ohms = <6>;
};

&usbphy2 {
status = "okay";
tx-d-cal = <12>;
tx-cal-45-dp-ohms = <6>;
tx-cal-45-dm-ohms = <6>;
};

&csi {
pinctrl-0 = <&pinmux_csi>;
pinctrl-names = "default";
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/udc/Kconfig.kinetis
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ config UDC_KINETIS
imply UDC_WORKQUEUE
default y
depends on DT_HAS_NXP_KINETIS_USBD_ENABLED
select DYNAMIC_INTERRUPTS if UHC_NXP_KHCI
help
Kinetis USB device controller criver.

Expand Down
1 change: 1 addition & 0 deletions drivers/usb/udc/Kconfig.mcux
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ config UDC_NXP_EHCI
select UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
select PINCTRL
select NOCACHE_MEMORY if CPU_HAS_DCACHE
select DYNAMIC_INTERRUPTS if UHC_NXP_EHCI
imply UDC_BUF_FORCE_NOCACHE
imply UDC_WORKQUEUE
help
Expand Down
15 changes: 10 additions & 5 deletions drivers/usb/udc/udc_kinetis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,14 +1154,19 @@ static const struct udc_api usbfsotg_api = {
.unlock = usbfsotg_unlock,
};

#define USBFSOTG_IRQ_DEFINE_OR(n) \
COND_CODE_1(CONFIG_UHC_NXP_KHCI, \
(irq_connect_dynamic(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), \
(void (*)(const void *))usbfsotg_isr_handler, \
DEVICE_DT_INST_GET(n), 0)), \
(IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), \
usbfsotg_isr_handler, \
DEVICE_DT_INST_GET(n), 0)))

#define USBFSOTG_DEVICE_DEFINE(n) \
static void udc_irq_enable_func##n(const struct device *dev) \
{ \
IRQ_CONNECT(DT_INST_IRQN(n), \
DT_INST_IRQ(n, priority), \
usbfsotg_isr_handler, \
DEVICE_DT_INST_GET(n), 0); \
\
USBFSOTG_IRQ_DEFINE_OR(n); \
irq_enable(DT_INST_IRQN(n)); \
} \
\
Expand Down
14 changes: 9 additions & 5 deletions drivers/usb/udc/udc_mcux_ehci.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,16 +868,20 @@ static usb_phy_config_struct_t phy_config_##n = { \
COND_CODE_1(DT_NODE_HAS_PROP(DT_DRV_INST(n), phy_handle), \
(&phy_config_##n), (NULL))

#define UDC_MCUX_EHCI_IRQ_DEFINE_OR(n) \
COND_CODE_1(CONFIG_UHC_NXP_EHCI, \
(irq_connect_dynamic(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), \
(void (*)(const void *))udc_mcux_isr, \
DEVICE_DT_INST_GET(n), 0)), \
(IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), udc_mcux_isr, \
DEVICE_DT_INST_GET(n), 0)))

#define USB_MCUX_EHCI_DEVICE_DEFINE(n) \
UDC_MCUX_PHY_DEFINE_OR(n); \
\
static void udc_irq_enable_func##n(const struct device *dev) \
{ \
IRQ_CONNECT(DT_INST_IRQN(n), \
DT_INST_IRQ(n, priority), \
udc_mcux_isr, \
DEVICE_DT_INST_GET(n), 0); \
\
UDC_MCUX_EHCI_IRQ_DEFINE_OR(n); \
irq_enable(DT_INST_IRQN(n)); \
} \
\
Expand Down
5 changes: 5 additions & 0 deletions drivers/usb/uhc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Copyright (c) 2022 Nordic Semiconductor
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources(uhc_common.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)
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_KHCI uhc_mcux_common.c uhc_mcux_khci.c)
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_OHCI uhc_mcux_common.c uhc_mcux_ohci.c)
zephyr_library_sources_ifdef(CONFIG_UHC_NXP_IP3516HS uhc_mcux_common.c uhc_mcux_ip3516hs.c)
1 change: 1 addition & 0 deletions drivers/usb/uhc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ source "subsys/logging/Kconfig.template.log_config"

source "drivers/usb/uhc/Kconfig.max3421e"
source "drivers/usb/uhc/Kconfig.virtual"
source "drivers/usb/uhc/Kconfig.mcux"

endif # UHC_DRIVER
47 changes: 47 additions & 0 deletions drivers/usb/uhc/Kconfig.mcux
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

config UHC_NXP_EHCI
bool "NXP MCUX USB EHCI Host controller driver"
default y
depends on DT_HAS_NXP_UHC_EHCI_ENABLED
select EVENTS
select NOCACHE_MEMORY if CPU_HAS_DCACHE
select DYNAMIC_INTERRUPTS if UDC_NXP_EHCI
help
NXP MCUX USB Host Controller Driver for EHCI.

config UHC_NXP_KHCI
bool "NXP MCUX USB KHCI Host controller driver"
default y
depends on DT_HAS_NXP_UHC_KHCI_ENABLED
select EVENTS
select DYNAMIC_INTERRUPTS if UDC_KINETIS
help
NXP MCUX USB Host Controller Driver for KHCI.

config UHC_NXP_IP3516HS
bool "NXP MCUX USB IP3516HS Host controller driver"
default y
depends on DT_HAS_NXP_UHC_IP3516HS_ENABLED
select EVENTS
help
NXP MCUX USB Host Controller Driver for ip3516hs.

config UHC_NXP_OHCI
bool "NXP MCUX USB IP3516HS Host controller driver"
default y
depends on DT_HAS_NXP_UHC_OHCI_ENABLED
select EVENTS
help
NXP MCUX USB Host Controller Driver for ohci.

config HEAP_MEM_POOL_ADD_SIZE_UHC_MCUX
int "The heap that NXP hal usb host controller drivers need"
default 4096

config UHC_NXP_THREAD_STACK_SIZE
int "MCUX UHC Driver internal thread stack size"
default 2048
help
Size of the stack used in the driver.
Loading