u-boot/arch
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
..
arc arc: Remove common.h usage 2023-10-24 16:34:45 -04:00
arm arm: mach-tegra: enable sysreset driver 2023-11-03 17:40:11 -04:00
m68k Kconfig: Remove all default n/no options 2023-10-30 15:32:49 -04:00
microblaze microblaze: Remove common.h usage 2023-10-24 16:34:45 -04:00
mips mips: Remove common.h usage 2023-10-24 16:34:45 -04:00
nios2 event: Convert existing spy records to simple 2023-08-31 13:16:54 -04:00
powerpc mpc85xx: relocate code in non-SPL build 2023-10-28 09:17:55 -04:00
riscv riscv: dts: jh7110: Add rng device tree node 2023-11-02 17:45:53 +08:00
sandbox nand: Add sandbox driver 2023-11-16 12:43:49 -05:00
sh spl: Use SYS_MALLOC_F instead of SYS_MALLOC_F_LEN 2023-10-06 14:38:12 -04:00
x86 common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
xtensa treewide: unify the linker symbol reference format 2023-08-09 09:21:42 -04:00
.gitignore
Kconfig cmd: mbr: Allow 4 MBR partitions without need for extended 2023-10-24 17:05:24 -04:00
Kconfig.nxp LFU-544: Kconfig.nxp: Fixed secure boot on LS-CH2 platforms 2023-07-06 13:04:56 +08:00
u-boot-elf.lds