Commit fb3659ac422801ea18f36ef62926df70beeada4c
Committed by
Scott Wood
1 parent
6d41419f0b
Exists in
master
and in
57 other branches
NAND: Add nand read.raw and write.raw commands
These commands should work around various "hardware" ECC and BCH methods. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Scott Wood <scottwood@freescale.com> Cc: Stefano Babic <sbabic@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: Detlev Zundel <dzu@denx.de> [scottwood@freescale.com: s/write the page/access the page/] Signed-off-by: Scott Wood <scottwood@freescale.com>
Showing 2 changed files with 28 additions and 0 deletions Side-by-side Diff
common/cmd_nand.c
| ... | ... | @@ -602,6 +602,22 @@ |
| 602 | 602 | ret = nand->read_oob(nand, off, &ops); |
| 603 | 603 | else |
| 604 | 604 | ret = nand->write_oob(nand, off, &ops); |
| 605 | + } else if (!strcmp(s, ".raw")) { | |
| 606 | + /* Raw access */ | |
| 607 | + mtd_oob_ops_t ops = { | |
| 608 | + .datbuf = (u8 *)addr, | |
| 609 | + .oobbuf = ((u8 *)addr) + nand->writesize, | |
| 610 | + .len = nand->writesize, | |
| 611 | + .ooblen = nand->oobsize, | |
| 612 | + .mode = MTD_OOB_RAW | |
| 613 | + }; | |
| 614 | + | |
| 615 | + rwsize = nand->writesize + nand->oobsize; | |
| 616 | + | |
| 617 | + if (read) | |
| 618 | + ret = nand->read_oob(nand, off, &ops); | |
| 619 | + else | |
| 620 | + ret = nand->write_oob(nand, off, &ops); | |
| 605 | 621 | } else { |
| 606 | 622 | printf("Unknown nand command suffix '%s'.\n", s); |
| 607 | 623 | return 1; |
| ... | ... | @@ -695,6 +711,9 @@ |
| 695 | 711 | "nand write - addr off|partition size\n" |
| 696 | 712 | " read/write 'size' bytes starting at offset 'off'\n" |
| 697 | 713 | " to/from memory address 'addr', skipping bad blocks.\n" |
| 714 | + "nand read.raw - addr off|partition\n" | |
| 715 | + "nand write.raw - addr off|partition\n" | |
| 716 | + " Use read.raw/write.raw to avoid ECC and access the page as-is.\n" | |
| 698 | 717 | #ifdef CONFIG_CMD_NAND_TRIMFFS |
| 699 | 718 | "nand write.trimffs - addr off|partition size\n" |
| 700 | 719 | " write 'size' bytes starting at offset 'off' from memory address\n" |
doc/README.nand
| ... | ... | @@ -94,6 +94,15 @@ |
| 94 | 94 | of data for one 512-byte page or 2 256-byte pages. There is no check |
| 95 | 95 | for bad blocks. |
| 96 | 96 | |
| 97 | + nand read.raw addr ofs|partition | |
| 98 | + Read page from `ofs' in NAND flash to `addr'. This reads the raw page, | |
| 99 | + so ECC is avoided and the OOB area is read as well. | |
| 100 | + | |
| 101 | + nand write.raw addr ofs|partition | |
| 102 | + Write page from `addr' to `ofs' in NAND flash. This writes the raw page, | |
| 103 | + so ECC is avoided and the OOB area is written as well, making the whole | |
| 104 | + page written as-is. | |
| 105 | + | |
| 97 | 106 | Configuration Options: |
| 98 | 107 | |
| 99 | 108 | CONFIG_CMD_NAND |