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

Piotr Wilczek p.wilczek at samsung.com
Tue Jan 14 08:59:06 CET 2014


This patch enables to set envs that describe board information.
The following envs are set (but not saved): soc_id, soc_rev, board_rev.

Based on this information, 'fdtaddr' env is set (not saved) as:
fdtaddr=${soc_family}${soc_id}-${board}.dtb

Signed-off-by: Piotr Wilczek <p.wilczek at samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
---
 board/samsung/common/misc.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3764d12..2d81df9 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -7,8 +7,37 @@
 
 #include <common.h>
 
+extern u32 get_board_rev(void);
+
+#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);
+
+	snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev());
+	setenv("board_rev", info);
+
+#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
+
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+	set_board_info();
+#endif
+
 	return 0;
 }
-- 
1.7.9.5



More information about the U-Boot mailing list