diff options
Diffstat (limited to 'env/flash.c')
-rw-r--r-- | env/flash.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/env/flash.c b/env/flash.c index 7a73466cf2..bdba09e306 100644 --- a/env/flash.c +++ b/env/flash.c @@ -95,10 +95,12 @@ static int env_flash_init(void) } else if (!crc1_ok && !crc2_ok) { gd->env_addr = addr_default; gd->env_valid = ENV_INVALID; - } else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) { + } else if (flag1 == ENV_REDUND_ACTIVE && + flag2 == ENV_REDUND_OBSOLETE) { gd->env_addr = addr1; gd->env_valid = ENV_VALID; - } else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) { + } else if (flag1 == ENV_REDUND_OBSOLETE && + flag2 == ENV_REDUND_ACTIVE) { gd->env_addr = addr2; gd->env_valid = ENV_VALID; } else if (flag1 == flag2) { @@ -121,7 +123,7 @@ static int env_flash_save(void) { env_t env_new; char *saved_data = NULL; - char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG; + char flag = ENV_REDUND_OBSOLETE, new_flag = ENV_REDUND_ACTIVE; int rc = 1; #if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE ulong up_data = 0; @@ -322,9 +324,9 @@ static int env_flash_load(void) end_addr_new = ltmp; } - if (flash_addr_new->flags != OBSOLETE_FLAG && + if (flash_addr_new->flags != ENV_REDUND_OBSOLETE && crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc) { - char flag = OBSOLETE_FLAG; + char flag = ENV_REDUND_OBSOLETE; gd->env_valid = ENV_REDUND; flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new); @@ -334,9 +336,9 @@ static int env_flash_load(void) flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); } - if (flash_addr->flags != ACTIVE_FLAG && - (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) { - char flag = ACTIVE_FLAG; + if (flash_addr->flags != ENV_REDUND_ACTIVE && + (flash_addr->flags & ENV_REDUND_ACTIVE) == ENV_REDUND_ACTIVE) { + char flag = ENV_REDUND_ACTIVE; gd->env_valid = ENV_REDUND; flash_sect_protect(0, (ulong)flash_addr, end_addr); |