From 5106613d9dfb118d79b5e8b4aa4fd267da8e4ca0 Mon Sep 17 00:00:00 2001
From: Przemyslaw Marczak
Date: Wed, 12 Nov 2014 14:49:35 +0100
Subject: [PATCH] samsung: common: add get_plat_name()/get_board_model()
This patch introduce some cleanup in set_board_info(),
related to the listed code changes:
Change 1:
The name of function get_board_type() was unclear,
so now it is changed to get_board_model().
Change 2:
The previous version of get_board_name() was returning
the platform name - now it returns full boardname.
Change 3:
Add new function get_plat_name() - returns platform name.
This is useful for platform common usage like environment
settings.
Change-Id: If07de08bd4e97695fc906b4f4e6f239e49756eac
Signed-off-by: Przemyslaw Marczak
---
board/samsung/common/board.c | 2 +-
board/samsung/common/exynos4-dt.c | 15 +++++++++++++--
board/samsung/common/misc.c | 9 +++------
include/samsung/misc.h | 3 ++-
4 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index dce5190..80d64b2 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -337,7 +337,7 @@ int checkboard(void)
board_info = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
printf("Board: %s\n", board_info ? board_info : "unknown");
#ifdef CONFIG_BOARD_TYPES
- board_info = get_board_type();
+ board_info = get_board_model();
printf("Model: %s\n", board_info ? board_info : "unknown");
#endif
diff --git a/board/samsung/common/exynos4-dt.c b/board/samsung/common/exynos4-dt.c
index fd92076..c1e7ad8 100644
--- a/board/samsung/common/exynos4-dt.c
+++ b/board/samsung/common/exynos4-dt.c
@@ -71,7 +71,7 @@ static const char *board_compat[] = {
"samsung,odroid",
};
-static const char *board_name[] = {
+static const char *plat_name[] = {
"trats",
"odroid",
"odroid",
@@ -83,6 +83,12 @@ static const char *board_model[] = {
"x2",
};
+static const char *board_name[] = {
+ "trats2",
+ "odroidu3",
+ "odroidx2",
+};
+
extern void sdelay(unsigned long);
void set_board_type(void)
@@ -164,12 +170,17 @@ int board_is_odroid_u3(void)
return 0;
}
+const char *get_plat_name(void)
+{
+ return plat_name[gd->board_type];
+}
+
const char *get_board_name(void)
{
return board_name[gd->board_type];
}
-const char *get_board_type(void)
+const char *get_board_model(void)
{
return board_model[gd->board_type];
}
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 2462ccd..97946dd 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -78,19 +78,16 @@ void set_board_info(void)
setenv("board_rev", info);
#endif
#ifdef CONFIG_OF_LIBFDT
- const char *bdtype = "";
const char *bdname = CONFIG_SYS_BOARD;
#ifdef CONFIG_BOARD_TYPES
- bdtype = get_board_type();
#ifdef CONFIG_OF_MULTI
bdname = get_board_name();
#endif
- sprintf(info, "%s%s", bdname, bdtype);
- setenv("boardname", info);
+ setenv("boardname", bdname);
#endif
- snprintf(info, ARRAY_SIZE(info), "%s%x-%s%s.dtb",
- CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
+ snprintf(info, ARRAY_SIZE(info), "%s%x-%s.dtb",
+ CONFIG_SYS_SOC, s5p_cpu_id, bdname);
setenv("fdtfile", info);
#endif
/* Set GPT layout for Trats2 */
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
index 0eca2d1..140a658 100644
--- a/include/samsung/misc.h
+++ b/include/samsung/misc.h
@@ -66,8 +66,9 @@ void set_dfu_alt_info(void);
#endif
#ifdef CONFIG_BOARD_TYPES
void set_board_type(void);
-const char *get_board_type(void);
+const char *get_board_model(void);
#ifdef CONFIG_OF_MULTI
+const char *get_plat_name(void);
const char *get_board_name(void);
#endif
#endif
--
2.7.4