From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Tue, 15 Nov 2016 00:18:23 -0600 Subject: [U-Boot] [PATCH] cmd/nand.c: Debug additional helpful NAND info In-Reply-To: <1476072508-8349-1-git-send-email-engkhalil86@gmail.com> References: <1476072508-8349-1-git-send-email-engkhalil86@gmail.com> Message-ID: <1479190703.21746.32.camel@buserror.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, 2016-10-10 at 06:08 +0200, Ahmed Samir Khalil wrote: > 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 > --- > ?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); > + } Please use standard U-Boot coding style. -Scott