Skip to content

Commit f72f462

Browse files
committed
driver: usb: stm32: add partial host support
Implement uhc driver for STM32. This as only been tested on a nucleo-h723zg which USB core COMPAT is st_stm32_otghs. Adjustments will be necessary in order to support other STM32 parts with st_stm32_otghs/st_stm32_otgfs USB core. Parts with st_stm32_usb USB core are not supported yet. Only control transfers are implemented. Support for bulk transfers have also been added but hasn't been fully tested due to the lack of a proper way to do so. Signed-off-by: Johan Lafon <[email protected]>
1 parent cb811ac commit f72f462

File tree

4 files changed

+1628
-0
lines changed

4 files changed

+1628
-0
lines changed

drivers/usb/uhc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ zephyr_library()
55

66
zephyr_library_sources(uhc_common.c)
77
zephyr_library_sources_ifdef(CONFIG_UHC_MAX3421E uhc_max3421e.c)
8+
zephyr_library_sources_ifdef(CONFIG_UHC_STM32 uhc_stm32.c)
89
zephyr_library_sources_ifdef(CONFIG_UHC_VIRTUAL uhc_virtual.c)

drivers/usb/uhc/Kconfig

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

3939
source "drivers/usb/uhc/Kconfig.max3421e"
40+
source "drivers/usb/uhc/Kconfig.stm32"
4041
source "drivers/usb/uhc/Kconfig.virtual"
4142

4243
endif # UHC_DRIVER

drivers/usb/uhc/Kconfig.stm32

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2024 Syslinbit SCOP SAS
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config UHC_STM32
5+
bool "STM32 USB host controller driver"
6+
default y
7+
depends on DT_HAS_ST_STM32_OTGFS_ENABLED \
8+
|| DT_HAS_ST_STM32_OTGHS_ENABLED \
9+
|| DT_HAS_ST_STM32_USB_ENABLED
10+
select USE_STM32_LL_USB
11+
select USE_STM32_HAL_HCD
12+
help
13+
STM32 USB host controller driver.
14+
15+
if UHC_STM32
16+
17+
config UHC_STM32_DRV_THREAD_STACK_SIZE
18+
int "Driver internal thread stack size"
19+
default 512
20+
help
21+
Size of the stack used in the STM32 USB host driver
22+
23+
endif #UHC_STM32

0 commit comments

Comments
 (0)