| # Copyright (c) 2025 Ambiq Micro Inc. <www.ambiq.com> |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| menu "MSPI flash device driver" |
| |
| config FLASH_MSPI |
| bool |
| select FLASH_HAS_DRIVER_ENABLED |
| select MSPI |
| help |
| MSPI flash drivers are enabled. |
| |
| config FLASH_MSPI_EMUL_DEVICE |
| bool "MSPI flash device emulator" |
| default y |
| depends on DT_HAS_ZEPHYR_EMUL_FLASH_ENABLED |
| depends on $(dt_compat_on_bus,$(DT_COMPAT_ZEPHYR_EMUL_FLASH),mspi) |
| select FLASH_MSPI |
| select FLASH_HAS_PAGE_LAYOUT |
| select FLASH_HAS_EXPLICIT_ERASE |
| |
| config FLASH_MSPI_ATXP032 |
| bool "MSPI ATXP032 driver" |
| default y |
| depends on DT_HAS_ATXP032_ENABLED |
| depends on $(dt_compat_on_bus,$(DT_COMPAT_ATXP032),mspi) |
| select FLASH_MSPI |
| select FLASH_HAS_PAGE_LAYOUT |
| select FLASH_HAS_EXPLICIT_ERASE |
| select FLASH_JESD216 |
| select MSPI_AMBIQ_CONTROLLER if SOC_FAMILY_AMBIQ |
| |
| config FLASH_MSPI_IS25XX0XX |
| bool "MSPI IS25L/WX064/032 driver" |
| default y |
| depends on DT_HAS_IS25XX0XX_ENABLED |
| depends on $(dt_compat_on_bus,$(DT_COMPAT_IS25XX0XX),mspi) |
| select FLASH_MSPI |
| select FLASH_HAS_PAGE_LAYOUT |
| select FLASH_HAS_EXPLICIT_ERASE |
| select FLASH_JESD216 |
| select MSPI_AMBIQ_CONTROLLER if SOC_FAMILY_AMBIQ |
| |
| menuconfig FLASH_MSPI_NOR |
| bool "Generic MSPI NOR Flash" |
| default y |
| depends on DT_HAS_JEDEC_NOR_ENABLED |
| depends on $(dt_compat_on_bus,$(DT_COMPAT_JEDEC_NOR),mspi) |
| select FLASH_MSPI |
| select FLASH_HAS_EXPLICIT_ERASE |
| select FLASH_JESD216 |
| select FLASH_HAS_PAGE_LAYOUT |
| select GPIO if $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_NOR),reset-gpios) || \ |
| $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_NOR),supply-gpios) |
| |
| if FLASH_MSPI_NOR |
| |
| config FLASH_MSPI_NOR_USE_SFDP |
| bool "Use Serial Flash Discoverable Parameters (SFDP)" |
| default $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_NOR),sfdp-bfp) |
| help |
| Use information from SFDP for setting up flash command transfers |
| and for configuring the flash chip. |
| |
| Currently, only build time processing of SFDP structures is supported, |
| based on dts arrays provided as flash node properties like `sfdp-bfp`, |
| `sfdp-ff05`, and `sfdp-ff84`. Depending on the IO mode used, some or |
| all of these properties are required for building the flash driver. |
| Data for these properties can be obtained with the `drivers/jesd216` |
| sample. If a given SFDP table is not available in a flash chip, |
| the related property can be defined as an empty array - this will |
| prevent a related build assertion from failing and default values |
| will be assigned to parameters that would otherwise be read from |
| that SFDP table. |
| |
| config FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE |
| int "Page size to use for FLASH_LAYOUT feature" |
| depends on FLASH_PAGE_LAYOUT |
| default 65536 |
| help |
| When CONFIG_FLASH_PAGE_LAYOUT is used, this driver will support that |
| API. By default the page size corresponds to the block size (65536). |
| Other options include the 32K-byte erase size (32768), the sector |
| size (4096), or any non-zero multiple of the sector size. |
| |
| config FLASH_MSPI_NOR_ACTIVE_DWELL_MS |
| int "Dwell period (ms) after last use to stay in active mode" |
| depends on PM_DEVICE_RUNTIME |
| default 10 |
| help |
| Flash accesses commonly occur in bursts, where entering and exiting DPD |
| mode between each access adds significantly to the total operation time. |
| This option controls how long to remain in active mode after each API |
| call, eliminating the active->idle->active transition sequence if another |
| transaction occurs before the dwell period expires. |
| |
| config FLASH_MSPI_NOR_DMA_DATA_XFER |
| bool "Use DMA for Flash MSPI NOR data transfers" |
| depends on MSPI_DMA |
| default y |
| help |
| Transfer mode for MSPI read/write data transactions. Since read/write tends |
| to involve larger data transfers, it is generally recommended to use MSPI_DMA |
| to reduce CPU load and improve throughput. Will default to MSPI_DMA if |
| CONFIG_MSPI_DMA is enabled, otherwise it will default to MSPI_PIO. |
| |
| config FLASH_MSPI_NOR_DMA_CONTROL_XFER |
| bool "Use DMA for Flash MSPI NOR control transfers" |
| depends on MSPI_DMA |
| default n |
| help |
| Transfer mode for register reads/writes and command MSPI transactions. |
| Since these are shorter transfers, it is generally recommended to use MSPI_PIO |
| (programmed I/O) due to there being less overhead compared to setting up a |
| DMA transfer. |
| |
| endif # FLASH_MSPI_NOR |
| |
| endmenu |
| |
| if FLASH_MSPI |
| |
| config FLASH_MSPI_HANDLE_CACHE |
| bool "Turn on cache handling in flash peripheral drivers" |
| default y |
| depends on CACHE_MANAGEMENT && DCACHE |
| help |
| Disable this if cache has been handled in upper layers. |
| |
| config FLASH_MSPI_RANGE_HANDLE_CACHE_SIZE |
| int "Threshold to do cache handling by range or in full, size in bytes" |
| default 0 |
| help |
| If size is larger than this number, it is uneconomical to handle cache in range. |
| However, this is a number by experience and could be platform specific. |
| |
| config FLASH_MSPI_MEMMAP_READ |
| bool "Turn on memory mapped read in flash_read" |
| depends on MSPI_MEMMAP |
| help |
| Enable this for those controllers that support memory mapping the |
| device and wish to flash_read through the memory mapped region. |
| |
| endif # FLASH_MSPI |