diff options
| author | Steve Sakoman <steve@sakoman.com> | 2010-10-11 05:51:39 -0700 | 
|---|---|---|
| committer | Wolfgang Denk <wd@denx.de> | 2010-10-13 21:52:13 +0200 | 
| commit | d470a6f60ad0d627c21a2769513d2017f9a0da76 (patch) | |
| tree | d004fc1d1ada88f8341e9069b7ef7fdff40c14ac /common/env_mmc.c | |
| parent | e1b4c57096b87b4ada56df4154d9acee6a59141f (diff) | |
| download | olio-uboot-2014.01-d470a6f60ad0d627c21a2769513d2017f9a0da76.tar.xz olio-uboot-2014.01-d470a6f60ad0d627c21a2769513d2017f9a0da76.zip | |
env_mmc: Fix crashing bug encountered after enabling ARM relocation
The crash was occuring in env_relocate because it was being called prior
to mmc_initialize.  This patch moves the MMC initialization earlier in
the init process.
This patch also cleans up the env_relocate_spec code in env_mmc.c
Signed-off-by: Steve Sakoman <steve.sakoman@linaro.org>
Acked-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'common/env_mmc.c')
| -rw-r--r-- | common/env_mmc.c | 17 | 
1 files changed, 10 insertions, 7 deletions
| diff --git a/common/env_mmc.c b/common/env_mmc.c index cc288d487..d443ff51f 100644 --- a/common/env_mmc.c +++ b/common/env_mmc.c @@ -129,18 +129,21 @@ inline int read_env(struct mmc *mmc, unsigned long size,  void env_relocate_spec(void)  {  #if !defined(ENV_IS_EMBEDDED) +       char buf[CONFIG_ENV_SIZE]; +  	struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV); -	if (init_mmc_for_env(mmc)) +	if (init_mmc_for_env(mmc)) { +		use_default();  		return; +	} -	if (read_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, env_ptr)) -		return use_default(); - -	if (crc32(0, env_ptr->data, ENV_SIZE) != env_ptr->crc) -		return use_default(); +	if (read_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, buf)) { +		use_default(); +		return; +	} -	gd->env_valid = 1; +	env_import(buf, 1);  #endif  } |