Skip to contentSkip to conversation

cmd/nand.c: Debug additional helpful NAND info

PATCH New Ahmed Samir Khalil 2 participants 2 messages Oct 10, 2016 – Nov 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd/nand.c: Debug additional helpful NAND info

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.

---
 cmd/nand.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
cmd/nand.c +26 -0
index c16ec77..ec7f1df 100644
@@ -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);
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 cmd/nand.c: Debug additional helpful NAND info

Quoted 43 lines · Ahmed Samir Khalil

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.

---
?cmd/nand.c | 26 ++++++++++++++++++++++++++
?1 file changed, 26 insertions(+)

cmd/nand.c +0 -0
index c16ec77..ec7f1df 100644
@@ -283,6 +283,9 @@ usage:

?
?static void nand_print_and_set_info(int idx)
?{

cmd/nand.c +3 -0
+#ifdef DEBUG
+	unsigned int i;
+#endif

? struct mtd_info *mtd = nand_info[idx];
? struct nand_chip *chip = mtd_to_nand(mtd);
?

cmd/nand.c +0 -0
@@ -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);

?

cmd/nand.c +9 -0
+#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-
Quoted 1 line

oobfree[i].offset);

cmd/nand.c +3 -0
+
+		if( !(nand->ecclayout->oobfree[i].length<0) )
+			printf(".length=%d}, \n", nand->ecclayout-
Quoted 1 line

oobfree[i].length);

cmd/nand.c

Quoted 1 line
cmd/nand.c +1 -0
+	}

Please use standard U-Boot coding style.

-Scott