[U-Boot] [PATCH 06/10] samsung: misc: set_board_info: check the board type to set fdt file name

Przemyslaw Marczak
2014-06-10T11:33:00Z

This change adds a call to the get_board_type_fdt() function before setting
the "fdtfile" environment variable.

For CONFIG_BOARD_TYPES below function is called:
- const char *get_board_type_fdt(void) - should return a pointer
to the board type string.

This is useful in case of run many boards with just one config.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
board/samsung/common/misc.c | 8 ++++++--
include/samsung/misc.h | 3 +++
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index d31583b..ace92f8 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -48,6 +48,7 @@ void set_dfu_boot_alt(int bootmode)
void set_board_info(void)
{
char info[64];
+ const char *bdtype = "";

snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4,
s5p_cpu_rev & 0xf);
@@ -61,8 +62,11 @@ void set_board_info(void)
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);
+#ifdef CONFIG_BOARD_TYPES
+ bdtype = get_board_type_fdt();
+#endif
+ snprintf(info, ARRAY_SIZE(info), "%s%x-%s%s.dtb",
+ CONFIG_SYS_SOC, s5p_cpu_id, CONFIG_SYS_BOARD, bdtype);
setenv("fdtfile", info);
#endif
}
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
index dfc0946..bad591f 100644
--- a/include/samsung/misc.h
+++ b/include/samsung/misc.h
@@ -36,5 +36,8 @@ void draw_logo(void);
#ifdef CONFIG_SET_DFU_BOOT_ALT
void set_dfu_boot_alt(int bootmode);
#endif
+#ifdef CONFIG_BOARD_TYPES
+const char *get_board_type_fdt(void);
+#endif

#endif /* __SAMSUNG_MISC_COMMON_H__ */
--
1.9.1