[U-Boot] [PATCH 7/8] ARM: UniPhier: display model name if it is available in device tree

Masahiro Yamada yamada.m at jp.panasonic.com
Wed Nov 26 10:34:03 CET 2014


If CONFIG_OF_CONTROL is defined and the root node of the device tree
has "model" property, display the model name instead of the hard-coded
board name.

Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
---

 arch/arm/cpu/armv7/uniphier/Makefile              |  1 +
 arch/arm/cpu/armv7/uniphier/board_info.c          | 25 +++++++++++++++++++++++
 arch/arm/cpu/armv7/uniphier/ph1-ld4/board_info.c  |  8 +-------
 arch/arm/cpu/armv7/uniphier/ph1-pro4/board_info.c |  9 ++------
 arch/arm/cpu/armv7/uniphier/ph1-sld8/board_info.c |  9 ++------
 arch/arm/include/asm/arch-uniphier/board.h        |  2 ++
 6 files changed, 33 insertions(+), 21 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/uniphier/board_info.c

diff --git a/arch/arm/cpu/armv7/uniphier/Makefile b/arch/arm/cpu/armv7/uniphier/Makefile
index 0f64d25..77650bd 100644
--- a/arch/arm/cpu/armv7/uniphier/Makefile
+++ b/arch/arm/cpu/armv7/uniphier/Makefile
@@ -11,6 +11,7 @@ obj-y += cache_uniphier.o
 obj-$(CONFIG_BOARD_POSTCLK_INIT) += board_postclk_init.o
 obj-y += dram_init.o
 obj-$(CONFIG_DISPLAY_CPUINFO) += cpu_info.o
+obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o
 obj-$(CONFIG_BOARD_LATE_INIT) += board_late_init.o
 obj-$(CONFIG_UNIPHIER_SMP) += smp.o
 obj-$(CONFIG_CMD_PINMON) += cmd_pinmon.o
diff --git a/arch/arm/cpu/armv7/uniphier/board_info.c b/arch/arm/cpu/armv7/uniphier/board_info.c
new file mode 100644
index 0000000..bd56c11
--- /dev/null
+++ b/arch/arm/cpu/armv7/uniphier/board_info.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014 Panasonic Corporation
+ *   Author: Masahiro Yamada <yamada.m at jp.panasonic.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/board.h>
+
+int checkboard(void)
+{
+	const char *model = NULL;
+#ifdef CONFIG_OF_CONTROL
+	DECLARE_GLOBAL_DATA_PTR;
+
+	model = (const char *)fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+#endif
+	if (!model)
+		model = uniphier_board_name;
+
+	printf("Board: %s\n", model);
+
+	return check_support_card();
+}
diff --git a/arch/arm/cpu/armv7/uniphier/ph1-ld4/board_info.c b/arch/arm/cpu/armv7/uniphier/ph1-ld4/board_info.c
index 27d772e..a84b77f 100644
--- a/arch/arm/cpu/armv7/uniphier/ph1-ld4/board_info.c
+++ b/arch/arm/cpu/armv7/uniphier/ph1-ld4/board_info.c
@@ -5,12 +5,6 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#include <common.h>
 #include <asm/arch/board.h>
 
-int checkboard(void)
-{
-	puts("Board: PH1-LD4 Board\n");
-
-	return check_support_card();
-}
+const char *uniphier_board_name = "PH1-LD4 Board";
diff --git a/arch/arm/cpu/armv7/uniphier/ph1-pro4/board_info.c b/arch/arm/cpu/armv7/uniphier/ph1-pro4/board_info.c
index 325a4f6..94897d5 100644
--- a/arch/arm/cpu/armv7/uniphier/ph1-pro4/board_info.c
+++ b/arch/arm/cpu/armv7/uniphier/ph1-pro4/board_info.c
@@ -5,12 +5,7 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#include <common.h>
-#include <asm/arch/board.h>
 
-int checkboard(void)
-{
-	puts("Board: PH1-Pro4 Board\n");
+#include <asm/arch/board.h>
 
-	return check_support_card();
-}
+const char *uniphier_board_name = "PH1-Pro4 Board";
diff --git a/arch/arm/cpu/armv7/uniphier/ph1-sld8/board_info.c b/arch/arm/cpu/armv7/uniphier/ph1-sld8/board_info.c
index 15dc289..3a293be 100644
--- a/arch/arm/cpu/armv7/uniphier/ph1-sld8/board_info.c
+++ b/arch/arm/cpu/armv7/uniphier/ph1-sld8/board_info.c
@@ -5,12 +5,7 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#include <common.h>
-#include <asm/arch/board.h>
 
-int checkboard(void)
-{
-	puts("Board: PH1-sLD8 Board\n");
+#include <asm/arch/board.h>
 
-	return check_support_card();
-}
+const char *uniphier_board_name = "PH1-sLD8 Board";
diff --git a/arch/arm/include/asm/arch-uniphier/board.h b/arch/arm/include/asm/arch-uniphier/board.h
index e6ba4e4..1b50dd2 100644
--- a/arch/arm/include/asm/arch-uniphier/board.h
+++ b/arch/arm/include/asm/arch-uniphier/board.h
@@ -22,6 +22,8 @@ static inline int check_support_card(void)
 }
 #endif
 
+extern const char *uniphier_board_name;
+
 static inline void uniphier_board_reset(void)
 {
 	support_card_reset();
-- 
1.9.1



More information about the U-Boot mailing list