summaryrefslogtreecommitdiffstats
path: root/common/env_flash.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2005-01-09 23:16:25 +0000
committerwdenk <wdenk>2005-01-09 23:16:25 +0000
commit8ed9604613398660f9ee855060661da8809d4045 (patch)
tree7901e427798e0d09ad53038d7b6112e10556ceae /common/env_flash.c
parentff36fd8591776405eeb3a086ba1136bf1ece2ffb (diff)
downloadu-boot-8ed9604613398660f9ee855060661da8809d4045.tar.gz
u-boot-8ed9604613398660f9ee855060661da8809d4045.tar.xz
u-boot-8ed9604613398660f9ee855060661da8809d4045.zip
* Patches by Richard Woodruff, 01 Oct 2004:
add support for the TI OMAP2420 processor and its H4 reference board * Patch by Christian Pellegrin, 24 Sep 2004: Added support for NE2000 compatible (DP8390, DP83902) NICs.
Diffstat (limited to 'common/env_flash.c')
-rw-r--r--common/env_flash.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/common/env_flash.c b/common/env_flash.c
index 4e42c8fee5..d6257d07bd 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -99,11 +99,7 @@ uchar env_get_char_spec (int index)
int env_init(void)
{
DECLARE_GLOBAL_DATA_PTR;
-
- int crc1_ok =
- (crc32(0, flash_addr->data, ENV_SIZE) == flash_addr->crc);
- int crc2_ok =
- (crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc);
+ int crc1_ok = 0, crc2_ok = 0;
uchar flag1 = flash_addr->flags;
uchar flag2 = flash_addr_new->flags;
@@ -112,6 +108,16 @@ int env_init(void)
ulong addr1 = (ulong)&(flash_addr->data);
ulong addr2 = (ulong)&(flash_addr_new->data);
+#ifdef CONFIG_OMAP2420H4
+ int flash_probe(void);
+
+ if(flash_probe() == 0)
+ goto bad_flash;
+#endif
+
+ crc1_ok = (crc32(0, flash_addr->data, ENV_SIZE) == flash_addr->crc);
+ crc2_ok = (crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc);
+
if (crc1_ok && ! crc2_ok) {
gd->env_addr = addr1;
gd->env_valid = 1;
@@ -138,6 +144,9 @@ int env_init(void)
gd->env_valid = 2;
}
+#ifdef CONFIG_OMAP2420H4
+bad_flash:
+#endif
return (0);
}
@@ -252,15 +261,22 @@ Done:
int env_init(void)
{
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_OMAP2420H4
+ int flash_probe(void);
+ if(flash_probe() == 0)
+ goto bad_flash;
+#endif
if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
gd->env_addr = (ulong)&(env_ptr->data);
gd->env_valid = 1;
- } else {
- gd->env_addr = (ulong)&default_environment[0];
- gd->env_valid = 0;
+ return(0);
}
-
+#ifdef CONFIG_OMAP2420H4
+bad_flash:
+#endif
+ gd->env_addr = (ulong)&default_environment[0];
+ gd->env_valid = 0;
return (0);
}