1# Copyright (c) 2018 Savoir-Faire Linux.
2# Copyright (c) 2024 Nordic Semiconductor ASA
3#
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig SPI_NOR
7	bool "SPI NOR Flash"
8	default y
9	depends on DT_HAS_JEDEC_SPI_NOR_ENABLED
10	select FLASH_HAS_DRIVER_ENABLED
11	select FLASH_HAS_EXPLICIT_ERASE
12	select FLASH_HAS_PAGE_LAYOUT
13	select FLASH_JESD216
14	select FLASH_HAS_EX_OP
15	select SPI
16
17if SPI_NOR
18
19choice SPI_NOR_SFDP
20	prompt "Source for Serial Flash Discoverable Parameters"
21	default SPI_NOR_SFDP_MINIMAL
22
23config SPI_NOR_SFDP_MINIMAL
24	bool "Fixed flash configuration"
25	help
26	  Synthesize a minimal configuration assuming 256 By page size (or as
27	  set by the page-size devicetree property) and
28	  standard 4 KiBy and 64 KiBy erase instructions.  Requires the size and
29	  jedec-id properties in the devicetree jedec,spi-nor node.
30
31config SPI_NOR_SFDP_DEVICETREE
32	bool "Basic Flash Parameters from devicetree node"
33	help
34	  The JESD216 Basic Flash Parameters table must be provided in the
35	  sfdp-bfp property in devicetree.  The size and jedec-id properties are
36	  also required.
37
38config SPI_NOR_SFDP_RUNTIME
39	bool "Read flash parameters at runtime"
40	help
41	  Read all flash device characteristics from the device at runtime.
42	  This option is the most flexible as it should provide functionality
43	  for all supported JESD216-compatible devices.
44
45endchoice
46
47config SPI_NOR_INIT_PRIORITY
48	int "Init priority"
49	default 80
50	help
51	  Device driver initialization priority.
52	  Device is connected to SPI bus, it has to
53	  be initialized after SPI driver.
54
55config SPI_NOR_CS_WAIT_DELAY
56	int "Delay time in us"
57	default 0
58	help
59	  This is the wait delay (in us) to allow for CS switching to take effect
60
61config SPI_NOR_SLEEP_WHILE_WAITING_UNTIL_READY
62	bool "Sleep while waiting for flash operations to complete"
63	default y
64	help
65	  Flash operations can take anywhere from 1ms to 240 seconds to
66	  complete. Enabling this option adds a delay between polls on the
67	  status register for slow operations. Disabling this option can
68	  result in significant flash savings if this driver is the only user
69	  of "k_sleep". This can be the case when building as a bootloader.
70
71config SPI_NOR_FLASH_LAYOUT_PAGE_SIZE
72	int "Page size to use for FLASH_LAYOUT feature"
73	default 65536
74	help
75	  When CONFIG_FLASH_PAGE_LAYOUT is used this driver will support
76	  that API.  By default the page size corresponds to the block
77	  size (65536).  Other options include the 32K-byte erase size
78	  (32768), the sector size (4096), or any non-zero multiple of the
79	  sector size.
80
81config SPI_NOR_ACTIVE_DWELL_MS
82	int "Dwell period (ms) after last use to stay in active mode"
83	depends on PM_DEVICE_RUNTIME
84	default 10
85	help
86	  Flash accesses commonly occur in bursts, where entering and exiting DPD
87	  mode between each access adds significantly to the total operation time.
88	  This option controls how long to remain in active mode after each API
89	  call, eliminating the active->idle->active transition sequence if another
90	  transaction occurs before the dwell period expires.
91
92endif # SPI_NOR
93