From: Jason McMullan <mcmullan@netapp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] nand: Make 'nand dump.oob' actually work
Date: Tue, 1 Jul 2008 13:48:22 -0400 (EDT) [thread overview]
Message-ID: <20080701174822.651246CF71@mcmullan-linux.hq.netapp.com> (raw)
Currently, "nand dump.oob" is a no-op.
This commit makes it functional.
Signed-off-by: Jason McMullan <mcmullan@netapp.com>
---
common/cmd_nand.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 37198d2..f85ef09 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -39,6 +39,33 @@ int find_dev_and_part(const char *id, struct mtd_device **dev,
static int nand_dump_oob(nand_info_t *nand, ulong off)
{
+ int i;
+ size_t read_bytes;
+ u_char *buf, *p;
+
+ buf = malloc(nand->oobsize);
+ if (!buf) {
+ puts("No memory for oob buffer\n");
+ return 1;
+ }
+ off &= ~(nand->oobblock - 1);
+ i = nand->read_oob(nand, off, nand->oobsize, &read_bytes, buf);
+ if (i < 0) {
+ printf("Error (%d) reading page %08x\n", i, off);
+ free(buf);
+ return 1;
+ }
+ printf("Page %08x OOB:\n", off);
+ i = nand->oobsize >> 3;
+ p = buf;
+ while (i--) {
+ printf( "\t%02x %02x %02x %02x %02x %02x %02x %02x\n",
+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
+ p += 8;
+ }
+ free(buf);
+
+
return 0;
}
--
1.5.4.3
next reply other threads:[~2008-07-01 17:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-01 17:48 Jason McMullan [this message]
[not found] <20080701173734.ADFE76CB5C@mcmullan-linux.hq.netapp.com>
2008-07-01 18:03 ` [U-Boot-Users] [PATCH] nand: Make 'nand dump.oob' actually work Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080701174822.651246CF71@mcmullan-linux.hq.netapp.com \
--to=mcmullan@netapp.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox