public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ahmed Samir Khalil <engkhalil86@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd/nand.c: Debug additional helpful NAND info
Date: Mon, 10 Oct 2016 06:08:28 +0200	[thread overview]
Message-ID: <1476072508-8349-1-git-send-email-engkhalil86@gmail.com> (raw)

While dealing with large chips (e.g. page: 4KB, OOB:224),
 we found it helpful to get these additional NAND info by
 enabling the DEBUG macro instead of full tracing every time
 and consuming time. Especially about the currently in use
 scheme for testing & development.

Signed-off-by: Ahmed Samir Khalil <engkhalil86@gmail.com>
---
 cmd/nand.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/cmd/nand.c b/cmd/nand.c
index c16ec77..ec7f1df 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -283,6 +283,9 @@ usage:
 
 static void nand_print_and_set_info(int idx)
 {
+#ifdef DEBUG
+	unsigned int i;
+#endif
 	struct mtd_info *mtd = nand_info[idx];
 	struct nand_chip *chip = mtd_to_nand(mtd);
 
@@ -298,6 +301,29 @@ static void nand_print_and_set_info(int idx)
 	printf("  options     0x%8x\n", chip->options);
 	printf("  bbt options 0x%8x\n", chip->bbt_options);
 
+#ifdef DEBUG
+	printf("  Chip delay  %7d us\n", chip->chip_delay);
+	printf("  ECC bytes   %8d b\n", nand->ecclayout->eccbytes);
+	printf("  OOB available %6d b\n\n", nand->ecclayout->oobavail);
+
+	printf("  OOB free = {\n");
+	for (i=0; i < nand->ecclayout->oobfree[i].length; i++) {
+		if( !(nand->ecclayout->oobfree[i].offset<0) )
+			printf("	{.offset=%d, ", nand->ecclayout->oobfree[i].offset);
+
+		if( !(nand->ecclayout->oobfree[i].length<0) )
+			printf(".length=%d}, \n", nand->ecclayout->oobfree[i].length);
+	}
+
+	printf("  };\n\n");
+	printf("  ECC positions = {\n");
+	for (i=0; i < MTD_MAX_ECCPOS_ENTRIES_LARGE; i++) {
+		if(nand->ecclayout->eccpos[i]>0)
+			printf("%d, ", nand->ecclayout->eccpos[i]);
+	}
+	printf("\n  };\n\n");
+#endif
+
 	/* Set geometry info */
 	setenv_hex("nand_writesize", mtd->writesize);
 	setenv_hex("nand_oobsize", mtd->oobsize);
-- 
2.7.4

             reply	other threads:[~2016-10-10  4:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10  4:08 Ahmed Samir Khalil [this message]
2016-11-15  6:18 ` [U-Boot] [PATCH] cmd/nand.c: Debug additional helpful NAND info 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=1476072508-8349-1-git-send-email-engkhalil86@gmail.com \
    --to=engkhalil86@gmail.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