]> git.sur5r.net Git - u-boot/blobdiff - env/eeprom.c
Merge git://git.denx.de/u-boot-fsl-qoriq
[u-boot] / env / eeprom.c
index 2c795b9236dc322eb7e364892563f321e5aa440a..584379ebd26e3673ffd2d4055640160d24108582 100644 (file)
@@ -21,8 +21,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-env_t *env_ptr;
-
 static int eeprom_bus_read(unsigned dev_addr, unsigned offset,
                           uchar *buffer, unsigned cnt)
 {
@@ -63,7 +61,7 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
        return rcode;
 }
 
-static uchar env_eeprom_get_char(int index)
+static int env_eeprom_get_char(int index)
 {
        uchar c;
        unsigned int off = CONFIG_ENV_OFFSET;
@@ -78,7 +76,7 @@ static uchar env_eeprom_get_char(int index)
        return c;
 }
 
-static void env_eeprom_load(void)
+static int env_eeprom_load(void)
 {
        char buf_env[CONFIG_ENV_SIZE];
        unsigned int off = CONFIG_ENV_OFFSET;
@@ -124,7 +122,7 @@ static void env_eeprom_load(void)
 
        if (!crc_ok[0] && !crc_ok[1]) {
                gd->env_addr    = 0;
-               gd->env_valid   = 0;
+               gd->env_valid = ENV_INVALID;
        } else if (crc_ok[0] && !crc_ok[1]) {
                gd->env_valid = ENV_VALID;
        } else if (!crc_ok[0] && crc_ok[1]) {
@@ -168,9 +166,9 @@ static void env_eeprom_load(void)
        }
 
        if (crc == new) {
-               gd->env_valid   = ENV_VALID;
+               gd->env_valid = ENV_VALID;
        } else {
-               gd->env_valid   = 0;
+               gd->env_valid = ENV_INVALID;
        }
 #endif /* CONFIG_ENV_OFFSET_REDUND */
 
@@ -184,6 +182,8 @@ static void env_eeprom_load(void)
                off, (uchar *)buf_env, CONFIG_ENV_SIZE);
 
        env_import(buf_env, 1);
+
+       return 0;
 }
 
 static int env_eeprom_save(void)
@@ -196,8 +196,6 @@ static int env_eeprom_save(void)
        char flag_obsolete      = OBSOLETE_FLAG;
 #endif
 
-       BUG_ON(env_ptr != NULL);
-
        rc = env_export(&env_new);
        if (rc)
                return rc;