mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-25 10:55:21 +00:00
This commit reworks the SPI NOR driver to be more flexible in how flash device configuration is obtained. Three alternatives are supported: * MINIMAL takes only the flash size from devicetree. The erase sizes are hard-coded to the traditionally supported instructures. * DEVICETREE requires that the data from the device's JESD216 Basic Flash Parameters table be provided through devicetree. This supports multiple page sizes and erase configurations, and lays a foundation for significant enhancements in the future including 4-byte address, sleeping while waiting for operation completion, and other features that are described by JESD216 parameters. * RUNTIME requires nothing from the devicetree node, instead reading the Basic Flash Parameters from the device at runtime. It extends DEVICETREE by allowing the same firmware to run on boards with different flash chips. For MINIMAL and DEVICETREE the JEDEC ID from the devicetree node is checked against the value read at runtime to confirm that the device configuration is accurate. The default SFDP source is MINIMAL. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
76 lines
2.3 KiB
Plaintext
76 lines
2.3 KiB
Plaintext
# Copyright (c) 2018 Savoir-Faire Linux.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
menuconfig SPI_NOR
|
|
bool "SPI NOR Flash"
|
|
select FLASH_HAS_DRIVER_ENABLED
|
|
select FLASH_JESD216
|
|
depends on SPI
|
|
|
|
if SPI_NOR
|
|
|
|
choice SPI_NOR_SFDP
|
|
prompt "Source for Serial Flash Discoverable Parameters"
|
|
default SPI_NOR_SFDP_MINIMAL
|
|
|
|
config SPI_NOR_SFDP_MINIMAL
|
|
bool "Fixed flash configuration"
|
|
help
|
|
Synthesize a minimal configuration assuming 256 By page size and
|
|
standard 4 KiBy and 64 KiBy erase instructions. Requires the size and
|
|
jedec-id properties in the devicetree jedec,spi-nor node.
|
|
|
|
config SPI_NOR_SFDP_DEVICETREE
|
|
bool "Basic Flash Parameters from devicetree node"
|
|
help
|
|
The JESD216 Basic Flash Parameters table must be provided in the
|
|
sfdp-bfp property in devicetree. The size and jedec-id properties are
|
|
also required.
|
|
|
|
config SPI_NOR_SFDP_RUNTIME
|
|
bool "Read flash parameters at runtime"
|
|
help
|
|
Read all flash device characteristics from the device at runtime.
|
|
This option is the most flexible as it should provide functionality
|
|
for all supported JESD216-compatible devices.
|
|
|
|
endchoice
|
|
|
|
config SPI_NOR_INIT_PRIORITY
|
|
int
|
|
default 80
|
|
help
|
|
Device driver initialization priority.
|
|
Device is connected to SPI bus, it has to
|
|
be initialized after SPI driver.
|
|
|
|
config SPI_NOR_CS_WAIT_DELAY
|
|
int "Delay time in us"
|
|
default 0
|
|
help
|
|
This is the wait delay (in us) to allow for CS switching to take effect
|
|
|
|
config SPI_NOR_FLASH_LAYOUT_PAGE_SIZE
|
|
int "Page size to use for FLASH_LAYOUT feature"
|
|
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 SPI_NOR_IDLE_IN_DPD
|
|
bool "Use Deep Power-Down mode when flash is not being accessed."
|
|
help
|
|
Where supported deep power-down mode can reduce current draw
|
|
to as little as 0.1% of standby current. However it takes
|
|
some milliseconds to enter and exit from this mode.
|
|
|
|
Select this option for applications where device power
|
|
management is not enabled, the flash remains inactive for
|
|
long periods, and when used the impact of waiting for mode
|
|
enter and exit delays is acceptable.
|
|
|
|
endif # SPI_NOR
|