diff options
author | Ben Gardiner <bengardiner@nanometrics.ca> | 2011-06-14 16:35:07 -0400 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2011-07-01 15:56:51 -0500 |
commit | c9494866df835bcee68e17339aec1090faa704da (patch) | |
tree | a1c782909c323bf839403dc3c0abb124567a99e2 /common | |
parent | 169d54d8b33b4d06d6f215e2b312a0b18f7909dc (diff) | |
download | u-boot-imx-c9494866df835bcee68e17339aec1090faa704da.zip u-boot-imx-c9494866df835bcee68e17339aec1090faa704da.tar.gz u-boot-imx-c9494866df835bcee68e17339aec1090faa704da.tar.bz2 |
cmd_nand: add nand write.trimffs command
Add another nand write. variant, trimffs. This command will request of
nand_write_skip_bad() that all trailing all-0xff pages will be
dropped from eraseblocks when they are written to flash as-per the
reccommended behaviour of the UBI FAQ [1].
The function that implements this timming is the drop_ffs() function
by Artem Bityutskiy, ported from the mtd-utils tree.
[1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Artem Bityutskiy <dedekind1@gmail.com>
CC: Detlev Zundel <dzu@denx.de>
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_nand.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 27a8879..b767cd2 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -575,6 +575,16 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) else ret = nand_write_skip_bad(nand, off, &rwsize, (u_char *)addr, 0); +#ifdef CONFIG_CMD_NAND_TRIMFFS + } else if (!strcmp(s, ".trimffs")) { + if (read) { + printf("Unknown nand command suffix '%s'\n", s); + return 1; + } + ret = nand_write_skip_bad(nand, off, &rwsize, + (u_char *)addr, + WITH_DROP_FFS); +#endif #ifdef CONFIG_CMD_NAND_YAFFS } else if (!strcmp(s, ".yaffs")) { if (read) { @@ -689,6 +699,12 @@ U_BOOT_CMD( "nand write - addr off|partition size\n" " read/write 'size' bytes starting at offset 'off'\n" " to/from memory address 'addr', skipping bad blocks.\n" +#ifdef CONFIG_CMD_NAND_TRIMFFS + "nand write.trimffs - addr off|partition size\n" + " write 'size' bytes starting at offset 'off' from memory address\n" + " 'addr', skipping bad blocks and dropping any pages at the end\n" + " of eraseblocks that contain only 0xFF\n" +#endif #ifdef CONFIG_CMD_NAND_YAFFS "nand write.yaffs - addr off|partition size\n" " write 'size' bytes starting at offset 'off' with yaffs format\n" |