Skip to content

Commit d49c7e7

Browse files
drivers: flash: import flash_mspi_nor driver from upstream
Import flash_mspi_nor driver from upstream, based on PR: zephyrproject-rtos/zephyr#85520 This driver has been heavily patched to enable runtime JEDEC ID probing. Once the PR merges, these changes will be sent upstream. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent 7ba4438 commit d49c7e7

File tree

8 files changed

+1706
-0
lines changed

8 files changed

+1706
-0
lines changed

drivers/flash/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ zephyr_library_amend()
55
zephyr_library_include_directories("${ZEPHYR_BASE}/drivers/flash")
66

77
# zephyr-keep-sorted-start
8+
zephyr_library_sources_ifdef(CONFIG_FLASH_MSPI_NOR flash_mspi_nor.c)
9+
zephyr_library_sources_ifdef(CONFIG_FLASH_MSPI_NOR flash_mspi_nor_devs.c)
810
zephyr_library_sources_ifdef(CONFIG_FLASH_SPI_DW spi_dw_flash.c)
911
# zephyr-keep-sorted-stop
1012

drivers/flash/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if FLASH
66
menu "Flash drivers"
77

88
# zephyr-keep-sorted-start
9+
rsource "Kconfig.mspi"
910
rsource "Kconfig.spi_dw"
1011
# zephyr-keep-sorted-stop
1112

drivers/flash/Kconfig.mspi

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2024 Ambiq Micro Inc. <www.ambiq.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
menu "MSPI flash device driver"
5+
6+
menuconfig FLASH_MSPI_NOR
7+
bool "Generic MSPI NOR Flash"
8+
default y
9+
depends on DT_HAS_JEDEC_MSPI_NOR_ENABLED
10+
select FLASH_MSPI
11+
select FLASH_HAS_EXPLICIT_ERASE
12+
select FLASH_HAS_PAGE_LAYOUT
13+
select FLASH_JESD216
14+
select GPIO if $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_MSPI_NOR),reset-gpios)
15+
16+
if FLASH_MSPI_NOR
17+
18+
config FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE
19+
int "Page size to use for FLASH_LAYOUT feature"
20+
depends on FLASH_PAGE_LAYOUT
21+
default 65536
22+
help
23+
When CONFIG_FLASH_PAGE_LAYOUT is used, this driver will support that
24+
API. By default the page size corresponds to the block size (65536).
25+
Other options include the 32K-byte erase size (32768), the sector
26+
size (4096), or any non-zero multiple of the sector size.
27+
28+
config FLASH_MSPI_NOR_RUNTIME_PROBE
29+
bool "Probe flash details at runtime"
30+
help
31+
If enabled, the driver will probe the flash device's JEDEC ID at
32+
runtime, and used that to determine the command set and flash size.
33+
34+
endif # FLASH_MSPI_NOR
35+
36+
endmenu

0 commit comments

Comments
 (0)