summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/files/0002-intel-layout-environment-addr.patch
blob: 8937047c5d020adbb12cfcdc1fa9d1ef591ca735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 7979a73fba832747ed3c037c0b47c9e67dcf283e Mon Sep 17 00:00:00 2001
From: Vernon Mauery <vernon.mauery@intel.com>
Date: Mon, 30 Apr 2018 10:52:37 -0700

---
 common/board_r.c             | 8 ++++++--
 include/configs/ast-common.h | 9 ++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index d959ad3..74797ed 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -494,10 +494,14 @@ 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);
+	}
 #ifdef CONFIG_OF_CONTROL
 	setenv_addr("fdtcontroladdr", gd->fdt_blob);
 #endif
diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h
index eff6d2b..b7d7192 100644
--- a/include/configs/ast-common.h
+++ b/include/configs/ast-common.h
@@ -103,10 +103,13 @@
 #define CONFIG_SYS_MAX_FLASH_BANKS 	(CONFIG_FMC_CS)
 #define CONFIG_SYS_MAX_FLASH_SECT	(8192)		/* max number of sectors on one chip */
 #define CONFIG_ENV_IS_IN_FLASH		1
-#define CONFIG_ENV_ADDR			(AST_FMC_CS0_BASE + 0x60000)
+#define CONFIG_ENV_OFFSET		0x2400000	/* environment starts here  */
+#define CONFIG_ENV_ADDR			(AST_FMC_CS0_BASE + CONFIG_ENV_OFFSET)
+#define CONFIG_ENV_SIZE			0x10000	/* Total Size of Environment Sector */
 
-#define CONFIG_ENV_OFFSET		0x60000	/* environment starts here  */
-#define CONFIG_ENV_SIZE			0x20000	/* Total Size of Environment Sector */
+#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_BOOTCOMMAND		"bootm 20080000"
 #define CONFIG_ENV_OVERWRITE