u-boot/test/dm
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
..
acpi.c test: acpi: Handle both 32bit and 64bit ACPI tables 2023-08-22 15:17:52 -04:00
acpi.h doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
acpi_dp.c dm: acpi: Use correct GPIO polarity type in acpi_dp_add_gpio() 2020-09-25 11:27:14 +08:00
acpigen.c test: Wrap assert macros in ({ ... }) and fix missing semicolons 2023-03-14 16:08:51 -06:00
adc.c dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
audio.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
axi.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
blk.c blk: sandbox: Support binding a device with a given logical block size 2023-10-10 16:19:43 -04:00
blkmap.c test: blkmap: Add test suite 2023-04-05 10:54:47 -04:00
bootcount.c bootcount: add a new driver with syscon as backend 2021-08-22 11:04:52 +02:00
bus.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
button.c dm: button: add support for linux_code in button-gpio.c driver 2023-02-10 12:50:01 -05:00
cache.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
clk.c clk: Dont return error when assigned-clocks is empty or missing 2023-09-21 13:20:11 +02:00
clk_ccf.c clk: do not disable clock if it is critical 2020-09-22 11:27:18 +03:00
core.c dm: core: Do not stop uclass iteration on error 2022-10-29 07:36:33 -06:00
cpu.c test: cpu: Handle both 32bit and 64bit CPUs 2023-08-20 15:55:27 -06:00
cros_ec.c cros_ec: Add vstore support 2021-01-30 14:25:41 -07:00
cros_ec_pwm.c sandbox: cros-ec: Add tests for the Chromium OS EC PWM driver 2021-07-06 10:38:03 -06:00
devres.c dm: treewide: Use uclass_first_device_err when accessing one device 2022-10-17 21:17:12 -06:00
dma.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
dsa.c net: update NXP copyright text 2021-09-28 18:50:56 +03:00
dsi_host.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
ecdsa.c test: dm: Add test for ECDSA UCLASS support 2021-08-16 10:49:35 +02:00
efi_media.c efi: Add uclass for devices provided by UEFI firmware 2021-12-09 11:43:25 -08:00
eth.c test: eth: IPv6 network discovery unit test 2023-05-05 17:59:20 -04:00
extcon.c test: Add tests for the extcon 2023-05-02 14:23:58 -04:00
fastboot.c test: fastboot: Avoid using mmc1 2022-04-25 10:00:03 -04:00
fdtdec.c fdtdec: Support reserved-memory flags 2021-10-13 14:18:30 -07:00
ffa.c arm_ffa: introduce sandbox test cases for UCLASS_FFA 2023-08-08 10:22:03 -04:00
firmware.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
fpga.c dm: fpga: Introduce new uclass 2022-10-05 08:43:53 +02:00
fwu_mdata.c fwu: Initialize global fwu library state during CI test 2023-08-30 17:56:21 -04:00
fwu_mdata_disk_image.h test: dm: Add test cases for FWU Metadata uclass 2022-10-31 14:47:33 -04:00
gpio.c test:dm:fix typo 2023-01-05 19:21:56 -07:00
host.c cmd: host: Print out the block size of the host device 2023-10-10 16:25:48 -04:00
hwspinlock.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
i2c.c dm: treewide: Use uclass_first_device_err when accessing one device 2022-10-17 21:17:12 -06:00
i2s.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
iommu.c test: Add test for mapping IOMMUs for PCI devices 2023-01-27 14:47:58 -05:00
irq.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
k210_pll.c k210: fix k210_pll_calc_config() 2022-10-20 15:22:30 +08:00
Kconfig test: Move the unit tests to their own menu 2015-05-21 09:16:17 -04:00
led.c test: dm: led: Fix LED enumeration 2022-04-28 09:26:44 -04:00
mailbox.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
Makefile nand: Add sandbox driver 2023-11-16 12:43:49 -05:00
mdio.c treewide: use dm_mdio_read/write/reset() wrappers 2022-04-10 08:44:12 +03:00
mdio_mux.c treewide: use dm_mdio_read/write/reset() wrappers 2022-04-10 08:44:12 +03:00
memory.c dm: memory: Introduce new uclass 2022-10-26 15:21:11 -04:00
misc.c test: Wrap assert macros in ({ ... }) and fix missing semicolons 2023-03-14 16:08:51 -06:00
mmc.c test: dm: mmc: Check block erasing boundaries 2023-04-10 12:17:32 +09:00
mux-cmd.c test: mux-cmd: Add tests for the 'mux' command 2020-10-28 11:49:31 -04:00
mux-emul.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
mux-mmio.c test: Add tests for the multiplexer framework 2020-10-28 11:49:31 -04:00
nand.c nand: Add sandbox driver 2023-11-16 12:43:49 -05:00
nop.c cmd: bind: Fix driver binding on a device 2021-10-12 14:19:52 +02:00
nvmxip.c drivers/mtd/nvmxip: Move sandbox_set_enable_memio() to test 2023-08-30 17:56:21 -04:00
of_extra.c test: dm: Add a case to test ofnode_phy_is_fixed_link() 2021-04-15 14:22:17 +05:30
of_platdata.c test: Update tests to use the skip feature 2022-10-31 11:02:44 -04:00
ofnode.c dm: core: Add tests for oftree_path() 2023-10-06 14:38:13 -04:00
ofread.c dm: core: Rename ofnode_get_property_by_prop() 2022-09-29 16:11:14 -04:00
osd.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
p2sb.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
panel.c sandbox: cros-ec: Add tests for the Chromium OS EC PWM driver 2021-07-06 10:38:03 -06:00
part.c dm: test: Add test for part_get_info_by_type 2023-07-17 16:19:47 -04:00
pch.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
pci.c pci: serial: Support reading PCI-register size with base 2023-10-06 14:38:13 -04:00
pci_ep.c WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
phy.c phy: Return success from generic_setup_phy() when phy is not found 2023-09-13 15:52:21 -04:00
phys2bus.c dm: test: Add test case for dev_phys_to_bus()/dev_bus_to_phys() 2021-02-18 11:56:25 +01:00
pinmux.c test: dm: pinmux: Handle %pa in pinctrl-single mux output 2023-08-20 15:55:27 -06:00
pmc.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
pmic.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
power-domain.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
pwm.c sandbox: cros-ec: Add tests for the Chromium OS EC PWM driver 2021-07-06 10:38:03 -06:00
qfw.c test: qemu: add qfw sandbox driver, dm tests, qemu tests 2021-04-12 17:45:39 -04:00
ram.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
read.c dm: test: Add test case for dev_get_dma_ranges() 2021-02-18 11:56:25 +01:00
reboot-mode.c reboot-mode: read the boot mode from RTC memory 2021-07-23 10:16:39 -04:00
regmap.c test: Fix pointer overrun in dm_test_devm_regmap() 2022-04-29 11:11:36 -04:00
regulator.c dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
remoteproc.c test:dm:fix typo 2023-01-05 19:21:56 -07:00
reset.c reset: Allow reset_get_by_name() with NULL name 2023-02-12 13:44:20 -05:00
rkmtd.c rockchip: test: dm: add rkmtd test 2023-10-24 15:55:17 +08:00
rng.c test: rng: Add a UT testcase for the rng command 2022-08-02 23:50:02 +03:00
rtc.c dm: rtc: Try to handle the localtime() race 2022-09-02 16:21:44 -04:00
scmi.c test: dm: add SCMI power domain protocol test 2023-10-24 17:05:24 -04:00
scsi.c sandbox: Add a test for SCSI 2022-09-25 13:59:56 -06:00
serial.c test: serial: Add test for putc/puts 2022-04-14 15:39:15 -04:00
sf.c sf: Support querying write-protect 2021-03-27 15:04:31 +13:00
simple-bus.c test: dm: Add a test case for simple-bus <ranges> 2021-04-15 14:22:17 +05:30
simple-pm-bus.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
sm.c sandbox: add tests for UCLASS_SM 2023-10-15 12:23:48 +02:00
smem.c WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
soc.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
sound.c test: test sandbox sound driver more rigorously 2022-12-05 17:43:21 +01:00
spi.c test: dm: spi: Replace _spi_get_bus_and_cs() by spi_get_bus_and_cs() in some case 2022-05-23 09:33:10 -04:00
spmi.c test:dm:fix typo 2023-01-05 19:21:56 -07:00
syscon-reset.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
syscon.c dm: Rename DM test flags to make them more generic 2020-08-07 22:31:32 -04:00
sysinfo-gpio.c test: Add gpio-sysinfo test 2021-05-04 07:57:18 -04:00
sysinfo.c sysinfo: Require that sysinfo_detect be called before other methods 2021-05-04 07:57:18 -04:00
sysreset.c test: adjust sysreset tests 2020-11-05 09:11:30 -07:00
tag.c test: dm: add tests for tag support 2022-04-23 22:05:34 +02:00
tee.c test: dm: tee: extend with RPC test 2021-02-16 11:48:20 -05:00
test-dm.c dm: test: Drop the special function for running DM tests 2022-11-07 16:24:30 -07:00
test-driver.c test: Use a local variable for test state 2021-03-12 09:57:30 -05:00
test-fdt.c test: dm: test-fdt: Use fdtdec_get_int() in dm_check_devices() 2023-09-06 13:51:19 -04:00
test-uclass.c test: Use a local variable for test state 2021-03-12 09:57:30 -05:00
timer.c sandbox: correct cpu nodes 2021-09-25 09:46:15 -06:00
tpm.c test: fix comment indentation on tpm tests 2023-09-30 15:15:31 -04:00
usb.c usb: Update the test to cover reading and writing 2022-10-31 11:02:44 -04:00
video.c sandbox: fix a compilation error 2023-07-20 14:10:57 -06:00
virtio.c test: dm: virtio: Split out virtio device tests 2022-06-08 09:24:04 -04:00
virtio_device.c virtio: Avoid strange behaviour on removal 2023-01-23 18:11:40 -05:00
virtio_rng.c dm: treewide: Use uclass_first_device_err when accessing one device 2022-10-17 21:17:12 -06:00
wdt.c sandbox: watchdog: Avoid an error on startup 2023-10-19 07:50:18 +02:00