
On Fri, Oct 8, 2010 at 12:53 AM, Stefano Babic sbabic@denx.de wrote:
Steve Sakoman wrote: Hi Steve,
I've been attempting to get the OMAP4 boards working post the ARM relocation changes.
Panda was simple. The OMAP4430SDP is proving to be more challenging, as it freezes after printing the DRAM size message.
Adding a few printfs revealed that the crash occurs in env_mmc.c's env_relocate_spec() routine.
Has anyone else run into this issue? Any advice?
I tested, I can see the same issue. The main problem is that mmc_initialize is not called before mmc_init() in arch/arm/lib/board.c if relocation is active. In start_armboot it is called before.
The second problem I see is that env_relocate_spec should call env_import() as already done by other environment (I checked with env_nand).
Heh, great minds! I found the same issues just before going to sleep last night and put together a quite similar patch.
I tested my version of the patch this morning and it did fix the issue. I didn't test last night because I feared that if it didn't work I would stay up too late trying the next thing :-)
I have a few differences in my patch -- I'll comment in a response to your patch.
My patch is below.
Steve
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 5f2dfd0..0e2f129 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -779,6 +779,11 @@ void board_init_r (gd_t *id, ulong dest_addr) onenand_init(); #endif
+#ifdef CONFIG_GENERIC_MMC + puts ("MMC: "); + mmc_initialize (bd); +#endif + #ifdef CONFIG_HAS_DATAFLASH AT91F_DataflashInit(); dataflash_print_info(); @@ -854,11 +859,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/common/env_mmc.c b/common/env_mmc.c index cc288d4..d443ff5 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 }