1# Flash driver configuration options
2
3# Copyright (c) 2016 Intel Corporation
4# SPDX-License-Identifier: Apache-2.0
5
6#
7# Flash driver
8#
9config FLASH_HAS_DRIVER_ENABLED
10	bool
11	help
12	  This option is enabled when any flash driver is enabled.
13
14config FLASH_HAS_EX_OP
15	bool
16	help
17	  This option is selected by drivers that support flash extended
18	  operations.
19
20config FLASH_HAS_EXPLICIT_ERASE
21	bool
22	help
23	  Device does not do erase-on-write (erase-on-program, auto-erase
24	  on write) and requires explicit erase procedure to be programmed
25	  with random value, in place where it has already been programmed with
26	  some other value, as program can only change bits from erased-value
27	  to the opposite.
28	  All pure Flash devices are evolution of EEPROM where erase has
29	  been separated from write, EEPROM has erase-on-write, giving
30	  it advantage of higher write speeds at a cost of larger erase block.
31	  Note that explicit-erase capability does not warrants that
32	  write without erase is not allowed, taking the above restrictions,
33	  it only states that write of a random information will require
34	  erase.
35	  Erase is usually performed in pages, as we have chosen to name
36	  the unit in Zephyr, that may have different naming in device
37	  specifications, like pages, sectors or blocks, and may vary
38	  in size, depending how they are named by vendor.
39	  This option should be selected by drivers that serve devices with
40	  such characteristic and is used and may be used by users to provide
41	  paths in code that only serve such devices, and could be
42	  optimized-out by compiler in case where there is no such device in
43	  a system.
44
45config FLASH_HAS_NO_EXPLICIT_ERASE
46	bool
47	help
48	  Device does not require explicit erase before programming
49	  a new random value at any location that has been previously
50	  programmed with some other value.
51	  Note that the device may have erase-on-write (auto-erase),
52	  as for example in EEPROM devices, but may also have no erase
53	  at all.
54	  A device driver may still provide erase callback,
55	  especially if it is able to perform erase to accelerate
56	  further writes or is able to fill the area requested for
57	  erase, with single value, faster than consecutive writes
58	  that would be used to emulate erase.
59	  This option should be selected by drivers that serve
60	  devices with such characteristic and is used and may be
61	  used by users to provide paths in code that only serve
62	  such devices, and could be optimized-out by compiler in
63	  case where there is no such device in a system.
64	  This option should be selected for any device that
65	  can change storage bits, by write, from any value to opposite
66	  value at any time.
67	  When your driver sets this option you also need to set
68	  no_explicit_erase capability in your drivers flash_parameters.
69
70config FLASH_HAS_PAGE_LAYOUT
71	bool
72	help
73	  This option is enabled when the SoC flash driver supports
74	  retrieving the layout of flash memory pages.
75
76config FLASH_JESD216
77	bool
78	help
79	 Selected by drivers that support JESD216-compatible flash
80	 devices to enable building a common support module.
81
82menuconfig FLASH
83	bool "Flash drivers"
84	help
85	  Enable support for the flash hardware.
86
87if FLASH
88
89config FLASH_JESD216_API
90	bool "Provide API to read JESD216 flash parameters"
91	depends on FLASH_JESD216
92	help
93	  This option extends the Zephyr flash API with the ability
94	  to access the Serial Flash Discoverable Parameter section
95	  allowing runtime determination of serial flash parameters
96	  for flash drivers that expose this capability.
97
98config FLASH_SHELL
99	bool "Flash shell"
100	depends on SHELL && FLASH_PAGE_LAYOUT
101	select MPU_ALLOW_FLASH_WRITE if ARM_MPU
102	help
103	  Enable the flash shell with flash related commands such as test,
104	  write, read and erase.
105
106if FLASH_SHELL
107
108config FLASH_SHELL_TEST_COMMANDS
109	bool "Flash read/write/erase test commands"
110	select CBPRINTF_FP_SUPPORT
111	help
112	  Enable additional flash shell commands for performing
113	  read/write/erase tests with speed output.
114
115config FLASH_SHELL_BUFFER_SIZE
116	hex "Flash shell buffer size"
117	default 0x4000 if FLASH_SHELL_TEST_COMMANDS
118	default 0x1000
119	range 0x400 0x1000000
120	help
121	  Size of the buffer used for flash commands, will determine the
122	  maximum size that can be used with a read/write test.
123
124endif # FLASH_SHELL
125
126config FLASH_FILL_BUFFER_SIZE
127	int "Buffer size of flash_fill function"
128	default 32
129	help
130	  Size of a buffer used by flash_fill function to fill a device with
131	  specific value; this buffer is allocated on stack.
132	  The buffer is needed as most devices have write-block alignment
133	  requirements that which imposes minimal size of data, which can
134	  be written to a device, and alignment of write offset.
135	  Even if device does not have such requirement, filling device by
136	  single bytes is not efficient.
137	  Value selected here should be a multiple of the largest write-block-size
138	  among all the memory devices used in system.
139
140if FLASH_HAS_PAGE_LAYOUT
141
142config FLASH_PAGE_LAYOUT
143	bool "API for retrieving the layout of pages"
144	default FLASH_HAS_PAGE_LAYOUT
145	help
146	  Enables API for retrieving the layout of flash memory pages.
147
148endif
149
150config FLASH_EX_OP_ENABLED
151	bool "API for extended flash operations"
152	depends on FLASH_HAS_EX_OP
153	default n
154	help
155	  Enables flash extended operations API. It can be used to perform
156	  non-standard operations e.g. manipulating flash protection.
157
158config FLASH_INIT_PRIORITY
159	int "Flash init priority"
160	default KERNEL_INIT_PRIORITY_DEVICE
161	help
162	  Flash driver device initialization priority. This initialization
163	  priority is used unless the driver implementation has its own
164	  initialization priority
165
166# zephyr-keep-sorted-start
167source "drivers/flash/Kconfig.ambiq"
168source "drivers/flash/Kconfig.andes"
169source "drivers/flash/Kconfig.at45"
170source "drivers/flash/Kconfig.b91"
171source "drivers/flash/Kconfig.cadence_nand"
172source "drivers/flash/Kconfig.cadence_qspi_nor"
173source "drivers/flash/Kconfig.cc13xx_cc26xx"
174source "drivers/flash/Kconfig.esp32"
175source "drivers/flash/Kconfig.gd32"
176source "drivers/flash/Kconfig.gecko"
177source "drivers/flash/Kconfig.ifx_cat1"
178source "drivers/flash/Kconfig.it8xxx2"
179source "drivers/flash/Kconfig.lpc"
180source "drivers/flash/Kconfig.max32"
181source "drivers/flash/Kconfig.mcux"
182source "drivers/flash/Kconfig.mspi"
183source "drivers/flash/Kconfig.nios2_qspi"
184source "drivers/flash/Kconfig.nor"
185source "drivers/flash/Kconfig.nordic_qspi_nor"
186source "drivers/flash/Kconfig.npcx_fiu"
187source "drivers/flash/Kconfig.nrf"
188source "drivers/flash/Kconfig.nrf_mram"
189source "drivers/flash/Kconfig.nrf_rram"
190source "drivers/flash/Kconfig.numaker"
191source "drivers/flash/Kconfig.numaker_rmc"
192source "drivers/flash/Kconfig.nxp_s32"
193source "drivers/flash/Kconfig.renesas_ra"
194source "drivers/flash/Kconfig.rpi_pico"
195source "drivers/flash/Kconfig.rv32m1"
196source "drivers/flash/Kconfig.sam"
197source "drivers/flash/Kconfig.sam0"
198source "drivers/flash/Kconfig.si32"
199source "drivers/flash/Kconfig.simulator"
200source "drivers/flash/Kconfig.smartbond"
201source "drivers/flash/Kconfig.stm32"
202source "drivers/flash/Kconfig.stm32_ospi"
203source "drivers/flash/Kconfig.stm32_qspi"
204source "drivers/flash/Kconfig.stm32_xspi"
205source "drivers/flash/Kconfig.xmc4xxx"
206# zephyr-keep-sorted-stop
207
208module = FLASH
209module-str = flash
210source "subsys/logging/Kconfig.template.log_config"
211
212endif # FLASH
213