]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board:samsung:common: set envs with board unified information
authorPiotr Wilczek <p.wilczek@samsung.com>
Wed, 22 Jan 2014 14:54:32 +0000 (15:54 +0100)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 7 Feb 2014 01:06:24 +0000 (10:06 +0900)
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@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
board/samsung/common/misc.c
include/samsung/misc.h

index 643f957a543a4712de6868eb455cb60b6881beab..eb157394adb58dcf96bad4b294fc6c32fefbeb37 100644 (file)
 
 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)
 {
index 1a6d47f4ca626cfd5c92e9cb50caf26c1b54e4dd..ede6c1583a93675758d1e2a8c0dff1cc03bc55a2 100644 (file)
@@ -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 */