sata: Drop Silicon Image SIL3114 SATA driver
[platform/kernel/u-boot.git] / env / nand.c
index 9f3dc63..21aa367 100644 (file)
 #include <command.h>
 #include <env.h>
 #include <env_internal.h>
+#include <asm/global_data.h>
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <nand.h>
 #include <search.h>
 #include <errno.h>
+#include <u-boot/crc.h>
 
 #if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_CMD_NAND) && \
                !defined(CONFIG_SPL_BUILD)
 #error CONFIG_ENV_OFFSET_REDUND must have CONFIG_CMD_SAVEENV & CONFIG_CMD_NAND
 #endif
 
-#if defined(CONFIG_ENV_SIZE_REDUND) && \
-       (CONFIG_ENV_SIZE_REDUND != CONFIG_ENV_SIZE)
-#error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE
-#endif
-
 #ifndef CONFIG_ENV_RANGE
 #define CONFIG_ENV_RANGE       CONFIG_ENV_SIZE
 #endif
@@ -110,8 +107,7 @@ static int env_nand_init(void)
        gd->env_addr = (ulong)env_ptr->data;
 
 #else /* ENV_IS_EMBEDDED || CONFIG_NAND_ENV_DST */
-       gd->env_addr    = (ulong)&default_environment[0];
-       gd->env_valid   = ENV_VALID;
+       gd->env_valid   = ENV_INVALID;
 #endif /* ENV_IS_EMBEDDED || CONFIG_NAND_ENV_DST */
 
        return 0;
@@ -335,7 +331,7 @@ static int env_nand_load(void)
        read2_fail = readenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) tmp_env2);
 
        ret = env_import_redund((char *)tmp_env1, read1_fail, (char *)tmp_env2,
-                               read2_fail);
+                               read2_fail, H_EXTERNAL);
 
 done:
        free(tmp_env1);
@@ -376,7 +372,7 @@ static int env_nand_load(void)
                return -EIO;
        }
 
-       return env_import(buf, 1);
+       return env_import(buf, 1, H_EXTERNAL);
 #endif /* ! ENV_IS_EMBEDDED */
 
        return 0;