* [U-Boot] Crash in env_relocate_spec() of env_mmc.c
@ 2010-10-08 3:45 Steve Sakoman
2010-10-08 7:53 ` Stefano Babic
0 siblings, 1 reply; 3+ messages in thread
From: Steve Sakoman @ 2010-10-08 3:45 UTC (permalink / raw)
To: u-boot
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?
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] Crash in env_relocate_spec() of env_mmc.c
2010-10-08 3:45 [U-Boot] Crash in env_relocate_spec() of env_mmc.c Steve Sakoman
@ 2010-10-08 7:53 ` Stefano Babic
2010-10-08 13:32 ` Steve Sakoman
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Babic @ 2010-10-08 7:53 UTC (permalink / raw)
To: u-boot
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).
I can send a patch that at least on my target solves the problem. Could
you test it ?
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] Crash in env_relocate_spec() of env_mmc.c
2010-10-08 7:53 ` Stefano Babic
@ 2010-10-08 13:32 ` Steve Sakoman
0 siblings, 0 replies; 3+ messages in thread
From: Steve Sakoman @ 2010-10-08 13:32 UTC (permalink / raw)
To: u-boot
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
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-08 13:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-08 3:45 [U-Boot] Crash in env_relocate_spec() of env_mmc.c Steve Sakoman
2010-10-08 7:53 ` Stefano Babic
2010-10-08 13:32 ` Steve Sakoman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox