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	select TIMING_FUNCTIONS
112	help
113	  Enable additional flash shell commands for performing
114	  read/write/erase tests with speed output.
115
116config FLASH_SHELL_BUFFER_SIZE
117	hex "Flash shell buffer size"
118	default 0x4000 if FLASH_SHELL_TEST_COMMANDS
119	default 0x1000
120	range 0x400 0x1000000
121	help
122	  Size of the buffer used for flash commands, will determine the
123	  maximum size that can be used with a read/write test.
124
125endif # FLASH_SHELL
126
127config FLASH_FILL_BUFFER_SIZE
128	int "Buffer size of flash_fill function"
129	default 32
130	help
131	  Size of a buffer used by flash_fill function to fill a device with
132	  specific value; this buffer is allocated on stack.
133	  The buffer is needed as most devices have write-block alignment
134	  requirements that which imposes minimal size of data, which can
135	  be written to a device, and alignment of write offset.
136	  Even if device does not have such requirement, filling device by
137	  single bytes is not efficient.
138	  Value selected here should be a multiple of the largest write-block-size
139	  among all the memory devices used in system.
140
141if FLASH_HAS_PAGE_LAYOUT
142
143config FLASH_PAGE_LAYOUT
144	bool "API for retrieving the layout of pages"
145	default FLASH_HAS_PAGE_LAYOUT
146	help
147	  Enables API for retrieving the layout of flash memory pages.
148
149endif
150
151config FLASH_EX_OP_ENABLED
152	bool "API for extended flash operations"
153	depends on FLASH_HAS_EX_OP
154	default n
155	help
156	  Enables flash extended operations API. It can be used to perform
157	  non-standard operations e.g. manipulating flash protection.
158
159config FLASH_INIT_PRIORITY
160	int "Flash init priority"
161	default KERNEL_INIT_PRIORITY_DEVICE
162	help
163	  Flash driver device initialization priority. This initialization
164	  priority is used unless the driver implementation has its own
165	  initialization priority
166
167# zephyr-keep-sorted-start
168source "drivers/flash/Kconfig.adi_max32_spixf"
169source "drivers/flash/Kconfig.ambiq"
170source "drivers/flash/Kconfig.andes"
171source "drivers/flash/Kconfig.at25xv021a"
172source "drivers/flash/Kconfig.at45"
173source "drivers/flash/Kconfig.b91"
174source "drivers/flash/Kconfig.bflb"
175source "drivers/flash/Kconfig.cadence_nand"
176source "drivers/flash/Kconfig.cadence_qspi_nor"
177source "drivers/flash/Kconfig.cc13xx_cc26xx"
178source "drivers/flash/Kconfig.cc23x0"
179source "drivers/flash/Kconfig.esp32"
180source "drivers/flash/Kconfig.gd32"
181source "drivers/flash/Kconfig.gecko"
182source "drivers/flash/Kconfig.infineon"
183source "drivers/flash/Kconfig.it51xxx_m1k"
184source "drivers/flash/Kconfig.it8xxx2"
185source "drivers/flash/Kconfig.lpc"
186source "drivers/flash/Kconfig.max32"
187source "drivers/flash/Kconfig.mchp"
188source "drivers/flash/Kconfig.mcux"
189source "drivers/flash/Kconfig.mspi"
190source "drivers/flash/Kconfig.nor"
191source "drivers/flash/Kconfig.nordic_qspi_nor"
192source "drivers/flash/Kconfig.npcx_fiu"
193source "drivers/flash/Kconfig.nrf"
194source "drivers/flash/Kconfig.nrf_mram"
195source "drivers/flash/Kconfig.nrf_mramc"
196source "drivers/flash/Kconfig.nrf_rram"
197source "drivers/flash/Kconfig.numaker"
198source "drivers/flash/Kconfig.numaker_rmc"
199source "drivers/flash/Kconfig.nxp_s32"
200source "drivers/flash/Kconfig.renesas_ra"
201source "drivers/flash/Kconfig.renesas_ra_ospi"
202source "drivers/flash/Kconfig.renesas_ra_qspi"
203source "drivers/flash/Kconfig.renesas_rx"
204source "drivers/flash/Kconfig.renesas_rz_qspi"
205source "drivers/flash/Kconfig.rpi_pico"
206source "drivers/flash/Kconfig.rts5912"
207source "drivers/flash/Kconfig.rv32m1"
208source "drivers/flash/Kconfig.sam"
209source "drivers/flash/Kconfig.sam0"
210source "drivers/flash/Kconfig.sf32lb_mpi_qspi_nor"
211source "drivers/flash/Kconfig.si32"
212source "drivers/flash/Kconfig.silabs"
213source "drivers/flash/Kconfig.simulator"
214source "drivers/flash/Kconfig.siwx91x"
215source "drivers/flash/Kconfig.smartbond"
216source "drivers/flash/Kconfig.stm32"
217source "drivers/flash/Kconfig.stm32_ospi"
218source "drivers/flash/Kconfig.stm32_qspi"
219source "drivers/flash/Kconfig.stm32_xspi"
220source "drivers/flash/Kconfig.xmc4xxx"
221# zephyr-keep-sorted-stop
222
223module = FLASH
224module-str = flash
225source "subsys/logging/Kconfig.template.log_config"
226
227endif # FLASH
228