]> git.sur5r.net Git - u-boot/blobdiff - env/nvram.c
rockchip: move CONFIG_ENV_SIZE and CONFIG_ENV_OFFSET to Kconfig
[u-boot] / env / nvram.c
index 09091b8eb7ec29b7d1eb828496fe0936e0678ff6..c8b34754efc692690ad3510eb9f790d708b2a72e 100644 (file)
@@ -36,15 +36,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
 extern void *nvram_read(void *dest, const long src, size_t count);
 extern void nvram_write(long dest, const void *src, size_t count);
-env_t *env_ptr;
 #else
 env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 #endif
 
-char *env_name_spec = "NVRAM";
-
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-static uchar env_nvram_get_char(int index)
+static int env_nvram_get_char(int index)
 {
        uchar c;
 
@@ -54,7 +51,7 @@ static uchar env_nvram_get_char(int index)
 }
 #endif
 
-static void env_nvram_load(void)
+static int env_nvram_load(void)
 {
        char buf[CONFIG_ENV_SIZE];
 
@@ -64,6 +61,8 @@ static void env_nvram_load(void)
        memcpy(buf, (void *)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
 #endif
        env_import(buf, 1);
+
+       return 0;
 }
 
 static int env_nvram_save(void)
@@ -107,7 +106,7 @@ static int env_nvram_init(void)
                gd->env_valid = ENV_VALID;
        } else {
                gd->env_addr    = (ulong)&default_environment[0];
-               gd->env_valid   = 0;
+               gd->env_valid   = ENV_INVALID;
        }
 
        return 0;
@@ -115,6 +114,7 @@ static int env_nvram_init(void)
 
 U_BOOT_ENV_LOCATION(nvram) = {
        .location       = ENVL_NVRAM,
+       ENV_NAME("NVRAM")
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
        .get_char       = env_nvram_get_char,
 #endif