aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@gmail.com>2006-05-27 10:10:03 -0500
committerJosh Boyer <jwboyer@gmail.com>2006-05-27 10:10:03 -0500
commit69358f79c0523f40001aebb6e43b2401b3a3e070 (patch)
tree4c5b382d02870a6a30a67a75d49ebd916e52ec6d
parenta96ff574c24dab891c4061d2103815e34aeb78f8 (diff)
parentc712b2344e47101df11f46997508bf96b9f4e24e (diff)
Merge git://git.infradead.org/users/joern/utils
-rw-r--r--docfdisk.c16
-rw-r--r--flash_otp_write.c6
-rw-r--r--mtd_debug.c4
-rw-r--r--nanddump.c10
-rw-r--r--nandwrite.c20
5 files changed, 28 insertions, 28 deletions
diff --git a/docfdisk.c b/docfdisk.c
index b275df9..4d2dab4 100644
--- a/docfdisk.c
+++ b/docfdisk.c
@@ -194,7 +194,7 @@ int main(int argc, char **argv)
meminfo.size, meminfo.erasesize);
buf = malloc(meminfo.erasesize);
- oobbuf = malloc((meminfo.erasesize / meminfo.oobblock) * meminfo.oobsize);
+ oobbuf = malloc((meminfo.erasesize / meminfo.writesize) * meminfo.oobsize);
if (!buf || !oobbuf) {
printf("Can't malloc block buffer\n");
return 1;
@@ -227,12 +227,12 @@ int main(int argc, char **argv)
oob.ptr = oobbuf;
oob.start = mhoffs;
- for (i = 0; i < meminfo.erasesize; i += meminfo.oobblock) {
+ for (i = 0; i < meminfo.erasesize; i += meminfo.writesize) {
if (ioctl(fd, MEMREADOOB, &oob)) {
perror("ioctl(MEMREADOOB)");
return 1;
}
- oob.start += meminfo.oobblock;
+ oob.start += meminfo.writesize;
oob.ptr += meminfo.oobsize;
}
@@ -292,27 +292,27 @@ int main(int argc, char **argv)
oob.ptr = oobbuf;
oob.start = mhoffs;
- for (i = 0; i < meminfo.erasesize; i += meminfo.oobblock) {
+ for (i = 0; i < meminfo.erasesize; i += meminfo.writesize) {
memset(oob.ptr, 0xff, 6); // clear ECC.
if (ioctl(fd, MEMWRITEOOB, &oob)) {
perror("ioctl(MEMWRITEOOB)");
printf("Your MediaHeader may be hosed. UHOH!\n");
return 1;
}
- if ((ret = pwrite(fd, buf, meminfo.oobblock, oob.start)) < 0) {
+ if ((ret = pwrite(fd, buf, meminfo.writesize, oob.start)) < 0) {
perror("Write page");
printf("Your MediaHeader may be hosed. UHOH!\n");
return 1;
}
- if (ret != meminfo.oobblock) {
+ if (ret != meminfo.writesize) {
printf("Short write!\n");
printf("Your MediaHeader may be hosed. UHOH!\n");
return 1;
}
- oob.start += meminfo.oobblock;
+ oob.start += meminfo.writesize;
oob.ptr += meminfo.oobsize;
- buf += meminfo.oobblock;
+ buf += meminfo.writesize;
}
printf("Success. REBOOT or unload the diskonchip module to update partitions!\n");
diff --git a/flash_otp_write.c b/flash_otp_write.c
index 71d3168..4cadcdf 100644
--- a/flash_otp_write.c
+++ b/flash_otp_write.c
@@ -59,7 +59,7 @@ int main(int argc,char *argv[])
printf("Writing OTP user data on %s at offset 0x%lx\n", argv[2], offset);
if (mtdInfo.type == MTD_NANDFLASH)
- len = mtdInfo.oobblock;
+ len = mtdInfo.writesize;
else
len = 256;
@@ -73,8 +73,8 @@ int main(int argc,char *argv[])
while (size > 0) {
if (mtdInfo.type == MTD_NANDFLASH) {
/* Fill remain buffers with 0xff */
- memset(buf + size, 0xff, mtdInfo.oobblock - size);
- size = mtdInfo.oobblock;
+ memset(buf + size, 0xff, mtdInfo.writesize - size);
+ size = mtdInfo.writesize;
}
ret = write(fd, p, size);
if (ret < 0) {
diff --git a/mtd_debug.c b/mtd_debug.c
index 7d1223c..2a24177 100644
--- a/mtd_debug.c
+++ b/mtd_debug.c
@@ -319,8 +319,8 @@ int showinfo (int fd)
printf ("\nmtd.erasesize = ");
printsize (mtd.erasesize);
- printf ("\nmtd.oobblock = ");
- printsize (mtd.oobblock);
+ printf ("\nmtd.writesize = ");
+ printsize (mtd.writesize);
printf ("\nmtd.oobsize = ");
printsize (mtd.oobsize);
diff --git a/nanddump.c b/nanddump.c
index a010387..a03c79a 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -192,9 +192,9 @@ int main(int argc, char **argv)
}
/* Make sure device page sizes are valid */
- if (!(meminfo.oobsize == 64 && meminfo.oobblock == 2048) &&
- !(meminfo.oobsize == 16 && meminfo.oobblock == 512) &&
- !(meminfo.oobsize == 8 && meminfo.oobblock == 256)) {
+ if (!(meminfo.oobsize == 64 && meminfo.writesize == 2048) &&
+ !(meminfo.oobsize == 16 && meminfo.writesize == 512) &&
+ !(meminfo.oobsize == 8 && meminfo.writesize == 256)) {
fprintf(stderr, "Unknown flash (not normal NAND)\n");
close(fd);
exit(1);
@@ -232,10 +232,10 @@ int main(int argc, char **argv)
if (!length || end_addr > meminfo.size)
end_addr = meminfo.size;
- bs = meminfo.oobblock;
+ bs = meminfo.writesize;
/* Print informative message */
- fprintf(stderr, "Block size %u, page size %u, OOB size %u\n", meminfo.erasesize, meminfo.oobblock, meminfo.oobsize);
+ fprintf(stderr, "Block size %u, page size %u, OOB size %u\n", meminfo.erasesize, meminfo.writesize, meminfo.oobsize);
fprintf(stderr, "Dumping data starting at 0x%08x and ending at 0x%08x...\n",
(unsigned int) start_addr, (unsigned int) end_addr);
diff --git a/nandwrite.c b/nandwrite.c
index fe19b82..10489b7 100644
--- a/nandwrite.c
+++ b/nandwrite.c
@@ -240,9 +240,9 @@ int main(int argc, char **argv)
meminfo.erasesize *= blockalign;
/* Make sure device page sizes are valid */
- if (!(meminfo.oobsize == 16 && meminfo.oobblock == 512) &&
- !(meminfo.oobsize == 8 && meminfo.oobblock == 256) &&
- !(meminfo.oobsize == 64 && meminfo.oobblock == 2048)) {
+ if (!(meminfo.oobsize == 16 && meminfo.writesize == 512) &&
+ !(meminfo.oobsize == 8 && meminfo.writesize == 256) &&
+ !(meminfo.oobsize == 64 && meminfo.writesize == 2048)) {
fprintf(stderr, "Unknown flash (not normal NAND)\n");
close(fd);
exit(1);
@@ -319,7 +319,7 @@ int main(int argc, char **argv)
imglen = lseek(ifd, 0, SEEK_END);
lseek (ifd, 0, SEEK_SET);
- pagelen = meminfo.oobblock + ((writeoob == 1) ? meminfo.oobsize : 0);
+ pagelen = meminfo.writesize + ((writeoob == 1) ? meminfo.oobsize : 0);
// Check, if file is pagealigned
if ((!pad) && ((imglen % pagelen) != 0)) {
@@ -328,9 +328,9 @@ int main(int argc, char **argv)
}
// Check, if length fits into device
- if ( ((imglen / pagelen) * meminfo.oobblock) > (meminfo.size - mtdoffset)) {
+ if ( ((imglen / pagelen) * meminfo.writesize) > (meminfo.size - mtdoffset)) {
fprintf (stderr, "Image %d bytes, NAND page %d bytes, OOB area %u bytes, device size %u bytes\n",
- imglen, pagelen, meminfo.oobblock, meminfo.size);
+ imglen, pagelen, meminfo.writesize, meminfo.size);
perror ("Input file does not fit into device");
goto closeall;
}
@@ -370,11 +370,11 @@ int main(int argc, char **argv)
}
- readlen = meminfo.oobblock;
+ readlen = meminfo.writesize;
if (pad && (imglen < readlen))
{
readlen = imglen;
- memset(writebuf + readlen, 0xff, meminfo.oobblock - readlen);
+ memset(writebuf + readlen, 0xff, meminfo.writesize - readlen);
}
/* Read Page Data from input file */
@@ -428,12 +428,12 @@ int main(int argc, char **argv)
}
/* Write out the Page data */
- if (pwrite(fd, writebuf, meminfo.oobblock, mtdoffset) != meminfo.oobblock) {
+ if (pwrite(fd, writebuf, meminfo.writesize, mtdoffset) != meminfo.writesize) {
perror ("pwrite");
goto closeall;
}
imglen -= readlen;
- mtdoffset += meminfo.oobblock;
+ mtdoffset += meminfo.writesize;
}
closeall: