From c9dca3c3f37d2647aec4509b24b16d15882ae3e4 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Mon, 12 May 2008 00:40:58 +0200 Subject: Revert "Change env_get_char from a global function ptr to a function." This reverts commit c0559be371b2a64b1a817088c3308688e2182f93 which is known to break booting from dataflash and NAND. --- common/env_common.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'common/env_common.c') diff --git a/common/env_common.c b/common/env_common.c index f366fdb..a494812 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -50,6 +50,7 @@ extern void env_relocate_spec (void); extern uchar env_get_char_spec(int); static uchar env_get_char_init (int index); +uchar (*env_get_char)(int) = env_get_char_init; /************************************************************************ * Default settings to be used when no valid environment is found @@ -181,19 +182,6 @@ uchar env_get_char_memory (int index) } #endif -uchar env_get_char (int index) -{ - uchar c; - - /* if relocated to RAM */ - if (gd->flags & GD_FLG_RELOC) - c = env_get_char_memory(index); - else - c = env_get_char_init(index); - - return (c); -} - uchar *env_get_addr (int index) { if (gd->env_valid) { @@ -227,6 +215,11 @@ void env_relocate (void) DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr); #endif + /* + * After relocation to RAM, we can always use the "memory" functions + */ + env_get_char = env_get_char_memory; + if (gd->env_valid == 0) { #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */ puts ("Using default environment\n\n"); -- cgit v1.1