On 09/21/2011 08:55 PM, Marek Vasut wrote: > These commands should work around various "hardware" ECC and BCH methods. > > Signed-off-by: Marek Vasut <marek.va...@gmail.com> > Cc: Scott Wood <scottw...@freescale.com> > Cc: Stefano Babic <sba...@denx.de> > Cc: Wolfgang Denk <w...@denx.de> > Cc: Detlev Zundel <d...@denx.de> > --- > common/cmd_nand.c | 19 +++++++++++++++++-- > doc/README.nand | 9 +++++++++ > 2 files changed, 26 insertions(+), 2 deletions(-) > > V2: Add documentation. > > diff --git a/common/cmd_nand.c b/common/cmd_nand.c > index 66e06a5..72d418c 100644 > --- a/common/cmd_nand.c > +++ b/common/cmd_nand.c > @@ -606,6 +606,20 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char > * const argv[]) > ret = nand->read_oob(nand, off, &ops); > else > ret = nand->write_oob(nand, off, &ops); > + } else if (!strcmp(s, ".raw")) { > + /* Raw access */ > + mtd_oob_ops_t ops = { > + .datbuf = (u8 *)addr, > + .oobbuf = ((u8 *)addr) + nand->writesize, > + .len = nand->writesize, > + .ooblen = nand->oobsize, > + .mode = MTD_OOB_RAW > + }; > + > + if (read) > + ret = nand->read_oob(nand, off, &ops); > + else > + ret = nand->write_oob(nand, off, &ops); > } else { > printf("Unknown nand command suffix '%s'.\n", s); > return 1; > @@ -695,10 +709,11 @@ U_BOOT_CMD( > "NAND sub-system", > "info - show available NAND devices\n" > "nand device [dev] - show or set current device\n" > - "nand read - addr off|partition size\n" > - "nand write - addr off|partition size\n" > + "nand read[.raw] - addr off|partition size\n" > + "nand write[.raw] - addr off|partition size\n" > " read/write 'size' bytes starting at offset 'off'\n" > " to/from memory address 'addr', skipping bad blocks.\n" > + " Use read.raw/write.raw to avoid ECC and write the block as-is.\n"
This says that .raw takes a size parameter, but you assume one page instead. > diff --git a/doc/README.nand b/doc/README.nand > index 751b693..084223a 100644 > --- a/doc/README.nand > +++ b/doc/README.nand > @@ -94,6 +94,15 @@ Commands: > of data for one 512-byte page or 2 256-byte pages. There is no check > for bad blocks. > > + nand read.raw addr ofs|partition size > + Read `size' bytes from `ofs' in NAND flash to `addr'. This reads the > raw > + block, so ECC is avoided and the OOB area is read as well. > + > + nand write.raw addr ofs|partition size > + Write `size' bytes from `addr' to `ofs' in NAND flash. This writes the > raw > + block, so ECC is avoided and the OOB area is written as well, making > the > + whole block written as-is. The current implementation reads/writes a page, not a block, and not 'size' bytes. Should mention that the OOB is expected to immediately follow the main area in memory. -Scott _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot