mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
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>
This commit is contained in:
parent
e1b4c57096
commit
d470a6f60a
2 changed files with 15 additions and 12 deletions
|
@ -770,6 +770,11 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
||||||
onenand_init();
|
onenand_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_GENERIC_MMC
|
||||||
|
puts("MMC: ");
|
||||||
|
mmc_initialize(bd);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_HAS_DATAFLASH
|
#ifdef CONFIG_HAS_DATAFLASH
|
||||||
AT91F_DataflashInit();
|
AT91F_DataflashInit();
|
||||||
dataflash_print_info();
|
dataflash_print_info();
|
||||||
|
@ -835,11 +840,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
||||||
board_late_init ();
|
board_late_init ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_GENERIC_MMC
|
|
||||||
puts ("MMC: ");
|
|
||||||
mmc_initialize (gd->bd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_BITBANGMII
|
#ifdef CONFIG_BITBANGMII
|
||||||
bb_miiphy_init();
|
bb_miiphy_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -129,18 +129,21 @@ inline int read_env(struct mmc *mmc, unsigned long size,
|
||||||
void env_relocate_spec(void)
|
void env_relocate_spec(void)
|
||||||
{
|
{
|
||||||
#if !defined(ENV_IS_EMBEDDED)
|
#if !defined(ENV_IS_EMBEDDED)
|
||||||
|
char buf[CONFIG_ENV_SIZE];
|
||||||
|
|
||||||
struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (read_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, env_ptr))
|
if (read_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, buf)) {
|
||||||
return use_default();
|
use_default();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (crc32(0, env_ptr->data, ENV_SIZE) != env_ptr->crc)
|
env_import(buf, 1);
|
||||||
return use_default();
|
|
||||||
|
|
||||||
gd->env_valid = 1;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue