drivers: flash: add NXP S32 QSPI flash NOR driver

Add support for flash NOR memory devices on a NXP S32 QSPI bus. The
driver uses a fixed LUT configuration assuming a default standard page
size and erase types, and allows to select between multiple read/program
instructions/modes. It is also possible to read the flash device
characteristics from the device at run-time as long as the memory is
JESD216 compatible, providing more flexibility.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
This commit is contained in:
Manuel Argüelles 2023-07-07 13:31:50 -03:00 committed by Carles Cufí
parent 5dad944351
commit 6d0a876525
6 changed files with 1228 additions and 0 deletions

View file

@ -106,6 +106,12 @@ zephyr_library_include_directories_ifdef(
${ZEPHYR_BASE}/drivers/memc
)
zephyr_library_sources_ifdef(CONFIG_FLASH_NXP_S32_QSPI_NOR flash_nxp_s32_qspi_nor.c)
zephyr_library_include_directories_ifdef(
CONFIG_FLASH_NXP_S32_QSPI_NOR
${ZEPHYR_BASE}/drivers/memc
)
zephyr_library_sources_ifdef(CONFIG_FLASH_SHELL flash_shell.c)
zephyr_library_sources_ifdef(CONFIG_FLASH_JESD216 jesd216.c)
zephyr_library_sources_ifdef(CONFIG_FLASH_INFINEON_CAT1 flash_ifx_cat1.c)

View file

@ -154,4 +154,6 @@ source "drivers/flash/Kconfig.ifx_cat1"
source "drivers/flash/Kconfig.numaker"
source "drivers/flash/Kconfig.nxp_s32"
endif # FLASH

View file

@ -0,0 +1,54 @@
# Copyright 2023 NXP
# SPDX-License-Identifier: Apache-2.0
config FLASH_NXP_S32_QSPI_NOR
bool "NXP S32 QSPI NOR driver"
default y
depends on DT_HAS_NXP_S32_QSPI_NOR_ENABLED
select MEMC
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_DRIVER_ENABLED
select FLASH_JESD216
help
Enable the Flash driver for a NOR Serial Flash Memory device connected
to an NXP S32 QSPI bus.
if FLASH_NXP_S32_QSPI_NOR
config FLASH_NXP_S32_QSPI_NOR_SFDP_RUNTIME
bool "Read flash parameters at runtime"
help
Read flash device characteristics from the device at runtime.
This option should provide functionality for all supported
JESD216-compatible devices, with the following notes:
- Quad Enable Requirements bitfield (DW15) must be present in the SFDP
tables to configure Quad mode. Otherwise it defaults to Dual or
Single mode as supported by the device.
- Soft Reset bitfield (DW16) must be present in the SFDP tables to
automatically reset the device at initialization time.
- 0-X-X mode discovery not yet implemented by the HAL.
If not selected, the driver uses a fixed configuration assuming 256 By
page size and 4 KiBy, 32 KiBy and 64 KiBy erase instructions. The
device size and jedec-id properties must be set in devicetree node.
config FLASH_NXP_S32_QSPI_VERIFY_ERASE
bool "Verify memory after erased"
help
Verify contents of memory after erased.
config FLASH_NXP_S32_QSPI_VERIFY_WRITE
bool "Verify memory after written"
help
Verify contents of memory after written.
config FLASH_NXP_S32_QSPI_LAYOUT_PAGE_SIZE
int "Page size to use for FLASH_LAYOUT feature"
default 4096
help
When CONFIG_FLASH_PAGE_LAYOUT is used this driver will support that API.
By default the page size corresponds to the sector size (4096) for a NOR
flash memory. Other options may include the 32K-byte erase size (32768),
the block size (65536), or any non-zero multiple of the sector size.
endif # FLASH_NXP_S32_QSPI_NOR

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
# Copyright 2023 NXP
# SPDX-License-Identifier: Apache-2.0
description: |
QSPI memory device supporting xSPI or Hyperbus.
compatible: "nxp,s32-qspi-device"
include: [base.yaml, "jedec,jesd216.yaml"]
on-bus: qspi
properties:
reg:
required: true
memory-alignment:
type: int
description: |
Memory alignment in bytes, used to calculate padding when performing
unaligned accesses.
If not provided, 1 byte alignment will be selected.

View file

@ -0,0 +1,38 @@
# Copyright 2023 NXP
# SPDX-License-Identifier: Apache-2.0
description: |
QSPI NOR flash connected to the NXP S32 QSPI bus.
compatible: "nxp,s32-qspi-nor"
include: "nxp,s32-qspi-device.yaml"
properties:
has-32k-erase:
type: boolean
description: |
Set if the memory device supports 32 KiBy block erase operation.
readoc:
type: string
enum:
- "1-1-1" # 0x0B
- "1-1-2" # 0x3B
- "1-2-2" # 0xBB
- "1-1-4" # 0x6B
- "1-4-4" # 0xEB
description: |
Specify the number of data lines and opcode used for reading.
If not provided, 1-1-1 will be selected.
writeoc:
type: string
enum:
- "1-1-1" # 0x02
- "1-1-2" # 0xA2
- "1-1-4" # 0x32
- "1-4-4" # 0x38
description: |
Specify the number of data lines and opcode used for writing.
If not provided, 1-1-1 will be selected.