diff options
Diffstat (limited to 'env/sf.c')
-rw-r--r-- | env/sf.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -10,7 +10,8 @@ */ #include <common.h> #include <dm.h> -#include <environment.h> +#include <env.h> +#include <env_internal.h> #include <malloc.h> #include <spi.h> #include <spi_flash.h> @@ -29,8 +30,6 @@ static ulong env_offset = CONFIG_ENV_OFFSET; static ulong env_new_offset = CONFIG_ENV_OFFSET_REDUND; #endif -#define ACTIVE_FLAG 1 -#define OBSOLETE_FLAG 0 #endif /* CONFIG_ENV_OFFSET_REDUND */ DECLARE_GLOBAL_DATA_PTR; @@ -48,7 +47,7 @@ static int setup_flash_device(void) CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE, &new); if (ret) { - set_default_env("spi_flash_probe_bus_cs() failed", 0); + env_set_default("spi_flash_probe_bus_cs() failed", 0); return ret; } @@ -60,7 +59,7 @@ static int setup_flash_device(void) CONFIG_ENV_SPI_CS, CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); if (!env_flash) { - set_default_env("spi_flash_probe() failed", 0); + env_set_default("spi_flash_probe() failed", 0); return -EIO; } } @@ -73,7 +72,7 @@ static int setup_flash_device(void) static int env_sf_save(void) { env_t env_new; - char *saved_buffer = NULL, flag = OBSOLETE_FLAG; + char *saved_buffer = NULL, flag = ENV_REDUND_OBSOLETE; u32 saved_size, saved_offset, sector; int ret; @@ -84,7 +83,7 @@ static int env_sf_save(void) ret = env_export(&env_new); if (ret) return -EIO; - env_new.flags = ACTIVE_FLAG; + env_new.flags = ENV_REDUND_ACTIVE; if (gd->env_valid == ENV_VALID) { env_new_offset = CONFIG_ENV_OFFSET_REDUND; @@ -161,7 +160,7 @@ static int env_sf_load(void) tmp_env2 = (env_t *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE); if (!tmp_env1 || !tmp_env2) { - set_default_env("malloc() failed", 0); + env_set_default("malloc() failed", 0); ret = -EIO; goto out; } @@ -256,7 +255,7 @@ static int env_sf_load(void) buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE); if (!buf) { - set_default_env("malloc() failed", 0); + env_set_default("malloc() failed", 0); return -EIO; } @@ -267,7 +266,7 @@ static int env_sf_load(void) ret = spi_flash_read(env_flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, buf); if (ret) { - set_default_env("spi_flash_read() failed", 0); + env_set_default("spi_flash_read() failed", 0); goto err_read; } |