From a02c9b9da313d8d46ac471e2cdc058c465f81862 Mon Sep 17 00:00:00 2001 From: Rene Straub Date: Mon, 15 Jun 2020 13:45:51 +0200 Subject: [PATCH] nmhw21,26: getting hardware type from BD this is the precursor to make the bootloader hw26 aware. --- board/nm/nmhw21/board.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/board/nm/nmhw21/board.c b/board/nm/nmhw21/board.c index ba13444836..668426e843 100644 --- a/board/nm/nmhw21/board.c +++ b/board/nm/nmhw21/board.c @@ -148,6 +148,7 @@ DECLARE_GLOBAL_DATA_PTR; static int hw_ver = -1; static int hw_rev = -1; static int hw_patch = -1; +static int hw_type = -1; static char hw_variant_name[64]; #endif @@ -983,8 +984,13 @@ static void get_hw_version(void) bd_get_hw_version(&hw_ver, &hw_rev); bd_get_hw_patch(&hw_patch); + bd_get_hw_type(&hw_type); + if (hw_type == 0) { + /* Fallback to HW21 if tag is not present */ + hw_type = 21; + } - printf("HW21: V%d.%d\n", hw_ver, hw_rev); + printf("HW%02d: V%d.%d\n", hw_type, hw_ver, hw_rev); /* add hardware versions to environment */ snprintf(hw_versions, sizeof(hw_versions), "CP=%d.%d", hw_ver, hw_rev); @@ -998,8 +1004,13 @@ static void get_hw_version(void) { bd_get_hw_version(&hw_ver, &hw_rev); bd_get_hw_patch(&hw_patch); + bd_get_hw_type(&hw_type); + if (hw_type == 0) { + /* Fallback to HW21 if tag is not present */ + hw_type = 21; + } - printf("MB: V%d.%d\n", hw_ver, hw_rev); + printf("MB: V%d.%d (HW%2d)\n", hw_ver, hw_rev, hw_type); } #endif