[U-Boot] [PATCH 5/6][v2] SPL:Defines function required to env read for IFC & env_nand

Scott Wood scottwood at freescale.com
Wed Nov 6 02:42:27 CET 2013


On Fri, 2013-10-25 at 10:09 +0530, Prabhakar Kushwaha wrote:
> fsl_ifs_spl.c reads data from NAND and store at a memory location in raw mode.
> It does not used MTD layer.
> To read env variable from NAND MTD layer read/write required.
> 
> Hence, add mtd_block_isbad & nand_read_skip_bad function required during
> env variable read.
> 
> Also, avoid nand_info during env read for SPL
> 
> Signed-off-by: Prabhakar Kushwaha <prabhakar at freescale.com>
> ---
>  Based upon  git://git.denx.de/u-boot-mpc85xx.git branch next
> 
>  Changes for v2: Sending as it is
> 
>  common/env_nand.c              |    4 ++++
>  drivers/mtd/nand/fsl_ifc_spl.c |   22 ++++++++++++++++++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/common/env_nand.c b/common/env_nand.c
> index 695a9ee..77ba003 100644
> --- a/common/env_nand.c
> +++ b/common/env_nand.c
> @@ -245,7 +245,11 @@ int readenv(size_t offset, u_char *buf)
>  	size_t blocksize, len;
>  	u_char *char_ptr;
>  
> +#ifdef CONFIG_SPL_BUILD
> +	blocksize = CONFIG_ENV_SIZE;;
> +#else
>  	blocksize = nand_info[0].erasesize;
> +#endif

Extra semicolon

As discussed earlier, use CONFIG_SYS_NAND_BLOCK_SIZE.

>  	if (!blocksize)
>  		return 1;
>  
> diff --git a/drivers/mtd/nand/fsl_ifc_spl.c b/drivers/mtd/nand/fsl_ifc_spl.c
> index d462265..0db7142 100644
> --- a/drivers/mtd/nand/fsl_ifc_spl.c
> +++ b/drivers/mtd/nand/fsl_ifc_spl.c
> @@ -11,6 +11,28 @@
>  #include <asm/io.h>
>  #include <asm/fsl_ifc.h>
>  #include <linux/mtd/nand.h>
> +#ifndef CONFIG_SPL_INIT_MINIMAL
> +#include <linux/mtd/mtd.h>
> +#endif

I think you mean "#ifdef CONFIG_ENV_IS_IN_NAND", but in any case you
usually shouldn't need to ifdef headers.

-Scott





More information about the U-Boot mailing list