u-boot/drivers/dfu
Patrick Delaunay be0da1257f dfu: mtd: mark bad the MTD block on erase error
In the MTD DFU backend, it is needed to mark the NAND block bad when the
erase failed with the -EIO error, as it is done in UBI and JFFS2 code.

This operation is not done in the MTD framework, but the bad block
tag (in BBM or in BBT) is required to avoid to write data on this block
in the next DFU_OP_WRITE loop in mtd_block_op(): the code skip the bad
blocks, tested by mtd_block_isbad().

Without this patch, when the NAND block become bad on DFU write operation
- low probability on new NAND - the DFU write operation will always failed
because the failing block is never marked bad.

This patch also adds a test to avoid to request an erase operation on a
block already marked bad; this test is not performed in MTD framework
in mtd_erase().

Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-10-13 10:49:07 +02:00
..
dfu.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
dfu_alt.c dfu: add dfu_write_by_alt() 2020-10-30 14:20:27 +01:00
dfu_mmc.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
dfu_mtd.c dfu: mtd: mark bad the MTD block on erase error 2023-10-13 10:49:07 +02:00
dfu_nand.c DFU: Check the number of arguments and argument string strictly 2022-02-11 11:29:23 -05:00
dfu_ram.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
dfu_sf.c Audit <flash.h> inclusion 2022-08-04 16:18:47 -04:00
dfu_virt.c DFU: Check the number of arguments and argument string strictly 2022-02-11 11:29:23 -05:00
Kconfig dfu: Add proper dependency for CONFIG_DFU_MMC 2023-07-17 15:38:11 -04:00
Makefile dfu: rename dfu_tftp_write() to dfu_write_by_name() 2020-10-30 14:20:27 +01:00