On 09/11/2011 11:04 PM, Marek Vasut wrote: > The "nand info" and "nand device" now set shell/environment variables: > nand_writesize ... nand page size > nand_oobsize ..... nand oob area size > nand_erasesize ... nand erase block size > > The shell variables are only set if HUSH is enabled. > > Also, the "nand info" command now displays this info.
"writesize" is what the internals use for this, but nand_pagesize would be more obvious. > Signed-off-by: Marek Vasut <marek.va...@gmail.com> > Cc: Scott Wood <scottw...@freescale.com> > Cc: Stefano Babic <sba...@denx.de> > Cc: Wolfgang Denk <w...@denx.de> > Cc: Detlev Zundel <d...@denx.de> > --- > common/cmd_nand.c | 42 +++++++++++++++++++++++++++++++++++++++--- > 1 files changed, 39 insertions(+), 3 deletions(-) > > diff --git a/common/cmd_nand.c b/common/cmd_nand.c > index a1c8dfd..5b7e83d 100644 > --- a/common/cmd_nand.c > +++ b/common/cmd_nand.c > @@ -27,6 +27,9 @@ > #include <asm/byteorder.h> > #include <jffs2/jffs2.h> > #include <nand.h> > +#ifdef CONFIG_SYS_HUSH_PARSER > +#include <hush.h> > +#endif I don't think you need this ifdef. > + /* Set geometry info */ > +#ifdef CONFIG_SYS_HUSH_PARSER > + memset(buf, 0, bufsz); > + sprintf(buf, "nand_writesize=%x", nand->writesize); > + set_local_var(buf, 0); > + > + memset(buf, 0, bufsz); > + sprintf(buf, "nand_oobsize=%x", nand->oobsize); > + set_local_var(buf, 0); > + > + memset(buf, 0, bufsz); > + sprintf(buf, "nand_erasesize=%x", nand->erasesize); > + set_local_var(buf, 0); > +#else > + 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); > +#endif Is there no existing abstraction to add a variable to both the shell (if present) and the environment, without needing such an ifdef in the caller? If not, should one be added? -Scott _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot