mtd/util nandwrite.c,1.10,1.11
gleixner at infradead.org
gleixner at infradead.org
Thu May 6 02:47:16 EDT 2004
Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv12538
Modified Files:
nandwrite.c
Log Message:
Make big nand work and fix oob structures
Index: nandwrite.c
===================================================================
RCS file: /home/cvs/mtd/util/nandwrite.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- nandwrite.c 5 May 2004 12:20:30 -0000 1.10
+++ nandwrite.c 6 May 2004 06:47:13 -0000 1.11
@@ -52,11 +52,13 @@
struct nand_oobinfo jffs2_oobinfo = {
.useecc = MTD_NANDECC_PLACE,
+ .eccbytes = 6,
.eccpos = { 0, 1, 2, 3, 6, 7 }
};
struct nand_oobinfo yaffs_oobinfo = {
.useecc = MTD_NANDECC_PLACE,
+ .eccbytes = 6,
.eccpos = { 8, 9, 10, 13, 14, 15}
};
@@ -202,8 +204,9 @@
/* Make sure device page sizes are valid */
if (!(meminfo.oobsize == 16 && meminfo.oobblock == 512) &&
- !(meminfo.oobsize == 8 && meminfo.oobblock == 256)) {
- printf("Unknown flash (not normal NAND)\n");
+ !(meminfo.oobsize == 8 && meminfo.oobblock == 256) &&
+ !(meminfo.oobsize == 64 && meminfo.oobblock == 2048)) {
+ fprintf(stderr, "Unknown flash (not normal NAND)\n");
close(fd);
exit(1);
}
@@ -229,6 +232,17 @@
// force oob layout for jffs2 or yaffs ?
if (forcejffs2 || forceyaffs) {
struct nand_oobinfo *oobsel = forcejffs2 ? &jffs2_oobinfo : &yaffs_oobinfo;
+
+ if (forceyaffs && meminfo.oobsize == 8) {
+ if (forceyaffs) {
+ fprintf (stderr, "YAFSS cannot operate on 256 Byte page size");
+ close (fd);
+ exit (1);
+ }
+ /* Adjust number of ecc bytes */
+ jffs2_oobinfo.eccbytes = 3;
+ }
+
if (ioctl (fd, MEMSETOOBSEL, oobsel) != 0) {
perror ("MEMSETOOBSEL");
close (fd);
More information about the linux-mtd-cvs
mailing list