1# SPDX-License-Identifier: Apache-2.0
2
3config SOC_FLASH_MCUX
4	bool "MCUX flash shim driver"
5	default y
6	depends on DT_HAS_NXP_KINETIS_FTFA_ENABLED || \
7		   DT_HAS_NXP_KINETIS_FTFE_ENABLED || \
8		   DT_HAS_NXP_KINETIS_FTFL_ENABLED || \
9		   DT_HAS_NXP_IAP_FMC55_ENABLED || \
10		   DT_HAS_NXP_IAP_FMC553_ENABLED || \
11		   DT_HAS_NXP_MSF1_ENABLED
12	select FLASH_HAS_PAGE_LAYOUT
13	select FLASH_HAS_DRIVER_ENABLED
14	select FLASH_HAS_EXPLICIT_ERASE
15	select MPU_ALLOW_FLASH_WRITE if ARM_MPU
16	help
17	  Enables the MCUX flash shim driver.
18	  WARNING: This driver will disable the system interrupts for
19	  the duration of the flash erase/write operations. This will
20	  have an impact on the overall system performance - whether
21	  this is acceptable or not will depend on the use case.
22
23if SOC_FLASH_MCUX
24
25config CHECK_BEFORE_READING
26	bool "Verify area before reading it"
27	default y if SOC_SERIES_LPC55XXX
28	help
29	  Do a margin check flash command before reading an area.
30	  This feature prevents erroneous/forbidden reading. Some ECC enabled
31	  devices will crash when reading an erased or wrongly programmed area.
32
33config MCUX_FLASH_K4_API
34	bool
35	help
36	  Set from SOC level configuration if the platform is meant to use the
37	  flash_k4 SDK IAP API.
38
39endif # SOC_FLASH_MCUX
40
41if DT_HAS_NXP_IMX_FLEXSPI_ENABLED
42
43menu "Flexspi flash driver"
44
45config FLASH_MCUX_FLEXSPI_NOR
46	bool "MCUX FlexSPI NOR driver"
47	default y
48	depends on DT_HAS_NXP_IMX_FLEXSPI_NOR_ENABLED
49	select FLASH_HAS_PAGE_LAYOUT
50	select FLASH_HAS_DRIVER_ENABLED
51	select FLASH_HAS_EXPLICIT_ERASE
52	select FLASH_JESD216
53	select MEMC
54	select MEMC_MCUX_FLEXSPI
55
56config FLASH_MCUX_FLEXSPI_MX25UM51345G
57	bool "MCUX FlexSPI MX25UM51345G driver"
58	default y
59	depends on DT_HAS_NXP_IMX_FLEXSPI_MX25UM51345G_ENABLED
60	select FLASH_HAS_PAGE_LAYOUT
61	select FLASH_HAS_DRIVER_ENABLED
62	select FLASH_HAS_EXPLICIT_ERASE
63	select MEMC
64	select MEMC_MCUX_FLEXSPI
65
66config FLASH_MCUX_FLEXSPI_HYPERFLASH
67	bool "MCUX FlexSPI HYPERFLASH driver"
68	default y
69	depends on DT_HAS_NXP_IMX_FLEXSPI_HYPERFLASH_ENABLED
70	select FLASH_HAS_PAGE_LAYOUT
71	select FLASH_HAS_DRIVER_ENABLED
72	select FLASH_HAS_EXPLICIT_ERASE
73	select MEMC
74	select MEMC_MCUX_FLEXSPI
75
76endmenu
77
78if FLASH_MCUX_FLEXSPI_MX25UM51345G
79
80choice FLASH_MCUX_FLEXSPI_MX25UM51345G_OPI_MODE
81	prompt "FlexSPI MX25UM51345G OPI mode"
82	default FLASH_MCUX_FLEXSPI_MX25UM51345G_OPI_DTR
83	help
84	  Select the MX25UM51345G octal flash operation mode(Octal I/O STR
85	  or Octal I/O DTR).
86
87config FLASH_MCUX_FLEXSPI_MX25UM51345G_OPI_STR
88	bool "STR"
89
90config FLASH_MCUX_FLEXSPI_MX25UM51345G_OPI_DTR
91	bool "DTR"
92
93endchoice
94
95endif # FLASH_MCUX_FLEXSPI_MX25UM51345G
96
97config FLASH_MCUX_FLEXSPI_NOR_WRITE_BUFFER
98	bool "MCUX FlexSPI NOR write RAM buffer"
99	default y
100	depends on (FLASH_MCUX_FLEXSPI_NOR || FLASH_MCUX_FLEXSPI_MX25UM51345G)
101	help
102	  Copy the data to a RAM buffer before writing it to the flash.
103	  This prevents faults when the data to write would be located on the
104	  flash itself.
105
106config FLASH_MCUX_FLEXSPI_HYPERFLASH_WRITE_BUFFER
107	bool "MCUX FlexSPI HYPERFLASH write RAM buffer"
108	default y
109	depends on FLASH_MCUX_FLEXSPI_HYPERFLASH
110	help
111	  Copy the data to a RAM buffer before writing it to the flash.
112	  This prevents faults when the data to write would be located on the
113	  flash itself.
114
115# Avoid RWW hazards by defaulting logging to disabled
116choice FLASH_LOG_LEVEL_CHOICE
117	default FLASH_LOG_LEVEL_OFF if FLASH_MCUX_FLEXSPI_XIP
118endchoice
119
120endif # HAS_MCUX_FLEXSPI
121