cmd: nand: various updates
cover cmd: nand: various updates
Bug fix of name changed OOB placement option
Change ambiguous 'count' to 'pages' for read/write raw nand dump display update to show ASCII characters and data offset
into NAND
Add option to nand dump with ECC corrected data
david regan (4):
cmd: nand: bug fix MTD_OOB_AUTO to MTD_OPS_AUTO_OOB
cmd: nand: more descriptive help info
cmd: nand: nand dump display update
cmd: nand: nand dump with ecc option
cmd/nand.c | 56 +++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 28 deletions(-)
Signature · 1 line
2.43.5
PATCH 1/4 cmd: nand: bug fix MTD_OOB_AUTO to MTD_OPS_AUTO_OOB
bug fix MTD_OOB_AUTO to MTD_OPS_AUTO_OOB since MTD_OOB_AUTO does not exist
--- cmd/nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/nand.c +1 -1
@@ -412,7 +412,7 @@ int do_nand_env_oob(struct cmd_tbl *cmdtp, int argc, char *const argv[]) } ops.datbuf =NULL ; - ops.mode =MTD_OOB_AUTO ; + ops.mode =MTD_OPS_AUTO_OOB ; ops.ooboffs =0 ; ops.ooblen =ENV_OFFSET_SIZE ; ops.oobbuf = (void *) oob_buf;
Signature · 1 line
2.43.5
Re: [PATCH 1/4] cmd: nand: bug fix MTD_OOB_AUTO to MTD_OPS_AUTO_OOB
Hi David,
Quoted 2 lines · david regan
bug fix
MTD_OOB_AUTOtoMTD_OPS_AUTO_OOBsinceMTD_OOB_AUTOdoes not exist
There's also env/nand.c which uses this, can you also fix it?
Please also add:
To the commit log which i believe is the commit that introduced the issue?
Only a 12yo bug you just found, nice catch :)
Cheers,
Quentin
Re: [PATCH 1/4] cmd: nand: bug fix MTD_OOB_AUTO to MTD_OPS_AUTO_OOB
Hi
Quoted 9 lines · Quentin Schulz
Hi David,
Quoted 1 line · david regan
bug fix
MTD_OOB_AUTOtoMTD_OPS_AUTO_OOBsinceMTD_OOB_AUTOdoes notexist
Quoted 1 line
There's also
env/nand.cwhich uses this, can you also fix it?
Quoted 9 lines
Please also add:
Fixes dfe64e2c8973 ("mtd: resync with Linux-3.7.1")To the commit log which i believe is the commit that introduced the issue?
Only a 12yo bug you just found, nice catch :)
After I get a Fixes: tag then I will queue with other patches
Michael
Quoted 3 lines
Cheers,
Quentin
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH 1/4] cmd: nand: bug fix MTD_OOB_AUTO to MTD_OPS_AUTO_OOB
In reply to Quentin SchulzQuoted 8 lines · Quentin Schulz
Hi David,
Quoted 2 lines · david regan
bug fix
MTD_OOB_AUTOtoMTD_OPS_AUTO_OOBsinceMTD_OOB_AUTOdoes not existThere's also
env/nand.cwhich uses this, can you also fix it?
Thank you very much for checking on this and the tag, I'll fix in env/nand.c as well.
Quoted 8 lines
Please also add:
Fixes dfe64e2c8973 ("mtd: resync with Linux-3.7.1")To the commit log which i believe is the commit that introduced the issue?
Only a 12yo bug you just found, nice catch :)
Only 12 years? I can do better than that ;)
Quoted 3 lines
Cheers,
Quentin
-Dave
PATCH 2/4 cmd: nand: more descriptive help info
In reply to david regannand read/write raw change 'count' to 'pages' since count is ambiguous
--- cmd/nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
cmd/nand.c +2 -2
@@ -1026,8 +1026,8 @@ U_BOOT_LONGHELP(nand,"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" -"nand read.raw - addr off|partition [count]\n" -"nand write.raw[.noverify] - addr off|partition [count]\n" +"nand read.raw - addr off|partition [pages]\n" +"nand write.raw[.noverify] - addr off|partition [pages]\n" " Use read.raw/write.raw to avoid ECC and access the flash as-is.\n" #ifdef CONFIG_CMD_NAND_TRIMFFS"nand write.trimffs - addr off|partition size\n"
Signature · 1 line
2.43.5
PATCH 3/4 cmd: nand: nand dump display update
In reply to david reganshow characters with nand dump similar to md
along with offset into NAND
--- cmd/nand.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
cmd/nand.c +7 -18
@@ -37,6 +37,7 @@#include <asm/byteorder.h> #include <jffs2/jffs2.h> #include <nand.h> +#include <display_options.h> #include "legacy-mtd-utils.h"
@@ -198,30 +199,18 @@ static int nand_dump(struct mtd_info *mtd, ulong off, int only_oob, ret =1 ; goto free_all; } -printf ("Page %08lx dump:\n" , off); +printf ("\nPage at offset %08lx dump:\n" , off);if (!only_oob) { - i = mtd->writesize >>4 ; + i = mtd->writesize; p = datbuf; - -while (i--) { -printf ("\t%02x %02x %02x %02x %02x %02x %02x %02x" -" %02x %02x %02x %02x %02x %02x %02x %02x\n" , - p[0 ], p[1 ], p[2 ], p[3 ], p[4 ], p[5 ], p[6 ], p[7 ], - p[8 ], p[9 ], p[10 ], p[11 ], p[12 ], p[13 ], p[14 ], - p[15 ]); - p +=16 ; - } +print_buffer (off, p,1 , i,16 ); } -puts ("OOB:\n" ); - i = mtd->oobsize >>3 ; +puts ("\nOOB:\n" ); + i = mtd->oobsize; p = oobbuf; -while (i--) { -printf ("\t%02x %02x %02x %02x %02x %02x %02x %02x\n" , - p[0 ], p[1 ], p[2 ], p[3 ], p[4 ], p[5 ], p[6 ], p[7 ]); - p +=8 ; - } +print_buffer (0 , p,1 , i,8 ); free_all:free (oobbuf);
Signature · 1 line
2.43.5
PATCH 4/4 cmd: nand: nand dump with ecc option
In reply to david reganoption to show nand dump data ecc corrected as opposed to just raw
--- cmd/nand.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
cmd/nand.c +18 -7
@@ -160,7 +160,7 @@ free_memory: }static int nand_dump (struct mtd_info *mtd,ulong off,int only_oob, -int repeat) +int ecc,int repeat) {int i;u_char *datbuf, *oobbuf, *p;
@@ -192,12 +192,16 @@ static int nand_dump(struct mtd_info *mtd, ulong off, int only_oob, ops.oobbuf = oobbuf; ops.len = mtd->writesize; ops.ooblen = mtd->oobsize; - ops.mode =MTD_OPS_RAW ; +if (ecc) + ops.mode =MTD_OPS_PLACE_OOB ; +else + ops.mode =MTD_OPS_RAW ; i =mtd_read_oob (mtd, addr, &ops);if (i <0 ) { -printf ("Error (%d) reading page %08lx\n" , i, off); +printf ("Error reading page at offset %08lx, %d %s\n" , + off, i, i == -EUCLEAN ?"correctable" : +"uncorrectable, dumping raw data" ); ret =1 ; - goto free_all; }printf ("\nPage at offset %08lx dump:\n" , off);
@@ -212,7 +216,6 @@ static int nand_dump(struct mtd_info *mtd, ulong off, int only_oob, p = oobbuf;print_buffer (0 , p,1 , i,8 ); -free_all:free (oobbuf); free_dat:free (datbuf);
@@ -697,11 +700,19 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc, }if (strncmp (cmd,"dump" ,4 ) ==0 ) { +int only_oob, ecc; +if (argc <3 ) goto usage; + only_oob = !strcmp (&cmd[4 ],".oob" ) || !strcmp (&cmd[4 ],".ecc.oob" ) || + !strcmp (&cmd[4 ],".oob.ecc" ); + + ecc = !strcmp (&cmd[4 ],".ecc" ) || !strcmp (&cmd[4 ],".ecc.oob" ) || + !strcmp (&cmd[4 ],".oob.ecc" ); + off = (int )hextoul (argv[2 ],NULL ); - ret =nand_dump (mtd, off, !strcmp (&cmd[4 ],".oob" ), repeat); + ret =nand_dump (mtd, off, only_oob, ecc, repeat);return ret ==0 ?1 :0 ; }
@@ -1031,7 +1042,7 @@ U_BOOT_LONGHELP(nand,"nand erase.part [clean] partition - erase entire mtd partition'\n" "nand erase.chip [clean] - erase entire chip'\n" "nand bad - show bad blocks\n" -"nand dump[.oob] off - dump page\n" +"nand dump[.oob][.ecc] off - dump raw (default) or ecc corrected page at offset\n" #ifdef CONFIG_CMD_NAND_WATCH"nand watch <off> <size> - check an area for bitflips\n" "nand watch.part <part> - check a partition for bitflips\n"
Signature · 1 line
2.43.5