u-boot/drivers/mtd/nand/raw
Sean Anderson bc8e8a4bfa nand: Add sandbox driver
Add a sandbox NAND flash driver to facilitate testing. This driver supports
any number of devices, each using a single chip-select. The OOB data is
stored in-band, with the separation enforced through the API.

For now, create two devices to test with. The first is a very small device
with basic ECC. The second is an 8G device (chosen to be larger than 32
bits). It uses ONFI, with the values copied from the datasheet. It also
doesn't need too strong ECC, which speeds things up.

Although the nand subsystem determines the parameters of a chip based on
the ID, the driver itself requires devicetree properties for each
parameter. We do not derive parameters from the ID because parsing the ID
is non-trivial. We do not just use the parameters that the nand subsystem
has calculated since that is something we should be testing. An exception
is made for the ECC layout, since that is difficult to encode in the device
tree and is not a property of the device itself.

Despite using file I/O to access the backing data, we do not support using
external files. In my experience, these are unnecessary for testing since
tests can generally be written to write their expected data beforehand.
Additionally, we would need to store the "programmed" information somewhere
(complicating the format and the programming process) or try to detect
whether block are erased at runtime (degrading probe speeds).

Information about whether each page has been programmed is stored in an
in-memory buffer. To simplify the implementation, we only support a single
program per erase. While this is accurate for many larger flashes, some
smaller flashes (512 byte) support multiple programs and/or subpage
programs. Support for this could be added later as I believe some
filesystems expect this.

To test ECC, we support error-injection. Surprisingly, only ECC bytes in
the OOB area are protected, even though all bytes are equally susceptible
to error. Because of this, we take care to only corrupt ECC bytes.
Similarly, because ECC covers "steps" and not the whole page, we must take
care to corrupt data in the same way.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-11-16 12:43:49 -05:00
..
atmel Merge branch 'next' 2023-10-02 10:55:44 -04:00
brcmnand common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
am335x_spl_bch.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
arasan_nfc.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
atmel_nand.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
atmel_nand_ecc.h mtd: move NAND files into a raw/ subdirectory 2018-09-20 20:10:49 +05:30
cortina_nand.c drivers: use dev_read_addr_ptr when cast to pointer 2023-05-06 17:28:18 +08:00
cortina_nand.h mtd: rawnand: cortina_nand: Add Cortina CAxxxx SoC support 2021-01-18 15:14:34 -05:00
davinci_nand.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
denali.c mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface 2021-09-28 06:34:45 +02:00
denali.h mtd: nand: raw: denali: Wait for reset completion status 2020-07-11 21:30:21 +09:00
denali_dt.c dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET() 2021-01-05 12:26:35 -07:00
denali_spl.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
fsl_elbc_nand.c global: Move remaining CONFIG_SYS_NAND_* to CFG_SYS_NAND_* 2022-12-05 16:05:38 -05:00
fsl_elbc_spl.c global: Move remaining CONFIG_SYS_NAND_* to CFG_SYS_NAND_* 2022-12-05 16:05:38 -05:00
fsl_ifc_nand.c nxp: Finish migration of SYS_FSL_IFC_BANK_COUNT to Kconfig 2023-01-20 12:27:06 -05:00
fsl_ifc_spl.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
Kconfig nand: Add sandbox driver 2023-11-16 12:43:49 -05:00
kirkwood_nand.c nand.h: Cleanup linux/mtd/rawnand.h usage 2021-10-06 09:16:23 -04:00
kmeter1_nand.c global: Finish CONFIG -> CFG migration 2023-01-20 12:27:24 -05:00
lpc32xx_nand_mlc.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
lpc32xx_nand_slc.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
Makefile nand: Add sandbox driver 2023-11-16 12:43:49 -05:00
mt7621_nand.c mtd: nand: Rename nand_get_flash_type() into nand_detect() 2022-08-22 11:15:15 +02:00
mt7621_nand.h nand: raw: add support for MediaTek MT7621 SoC 2022-07-13 23:03:37 +02:00
mt7621_nand_spl.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
mxc_nand.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
mxc_nand.h arm: Remove unused mx27 code 2022-12-05 16:07:13 -05:00
mxc_nand_spl.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
mxic_nand.c drivers: use dev_read_addr_ptr when cast to pointer 2023-05-06 17:28:18 +08:00
mxs_nand.c mtd: mxs_nand: Support EDO mode for imx8mn architecture 2022-10-09 10:42:26 +02:00
mxs_nand_dt.c mtd: mxs_nand: Support EDO mode for imx8mn architecture 2022-10-09 10:42:26 +02:00
mxs_nand_spl.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
nand.c nand: Allow reinitialization 2023-11-16 12:43:49 -05:00
nand_amd.c mtd: nand: Move AMD/Spansion specific init/detection logic in nand_amd.c 2022-07-22 13:29:06 +02:00
nand_base.c nand: Don't dereference NULL manufacturer_desc 2023-11-16 12:43:48 -05:00
nand_bbt.c mtd: nand: Mark reserved blocks 2023-02-27 16:28:30 +01:00
nand_bch.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
nand_ecc.c mtd: move NAND files into a raw/ subdirectory 2018-09-20 20:10:49 +05:30
nand_hynix.c mtd: nand: Move Hynix specific init/detection logic in nand_hynix.c 2022-07-22 13:29:06 +02:00
nand_ids.c mtd: nand: add support for the Sandisk SDTNQGAMA chip 2023-05-06 17:28:17 +08:00
nand_macronix.c mtd: nand: Move Macronix specific initialization in nand_macronix.c 2022-07-22 13:29:06 +02:00
nand_micron.c mtd: nand: Move Micron specific init logic in nand_micron.c 2022-07-22 13:29:06 +02:00
nand_samsung.c mtd: nand: samsung: Retrieve ECC requirements from extended 2022-08-22 11:15:24 +02:00
nand_spl_load.c global: Move remaining CONFIG_SYS_NAND_* to CFG_SYS_NAND_* 2022-12-05 16:05:38 -05:00
nand_spl_loaders.c nand: spl_loaders: Only read enough pages to load the image 2023-11-16 12:43:48 -05:00
nand_spl_simple.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
nand_timings.c dm: core: Require users of devres to include the header 2020-02-05 19:33:46 -07:00
nand_toshiba.c mtd: nand: toshiba: Retrieve ECC requirements from extended ID 2022-07-22 13:29:06 +02:00
nand_util.c mtd: nand: Show reserved block in chip.erase 2023-02-27 16:30:13 +01:00
octeontx_bch.c nand: raw: octeontx: Make list static 2023-04-16 12:30:46 +02:00
octeontx_bch.h doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
octeontx_bch_regs.h mtd: nand: Add NAND controller driver for OcteonTX 2020-10-14 07:55:56 +02:00
octeontx_nand.c nand: raw: octeontx: Make list static 2023-04-16 12:30:46 +02:00
omap_elm.c mtd: rawnand: omap_elm: u-boot driver model support 2023-01-08 10:38:50 +01:00
omap_elm.h mtd: rawnand: omap_elm: u-boot driver model support 2023-01-08 10:38:50 +01:00
omap_gpmc.c nand: Calculate SYS_NAND_BLOCK_PAGES (neé SYS_NAND_PAGE_COUNT) automatically 2023-11-16 12:43:48 -05:00
pxa3xx_nand.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
pxa3xx_nand.h mtd: move NAND files into a raw/ subdirectory 2018-09-20 20:10:49 +05:30
rockchip_nfc.c mtd: nand: raw: rockchip_nfc: add NAND_SKIP_BBTSCAN option 2023-10-24 15:55:16 +08:00
sand_nand.c nand: Add sandbox driver 2023-11-16 12:43:49 -05:00
stm32_fmc2_nand.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
sunxi_nand.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
sunxi_nand_spl.c spl: nand: Set bl_len to page size 2023-11-16 12:43:48 -05:00
tegra_nand.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
tegra_nand.h mtd: move NAND files into a raw/ subdirectory 2018-09-20 20:10:49 +05:30
vf610_nfc.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
zynq_nand.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00