* [U-Boot] [PATCH v2] env_mmc: Fix crashing bug encountered after enabling ARM relocation
@ 2010-10-10 14:04 Steve Sakoman
2010-10-13 19:50 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Steve Sakoman @ 2010-10-10 14:04 UTC (permalink / raw)
To: u-boot
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>
---
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 5f2dfd0..6d8e831 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] 2+ messages in thread
* [U-Boot] [PATCH v2] env_mmc: Fix crashing bug encountered after enabling ARM relocation
2010-10-10 14:04 [U-Boot] [PATCH v2] env_mmc: Fix crashing bug encountered after enabling ARM relocation Steve Sakoman
@ 2010-10-13 19:50 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2010-10-13 19:50 UTC (permalink / raw)
To: u-boot
Dear Steve Sakoman,
In message <1286719463.2105.25.camel@quadra> you wrote:
> 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>
> ---
Applied (after removing the doubled subject line and fixing a
white-space coding style issue). Thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
grep me no patterns and I'll tell you no lines.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-13 19:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-10 14:04 [U-Boot] [PATCH v2] env_mmc: Fix crashing bug encountered after enabling ARM relocation Steve Sakoman
2010-10-13 19:50 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.