* [PATCHv2] nanddump: Support 4096+218 and 4096+224 page sizes
@ 2010-05-04 5:10 Kevin Cernekee
2010-05-05 11:26 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Cernekee @ 2010-05-04 5:10 UTC (permalink / raw)
To: dwmw2; +Cc: linux-mtd
Tested with Samsung K9GAG08U0D (4096+218).
This fixes three additional problems found after the initial patch
submission:
1) oobbuf was only 128B. Needs to be 256B now.
2) Random OOB data is output when nanddump hits a bad block, because
the code was initializing readbuf instead.
3) When using "-p", random data is displayed for bytes 218-223 since
the OOB does not end on a 16B boundary.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
nanddump.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/nanddump.c b/nanddump.c
index 678d684..4c0a094 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -174,8 +174,11 @@ static void process_options (int argc, char * const argv[])
/*
* Buffers for reading data from flash
*/
+
+#define NAND_MAX_OOBSIZE 256
+
static unsigned char readbuf[4096];
-static unsigned char oobbuf[128];
+static unsigned char oobbuf[NAND_MAX_OOBSIZE];
/*
* Main program
@@ -209,7 +212,9 @@ int main(int argc, char * const argv[])
}
/* Make sure device page sizes are valid */
- if (!(meminfo.oobsize == 128 && meminfo.writesize == 4096) &&
+ if (!(meminfo.oobsize == 224 && meminfo.writesize == 4096) &&
+ !(meminfo.oobsize == 218 && meminfo.writesize == 4096) &&
+ !(meminfo.oobsize == 128 && meminfo.writesize == 4096) &&
!(meminfo.oobsize == 64 && meminfo.writesize == 2048) &&
!(meminfo.oobsize == 32 && meminfo.writesize == 1024) &&
!(meminfo.oobsize == 16 && meminfo.writesize == 512) &&
@@ -354,9 +359,8 @@ int main(int argc, char * const argv[])
if (omitoob)
continue;
- if (badblock) {
- memset (readbuf, 0xff, meminfo.oobsize);
- } else {
+ memset (oobbuf, 0xff, NAND_MAX_OOBSIZE);
+ if (!badblock) {
/* Read OOB data and exit on failure */
oob.start = ofs;
if (ioctl(fd, MEMREADOOB, &oob) != 0) {
--
1.6.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2] nanddump: Support 4096+218 and 4096+224 page sizes
2010-05-04 5:10 [PATCHv2] nanddump: Support 4096+218 and 4096+224 page sizes Kevin Cernekee
@ 2010-05-05 11:26 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-05-05 11:26 UTC (permalink / raw)
To: Kevin Cernekee; +Cc: linux-mtd, dwmw2
On Mon, 2010-05-03 at 22:10 -0700, Kevin Cernekee wrote:
> Tested with Samsung K9GAG08U0D (4096+218).
>
> This fixes three additional problems found after the initial patch
> submission:
>
> 1) oobbuf was only 128B. Needs to be 256B now.
>
> 2) Random OOB data is output when nanddump hits a bad block, because
> the code was initializing readbuf instead.
>
> 3) When using "-p", random data is displayed for bytes 218-223 since
> the OOB does not end on a 16B boundary.
>
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Does not apply to the latest mtd-utils:
Applying: nanddump: Support 4096+218 and 4096+224 page sizes
error: patch failed: nanddump.c:209
error: nanddump.c: patch does not apply
Patch failed at 0001 nanddump: Support 4096+218 and 4096+224 page sizes
When you have resolved this problem run "git am -i --resolved".
If you would prefer to skip this patch, instead run "git am -i --skip".
To restore the original branch and stop patching run "git am -i --abort".
[dedekind@eru mtd-utils]$ patch -p1 < .git/rebase-apply/patch
patching file nanddump.c
Hunk #2 FAILED at 212.
Hunk #3 succeeded at 359 (offset 2 lines).
1 out of 3 hunks FAILED -- saving rejects to file nanddump.c.rej
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-05 11:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-04 5:10 [PATCHv2] nanddump: Support 4096+218 and 4096+224 page sizes Kevin Cernekee
2010-05-05 11:26 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).