[U-Boot] [PATCH 4/4] Environment in MMC

Sudhakar Rajashekhara sudhakar.raj at ti.com
Fri May 14 10:26:04 CEST 2010


Hi Alagu,

On Wed, May 12, 2010 at 15:08:27, Alagu Sankar wrote:
> This patch is to save environment data to mmc card. It uses interfaces defined
> in generic MMC framework.  This is enabled with CONFIG_ENV_IS_IN_MMC option.
> Based on the earlier patch from Terry Lv at Freescale
> 
> Signed-off-by: Alagu Sankar <alagusankar at embwise.com>
> ---
>  arch/arm/lib/board.c     |   10 ++--
>  arch/powerpc/lib/board.c |   12 ++--
>  common/Makefile          |    1 +
>  common/cmd_nvedit.c      |    3 +-
>  common/env_mmc.c         |  168 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/environment.h    |   18 +++++
>  6 files changed, 200 insertions(+), 12 deletions(-)
>  create mode 100644 common/env_mmc.c
> 
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index f5660a9..5e7558e 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -338,6 +338,11 @@ void start_armboot (void)
>  	nand_init();		/* go init the NAND */
>  #endif
>  
> +#ifdef CONFIG_GENERIC_MMC
> +	puts ("MMC:   ");
> +	mmc_initialize (gd->bd);
> +#endif
> +

Why this has been moved up? If there is any genuine reason for this, then
you can mention it in patch description.

>  #if defined(CONFIG_CMD_ONENAND)
>  	onenand_init();
>  #endif
> @@ -419,11 +424,6 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
>  	board_late_init ();
>  #endif
>  
> -#ifdef CONFIG_GENERIC_MMC
> -	puts ("MMC:   ");
> -	mmc_initialize (gd->bd);
> -#endif
> -
>  #ifdef CONFIG_BITBANGMII
>  	bb_miiphy_init();
>  #endif
> diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
> index 7b09fb5..1008635 100644
> --- a/arch/powerpc/lib/board.c
> +++ b/arch/powerpc/lib/board.c
> @@ -783,6 +783,12 @@ void board_init_r (gd_t *id, ulong dest_addr)
>  	nand_init();		/* go init the NAND */
>  #endif
>  
> +#ifdef CONFIG_GENERIC_MMC
> +	WATCHDOG_RESET ();
> +	puts ("MMC:  ");
> +	mmc_initialize (bd);
> +#endif
> +

The above comment applies here as well.

>  	/* relocate environment function pointers etc. */
>  	env_relocate ();
>  
> @@ -939,12 +945,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
>  	scsi_init ();
>  #endif
>  
> -#ifdef CONFIG_GENERIC_MMC
> -	WATCHDOG_RESET ();
> -	puts ("MMC:  ");
> -	mmc_initialize (bd);
> -#endif
> -
>  #if defined(CONFIG_CMD_DOC)
>  	WATCHDOG_RESET ();
>  	puts ("DOC:   ");
> diff --git a/common/Makefile b/common/Makefile
> index dbf7a05..2c37073 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -58,6 +58,7 @@ COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
>  COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
>  COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
>  COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
> +COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
>  COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
>  COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
>  COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
> diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
> index eb89e9e..27e46f7 100644
> --- a/common/cmd_nvedit.c
> +++ b/common/cmd_nvedit.c
> @@ -63,9 +63,10 @@ DECLARE_GLOBAL_DATA_PTR;
>      !defined(CONFIG_ENV_IS_IN_NVRAM)	&& \
>      !defined(CONFIG_ENV_IS_IN_ONENAND)	&& \
>      !defined(CONFIG_ENV_IS_IN_SPI_FLASH)	&& \
> +    !defined(CONFIG_ENV_IS_IN_MMC)	&& \
>      !defined(CONFIG_ENV_IS_NOWHERE)
>  # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
> -SPI_FLASH|MG_DISK|NVRAM|NOWHERE}
> +SPI_FLASH|MG_DISK|NVRAM|MMC|NOWHERE}
>  #endif
>  
>  #define XMK_STR(x)	#x
> diff --git a/common/env_mmc.c b/common/env_mmc.c
> new file mode 100644
> index 0000000..ef7e5fb
> --- /dev/null
> +++ b/common/env_mmc.c
> @@ -0,0 +1,168 @@
> +/*
> + * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
> + * (C) Copyright 2000-2006
> + * Wolfgang Denk, DENX Software Engineering, w... at denx.de.
> + *

I do not see your copyright here.

Regards,
Sudhakar




More information about the U-Boot mailing list