Skip to content
Snippets Groups Projects
Commit 13cb7cc9 authored by Guillermo Rodríguez's avatar Guillermo Rodríguez Committed by Marek Vasut
Browse files

dfu: Add option to skip empty pages when flashing UBI images to NAND


Add a new option to enable the DROP_FFS flag when flashing UBI images to
NAND in order to drop trailing all-0xff pages.

This is similar to the existing FASTBOOT_FLASH_NAND_TRIMFFS option.

Signed-off-by: default avatarGuillermo Rodriguez <guille.rodriguez@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
parent bf16a7be
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,13 @@ config DFU_NAND ...@@ -42,6 +42,13 @@ config DFU_NAND
This option enables using DFU to read and write to NAND based This option enables using DFU to read and write to NAND based
storage. storage.
config DFU_NAND_TRIMFFS
bool "Skip empty pages when flashing UBI images to NAND"
depends on DFU_NAND
help
When flashing UBI images to NAND, enable the DROP_FFS flag to drop
trailing all-0xff pages.
config DFU_RAM config DFU_RAM
bool "RAM back end for DFU" bool "RAM back end for DFU"
help help
......
...@@ -50,6 +50,7 @@ static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu, ...@@ -50,6 +50,7 @@ static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu,
lim, buf); lim, buf);
} else { } else {
nand_erase_options_t opts; nand_erase_options_t opts;
int write_flags = WITH_WR_VERIFY;
memset(&opts, 0, sizeof(opts)); memset(&opts, 0, sizeof(opts));
opts.offset = start; opts.offset = start;
...@@ -62,8 +63,12 @@ static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu, ...@@ -62,8 +63,12 @@ static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu,
if (ret) if (ret)
return ret; return ret;
/* then write */ /* then write */
#ifdef CONFIG_DFU_NAND_TRIMFFS
if (dfu->data.nand.ubi)
write_flags |= WITH_DROP_FFS;
#endif
ret = nand_write_skip_bad(mtd, start, &count, &actual, ret = nand_write_skip_bad(mtd, start, &count, &actual,
lim, buf, WITH_WR_VERIFY); lim, buf, write_flags);
} }
if (ret != 0) { if (ret != 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment