From 665675336251d1daac56ce80d0490a8f71d13411 Mon Sep 17 00:00:00 2001 From: Kuiying Wang Date: Thu, 12 Dec 2019 12:54:18 +0800 Subject: [PATCH] ast2600: intel-layout-environment-addr Tested: Both kernel and u-boot work at the area /dev/mtd/u-boot-env Signed-off-by: Kuiying Wang Signed-off-by: Jae Hyun Yoo --- common/board_r.c | 11 +++++++++-- include/configs/aspeed-common.h | 11 ++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 472987d5d52f..434c0df45c85 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -433,10 +433,17 @@ static int should_load_env(void) static int initr_env(void) { /* initialize environment */ - if (should_load_env()) + if (should_load_env()) { + /* + * try again, in case the environment failed to load the first + * time + */ + if (!gd->env_valid) + env_init(); env_relocate(); - else + } else { set_default_env(NULL, 0); + } #ifdef CONFIG_OF_CONTROL env_set_hex("fdtcontroladdr", (unsigned long)map_to_sysmem(gd->fdt_blob)); diff --git a/include/configs/aspeed-common.h b/include/configs/aspeed-common.h index 8f404570b1fb..183a7a502e9c 100644 --- a/include/configs/aspeed-common.h +++ b/include/configs/aspeed-common.h @@ -67,9 +67,18 @@ #endif #ifndef CONFIG_ENV_OFFSET -#define CONFIG_ENV_OFFSET 0xF0000 +#define CONFIG_ENV_OFFSET 0x2400000 #endif +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT +#define CONFIG_ENV_OVERWRITE + +#define AST_FMC_CS0_BASE 0x20000000 /* CS0 */ +#define CONFIG_ENV_ADDR (AST_FMC_CS0_BASE + CONFIG_ENV_OFFSET) +#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) +#define CONFIG_ENV_ADDR_REDUND (AST_FMC_CS0_BASE + CONFIG_ENV_OFFSET_REDUND) +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE + #define CONFIG_ENV_SECT_SIZE (4 << 10) /* -- 2.17.1