[U-Boot] [PATCH v4 09/12] samsung: misc: use board specific functions to set env board info

Przemyslaw Marczak p.marczak at samsung.com
Wed Jul 2 13:50:11 CEST 2014


This change adds setup of environmental board info using
get_board_name() and get_board_type() functions for config
CONFIG_BOARD_TYPES.

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

Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
Cc: Piotr Wilczek <p.wilczek at samsung.com>
Cc: Minkyu Kang <mk7.kang at samsung.com>

---
Changes v2:
- set_board_info: move the bdtype pointer to avoid unused pointer
  compilation warning

Changes v3:
- samsung: misc: change get_board_type_fdt() to get_board_type()
- samsung: misc: set env $boardname using get_board_* functions
  for CONFIG_BOARD_TYPES
- update commit msg
---
 board/samsung/common/misc.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 5a3eb93..ec864bf 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -76,8 +76,17 @@ 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);
+	const char *bdtype = "";
+	const char *bdname = CONFIG_SYS_BOARD;
+
+#ifdef CONFIG_BOARD_TYPES
+	bdtype = get_board_type();
+	bdname = get_board_name();
+	sprintf(info, "%s%s", bdname, bdtype);
+	setenv("boardname", info);
+#endif
+	snprintf(info, ARRAY_SIZE(info),  "%s%x-%s%s.dtb",
+		 CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
 	setenv("fdtfile", info);
 #endif
 }
-- 
1.9.1



More information about the U-Boot mailing list