[PATCH 2/2] mtd-utils (nandwrite + nanddump): Support 4096+218, 4096+224 OOB
Brian Norris
norris at broadcom.com
Fri Jun 25 20:58:04 EDT 2010
Parts of this are a resubmission of this patch:
http://lists.infradead.org/pipermail/linux-mtd/2010-May/029885.html
This was tested with Samsung K9GAG08U0D.
Signed-off-by: Brian Norris <norris at broadcom.com>
---
nanddump.c | 8 ++++++--
nandwrite.c | 6 ++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/nanddump.c b/nanddump.c
index 190a653..b0dd227 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -174,8 +174,12 @@ static void process_options (int argc, char * const argv[])
/*
* Buffers for reading data from flash
*/
-static unsigned char readbuf[4096];
-static unsigned char oobbuf[128];
+
+#define NAND_MAX_PAGESIZE 4096
+#define NAND_MAX_OOBSIZE 256
+
+static unsigned char readbuf[NAND_MAX_PAGESIZE];
+static unsigned char oobbuf[NAND_MAX_OOBSIZE];
/*
* Main program
diff --git a/nandwrite.c b/nandwrite.c
index 1b4ca3d..0d59171 100644
--- a/nandwrite.c
+++ b/nandwrite.c
@@ -43,7 +43,7 @@
#define VERSION "$Revision: 1.32 $"
#define MAX_PAGE_SIZE 4096
-#define MAX_OOB_SIZE 128
+#define MAX_OOB_SIZE 256
// oob layouts to pass into the kernel as default
static struct nand_oobinfo none_oobinfo = {
@@ -302,7 +302,9 @@ int main(int argc, char * const argv[])
!(meminfo.oobsize == 8 && meminfo.writesize == 256) &&
!(meminfo.oobsize == 64 && meminfo.writesize == 2048) &&
!(meminfo.oobsize == 64 && meminfo.writesize == 4096) &&
- !(meminfo.oobsize == 128 && meminfo.writesize == 4096)) {
+ !(meminfo.oobsize == 128 && meminfo.writesize == 4096) &&
+ !(meminfo.oobsize == 218 && meminfo.writesize == 4096) &&
+ !(meminfo.oobsize == 224 && meminfo.writesize == 4096)) {
fprintf(stderr, "Unknown flash (not normal NAND)\n");
close(fd);
exit (EXIT_FAILURE);
--
1.7.1
More information about the linux-mtd
mailing list