[U-Boot] [PATCH 4/5 V2] NAND: Make page, erase, oob size available via cmd_nand

Marek Vasut
2011-09-27T19:38:59Z

On Tuesday, September 27, 2011 09:01:53 PM Scott Wood wrote:
> On Thu, Sep 22, 2011 at 03:57:26AM +0200, Marek Vasut wrote:
> > diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> > index 72d418c..2f8723f 100644
> > --- a/common/cmd_nand.c
> > +++ b/common/cmd_nand.c
> >
> > @@ -362,15 +362,34 @@ usage:
> > #endif
> >
> > -static void nand_print_info(int idx)
> > +static void nand_print_and_set_info(int idx)
> >
> > {
> >
> > nand_info_t *nand = &nand_info[idx];
> > struct nand_chip *chip = nand->priv;
> >
> > + const int bufsz = 32;
> > + char buf[bufsz];
> > +
> >
> > printf("Device %d: ", idx);
> > if (chip->numchips > 1)
> >
> > printf("%dx ", chip->numchips);
> >
> > printf("%s, sector size %u KiB\n",
> >
> > nand->name, nand->erasesize >> 10);
> >
> > + printf(" Page size %8d b\n", nand->writesize);
> > + printf(" OOB size %8d b\n", nand->oobsize);
> > + printf(" Erase size %8d b\n", nand->erasesize);
> > +
> > + /* Set geometry info */
> > + memset(buf, 0, bufsz);
> > + sprintf(buf, "%x", nand->writesize);
> > + setenv("nand_writesize", buf);
> > +
> > + memset(buf, 0, bufsz);
> > + sprintf(buf, "%x", nand->oobsize);
> > + setenv("nand_oobsize", buf);
> > +
> > + memset(buf, 0, bufsz);
> > + sprintf(buf, "%x", nand->erasesize);
> > + setenv("nand_erasesize", buf);
>
> Why the memsets?

To clear the memory from previous usage ?

>
> -Scott