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

Scott Wood scottwood at freescale.com
Tue Sep 27 21:01:53 CEST 2011


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?

-Scott



More information about the U-Boot mailing list