]> git.sur5r.net Git - u-boot/blobdiff - common/env_nand.c
PPC: 86xx Add bat registers to reginfo command
[u-boot] / common / env_nand.c
index 67c4a4e011761b92b92f291714cf9af4181696d3..3a98d2b944b17b8853766cbb6bfcd6f4b136f58d 100644 (file)
 #include <malloc.h>
 #include <nand.h>
 
-#if ((CONFIG_COMMANDS&(CFG_CMD_ENV|CFG_CMD_NAND)) == (CFG_CMD_ENV|CFG_CMD_NAND))
+#if defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)
 #define CMD_SAVEENV
 #elif defined(CFG_ENV_OFFSET_REDUND)
-#error Cannot use CFG_ENV_OFFSET_REDUND without CFG_CMD_ENV & CFG_CMD_NAND
+#error Cannot use CFG_ENV_OFFSET_REDUND without CONFIG_CMD_ENV & CONFIG_CMD_NAND
 #endif
 
 #if defined(CFG_ENV_SIZE_REDUND) && (CFG_ENV_SIZE_REDUND != CFG_ENV_SIZE)
@@ -57,9 +57,6 @@ int nand_legacy_rw (struct nand_chip* nand, int cmd,
            size_t start, size_t len,
            size_t * retlen, u_char * buf);
 
-/* info for NAND chips, defined in drivers/nand/nand.c */
-extern nand_info_t nand_info[];
-
 /* references to names in env_common.c */
 extern uchar default_environment[];
 extern int default_environment_size;
@@ -102,7 +99,7 @@ uchar env_get_char_spec (int index)
 int env_init(void)
 {
 #if defined(ENV_IS_EMBEDDED)
-       ulong total;
+       size_t total;
        int crc1_ok = 0, crc2_ok = 0;
        env_t *tmp_env1, *tmp_env2;
 
@@ -154,7 +151,7 @@ int env_init(void)
 #ifdef CFG_ENV_OFFSET_REDUND
 int saveenv(void)
 {
-       ulong total;
+       size_t total;
        int ret = 0;
 
        env_ptr->flags++;
@@ -188,7 +185,7 @@ int saveenv(void)
 #else /* ! CFG_ENV_OFFSET_REDUND */
 int saveenv(void)
 {
-       ulong total;
+       size_t total;
        int ret = 0;
 
        puts ("Erasing Nand...");
@@ -211,7 +208,7 @@ int saveenv(void)
 void env_relocate_spec (void)
 {
 #if !defined(ENV_IS_EMBEDDED)
-       ulong total;
+       size_t total;
        int crc1_ok = 0, crc2_ok = 0;
        env_t *tmp_env1, *tmp_env2;
 
@@ -268,12 +265,12 @@ void env_relocate_spec (void)
 void env_relocate_spec (void)
 {
 #if !defined(ENV_IS_EMBEDDED)
-       ulong total;
+       size_t total;
        int ret;
 
        total = CFG_ENV_SIZE;
        ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
-       if (ret || total != CFG_ENV_SIZE)
+       if (ret || total != CFG_ENV_SIZE)
                return use_default();
 
        if (crc32(0, env_ptr->data, ENV_SIZE) != env_ptr->crc)