[U-Boot] [PATCH 3/5] i.MX6: nitrogen6x/sabrelite: override set_board_name()

Eric Nelson eric.nelson at boundarydevices.com
Sun Nov 17 18:17:45 CET 2013


Since the nitrogen6x board file auto-detects Nitrogen6x and
SABRE Lite boards, override set_board_name to produce one
of two values for board_name.

Signed-off-by: Eric Nelson <eric.nelson at boundarydevices.com>
---
 board/boundary/nitrogen6x/nitrogen6x.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 616ad55..aa9717a 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -756,9 +756,14 @@ int board_init(void)
 	return 0;
 }
 
+static inline int is_n6x(void)
+{
+	return gpio_get_value(WL12XX_WL_IRQ_GP);
+}
+
 int checkboard(void)
 {
-	if (gpio_get_value(WL12XX_WL_IRQ_GP))
+	if (is_n6x())
 		puts("Board: Nitrogen6X\n");
 	else
 		puts("Board: SABRE Lite\n");
@@ -766,6 +771,13 @@ int checkboard(void)
 	return 0;
 }
 
+void set_board_name(void)
+{
+	char *old = getenv("board_name");
+	if (!old)
+		setenv("board_name", is_n6x() ? "nitrogen6x" : "sabrelite");
+}
+
 struct button_key {
 	char const	*name;
 	unsigned	gpnum;
-- 
1.8.1.2



More information about the U-Boot mailing list