Skip to content

Commit cfffd60

Browse files
ExaltZephyrExaltZephyr
authored andcommitted
drivers: mspi: Support MSPI driver for STM32
This commit introduces support for the mspi and ospi drivers on STM32, enabling functionality APIs for MSPI/OSPI host controllers.. Signed-off-by: Sara Touqan <[email protected]> Signed-off-by: Sarah Younis <[email protected]> Signed-off-by: Mohammad Odeh <[email protected]>
1 parent 253f367 commit cfffd60

File tree

7 files changed

+4498
-0
lines changed

7 files changed

+4498
-0
lines changed

drivers/mspi/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ zephyr_library_sources_ifdef(CONFIG_MSPI_AMBIQ_AP5 mspi_ambiq_ap5.c)
88
zephyr_library_sources_ifdef(CONFIG_MSPI_AMBIQ_TIMING_SCAN mspi_ambiq_timing_scan.c)
99
zephyr_library_sources_ifdef(CONFIG_MSPI_DW mspi_dw.c)
1010
zephyr_library_sources_ifdef(CONFIG_MSPI_EMUL mspi_emul.c)
11+
zephyr_library_sources_ifdef(CONFIG_MSPI_STM32 mspi_stm32.c)
12+
zephyr_library_sources_ifdef(CONFIG_OSPI_STM32 ospi_stm32.c)
13+
zephyr_library_sources_ifdef(CONFIG_MSPI_STM32_QSPI mspi_stm32_qspi.c)

drivers/mspi/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ source "subsys/logging/Kconfig.template.log_config"
6262
source "drivers/mspi/Kconfig.ambiq"
6363
source "drivers/mspi/Kconfig.dw"
6464
source "drivers/mspi/Kconfig.mspi_emul"
65+
source "drivers/mspi/Kconfig.stm32"
6566

6667
endif # MSPI

drivers/mspi/Kconfig.stm32

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# STM32 MSPI flash driver configuration options
2+
3+
# Copyright (c) 2025 STMicroelectronics
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config MSPI_STM32
7+
bool "STM32 XSPI Controller driver"
8+
depends on DT_HAS_ST_STM32_MSPI_CONTROLLER_ENABLED
9+
select USE_STM32_HAL_XSPI
10+
select USE_STM32_LL_DLYB
11+
select DMA
12+
select USE_STM32_HAL_DMA
13+
select USE_STM32_HAL_DMA_EX
14+
imply MSPI_XIP
15+
default y
16+
help
17+
Enable driver for STM32 family of processors.
18+
19+
config MSPI_STM32_QSPI
20+
bool "STM32 QSPI Controller driver"
21+
default y
22+
depends on DT_HAS_ST_STM32_QSPI_CONTROLLER_ENABLED
23+
select USE_STM32_HAL_QSPI
24+
select USE_STM32_HAL_MDMA
25+
imply MSPI_XIP
26+
help
27+
Enable QSPI driver for STM32 family of processors.
28+
29+
#DT_STM32_OCTOSPI_HAS_DMA := $(dt_compat_any_has_prop,$(DT_COMPAT_ST_STM32_OSPI),dmas)
30+
31+
config OSPI_STM32
32+
bool "STM32 OSPI Controller driver"
33+
default y
34+
depends on DT_HAS_ST_STM32_OSPI_CONTROLLER_ENABLED
35+
select USE_STM32_HAL_OSPI if !SOC_SERIES_STM32H5X
36+
select USE_STM32_LL_DLYB if (SOC_SERIES_STM32H5X || SOC_SERIES_STM32U5X)
37+
select USE_STM32_HAL_MDMA if SOC_SERIES_STM32H7X
38+
select DMA
39+
select USE_STM32_HAL_DMA
40+
select USE_STM32_HAL_DMA_EX
41+
help
42+
Enable OSPI driver for STM32 family of processors.
43+
44+
config MSPI_BUFFER_ALIGNMENT
45+
int
46+
default 32
47+
help
48+
Some MSPI host controllers require alignment of their data buffers
49+
in order for DMA to work correctly. This represents the alignment
50+
of buffers required in bytes.

0 commit comments

Comments
 (0)