[U-Boot] [PATCH V2 3/8] board:samsung:common: set envs with board unified information

Piotr Wilczek p.wilczek at samsung.com
Wed Jan 22 15:54:32 CET 2014


This patch sets envs that describe board information.
The following envs are set: soc_id, soc_rev, board_rev.
Based on this information, if CONFIG_OF_LIBFDT is enabled,
the 'fdtfile' env is set as:
fdtfile=${soc_family}${soc_id}-${board}.dtb

The generated envs are intenionally not saved to persistent storage.

Signed-off-by: Piotr Wilczek <p.wilczek at samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
---
Changes for V2:
 - rebased on patchset [PATCH v6 00/11] Introduce Samsung misc file and LCD menu

 board/samsung/common/misc.c |   24 ++++++++++++++++++++++++
 include/samsung/misc.h      |   12 ++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 643f957..eb15739 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -21,6 +21,30 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+void set_board_info(void)
+{
+	char info[64];
+
+	snprintf(info, ARRAY_SIZE(info), "%d.%d", s5p_cpu_rev & 0x0f,
+		 (s5p_cpu_rev & 0xf0) >> 0x04);
+	setenv("soc_rev", info);
+
+	snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id);
+	setenv("soc_id", info);
+
+#ifdef CONFIG_REVISION_TAG
+	snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev());
+	setenv("board_rev", info);
+#endif
+#ifdef CONFIG_OF_LIBFDT
+	snprintf(info, ARRAY_SIZE(info),  "%s%x-%s.dtb",
+		 CONFIG_SYS_SOC, s5p_cpu_id, CONFIG_SYS_BOARD);
+	setenv("fdtfile", info);
+#endif
+}
+#endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
+
 #ifdef CONFIG_LCD_MENU
 static int power_key_pressed(u32 reg)
 {
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
index 1a6d47f..ede6c15 100644
--- a/include/samsung/misc.h
+++ b/include/samsung/misc.h
@@ -1,6 +1,14 @@
 #ifndef __SAMSUNG_MISC_COMMON_H__
 #define __SAMSUNG_MISC_COMMON_H__
 
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void);
+#endif
+
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+void set_board_info(void);
+#endif
+
 #ifdef CONFIG_LCD_MENU
 enum {
 	BOOT_MODE_INFO,
@@ -10,10 +18,6 @@ enum {
 	BOOT_MODE_EXIT,
 };
 
-#ifdef CONFIG_REVISION_TAG
-u32 get_board_rev(void);
-#endif
-
 void keys_init(void);
 void check_boot_mode(void);
 #endif /* CONFIG_LCD_MENU */
-- 
1.7.9.5



More information about the U-Boot mailing list