[PATCH v1 0/8] board: toradex: Refactor config block handling and cleanup

Hi all, this series introduces some cleanup in the board/toradex common code, mainly around the config block handling and related informations.
The main change is a major rework of the interactive block creation function (used to re-create production data information, e.g. serial# and SKU number) to select the product ID from a short list instead of a long y/n question/answer list that was deciding the exact product ID depending on the answer. This code was getting too complex and not possible to maintain anymore.
This change is build on top of `toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku` from Philippe that is not yet applied to u-boot/master, for simplicity it is now integrated into this series.
All the other changes are small cleanups on the board info prints (product id is now printed), the product names are now the official Toradex products names and a couple of other trivial improvements I did while working on this.
Francesco Dolcini (7): toradex: common: Remove stale comments about modules availability toradex: common: Use ARRAY_SIZE macro toradex: tdx-cfg-block: Cleanup interactive cfg block creation toradex: common: Remove stale function declaration toradex: common: Remove #ifdef usage for 2nd ethaddr toradex: tdx-cfg-block: Use official SKU names toradex: common: Improve product/serial print during boot
Philippe Schenker (1): toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku
board/toradex/common/tdx-cfg-block.c | 350 +++++--------------- board/toradex/common/tdx-cfg-block.h | 12 +- board/toradex/common/tdx-common.c | 14 +- board/toradex/common/tdx-common.h | 4 - board/toradex/verdin-imx8mm/verdin-imx8mm.c | 3 +- 5 files changed, 105 insertions(+), 278 deletions(-)

From: Philippe Schenker philippe.schenker@toradex.com
Add new i.MX 8M Mini SKU to ConfigBlock handling.
0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN
This SKU is identical to 0055 but without CAN. Mention this in the name so those modules can be distinguished.
Signed-off-by: Philippe Schenker philippe.schenker@toradex.com Reviewed-by: Francesco Dolcini francesco.dolcini@toradex.com Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com --- board/toradex/common/tdx-cfg-block.c | 13 ++++++++++++- board/toradex/common/tdx-cfg-block.h | 1 + board/toradex/verdin-imx8mm/verdin-imx8mm.c | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 9305709a3c0d..53302925dc24 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -145,6 +145,7 @@ const char * const toradex_modules[] = { [65] = "Verdin iMX8M Plus QuadLite 1GB IT", [66] = "Verdin iMX8M Plus Quad 8GB Wi-Fi / BT", [67] = "Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT", + [68] = "Verdin iMX8M Mini Quad 2GB WB IT No CAN", };
const char * const toradex_carrier_boards[] = { @@ -408,6 +409,7 @@ static int get_cfgblock_interactive(void) char it = 'n'; char wb = 'n'; char mem8g = 'n'; + char can = 'y'; int len = 0; int ret = 0;
@@ -435,6 +437,13 @@ static int get_cfgblock_interactive(void) mem8g = console_buffer[0]; } #endif +#if defined(CONFIG_TARGET_VERDIN_IMX8MM) + if (is_cpu_type(MXC_CPU_IMX8MM) && (wb == 'y' || wb == 'Y')) { + sprintf(message, "Does your module have CAN? [y/N] "); + len = cli_readline(message); + can = console_buffer[0]; + } +#endif #endif
soc = env_get("soc"); @@ -522,7 +531,9 @@ static int get_cfgblock_interactive(void) else tdx_hw_tag.prodid = VERDIN_IMX8MMDL; } else if (is_cpu_type(MXC_CPU_IMX8MM)) { - if (wb == 'y' || wb == 'Y') + if (can == 'n' || can == 'N') + tdx_hw_tag.prodid = VERDIN_IMX8MMQ_WIFI_BT_IT_NO_CAN; + else if (wb == 'y' || wb == 'Y') tdx_hw_tag.prodid = VERDIN_IMX8MMQ_WIFI_BT_IT; else tdx_hw_tag.prodid = VERDIN_IMX8MMQ_IT; diff --git a/board/toradex/common/tdx-cfg-block.h b/board/toradex/common/tdx-cfg-block.h index 179069848639..79cd09c78d00 100644 --- a/board/toradex/common/tdx-cfg-block.h +++ b/board/toradex/common/tdx-cfg-block.h @@ -88,6 +88,7 @@ enum { VERDIN_IMX8MPQL_IT, /* 65 */ VERDIN_IMX8MPQ_8GB_WIFI_BT, APALIS_IMX8QM_8GB_WIFI_BT_IT, + VERDIN_IMX8MMQ_WIFI_BT_IT_NO_CAN, };
enum { diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c index c51c99b5156c..7597cd81f945 100644 --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c @@ -83,7 +83,8 @@ static void select_dt_from_module_version(void) * device tree. */ is_wifi = (tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT) || - (tdx_hw_tag.prodid == VERDIN_IMX8MMDL_WIFI_BT_IT); + (tdx_hw_tag.prodid == VERDIN_IMX8MMDL_WIFI_BT_IT) || + (tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT_NO_CAN); }
switch (get_pcb_revision()) {

Remove comment "not currently on sale" on specific SKUs, this information does not belong to the code and will never be accurate.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com --- board/toradex/common/tdx-cfg-block.c | 4 ++-- board/toradex/common/tdx-cfg-block.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 53302925dc24..67d007827be6 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -87,7 +87,7 @@ const char * const toradex_modules[] = { [7] = "Colibri PXA300 208MHz XT", [8] = "Colibri PXA270 312MHz", [9] = "Colibri PXA270 520MHz", - [10] = "Colibri VF50 128MB", /* not currently on sale */ + [10] = "Colibri VF50 128MB", [11] = "Colibri VF61 256MB", [12] = "Colibri VF61 256MB IT", [13] = "Colibri VF50 128MB IT", @@ -133,7 +133,7 @@ const char * const toradex_modules[] = { [53] = "Apalis iMX8 QuadXPlus 2GB ECC IT", [54] = "Apalis iMX8 DualXPlus 1GB", [55] = "Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT", - [56] = "Verdin iMX8M Nano Quad 1GB Wi-Fi / BT", /* not currently on sale */ + [56] = "Verdin iMX8M Nano Quad 1GB Wi-Fi / BT", [57] = "Verdin iMX8M Mini DualLite 1GB", [58] = "Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT", [59] = "Verdin iMX8M Mini Quad 2GB IT", diff --git a/board/toradex/common/tdx-cfg-block.h b/board/toradex/common/tdx-cfg-block.h index 79cd09c78d00..028e6b12735f 100644 --- a/board/toradex/common/tdx-cfg-block.h +++ b/board/toradex/common/tdx-cfg-block.h @@ -31,7 +31,7 @@ enum { COLIBRI_PXA270_312MHZ, COLIBRI_PXA270_520MHZ, COLIBRI_VF50, /* 10 */ - COLIBRI_VF61, /* not currently on sale */ + COLIBRI_VF61, COLIBRI_VF61_IT, COLIBRI_VF50_IT, COLIBRI_IMX6S, @@ -62,7 +62,7 @@ enum { COLIBRI_IMX7D_EMMC, COLIBRI_IMX6ULL_WIFI_BT_IT, /* 40 */ COLIBRI_IMX7D_EPDC, - APALIS_TK1_4GB, /* not currently on sale */ + APALIS_TK1_4GB, COLIBRI_T20_512MB_IT_SETEK, COLIBRI_IMX6ULL_IT, COLIBRI_IMX6ULL_WIFI_BT, /* 45 */

Use generally available ARRAY_SIZE macro, instead of hand-coding it every time is needed.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com --- board/toradex/common/tdx-cfg-block.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 67d007827be6..26596199a381 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -381,8 +381,7 @@ int read_tdx_cfg_block(void) }
/* Cap product id to avoid issues with a yet unknown one */ - if (tdx_hw_tag.prodid >= (sizeof(toradex_modules) / - sizeof(toradex_modules[0]))) + if (tdx_hw_tag.prodid >= ARRAY_SIZE(toradex_modules)) tdx_hw_tag.prodid = 0;
out: @@ -822,8 +821,7 @@ static int get_cfgblock_carrier_interactive(void)
printf("Supported carrier boards:\n"); printf("CARRIER BOARD NAME\t\t [ID]\n"); - for (int i = 0; i < sizeof(toradex_carrier_boards) / - sizeof(toradex_carrier_boards[0]); i++) + for (int i = 0; i < ARRAY_SIZE(toradex_carrier_boards); i++) if (toradex_carrier_boards[i]) printf("%s \t\t [%d]\n", toradex_carrier_boards[i], i);

Simplify interactive config block creation code, instead of having a a long list of questions and a complex tree of preprocessor directive to guess the exact SKU, just ask the user to select it from a list.
The modules list is filtered out to include only SKUs that are supported by the specific u-boot binary in execution.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com --- board/toradex/common/tdx-cfg-block.c | 355 +++++++-------------------- board/toradex/common/tdx-cfg-block.h | 7 +- board/toradex/common/tdx-common.c | 2 +- 3 files changed, 92 insertions(+), 272 deletions(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 26596199a381..b7c7301af8f7 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -11,17 +11,6 @@ #include <command.h> #include <asm/cache.h>
-#if defined(CONFIG_TARGET_APALIS_IMX6) || \ - defined(CONFIG_TARGET_APALIS_IMX8) || \ - defined(CONFIG_TARGET_COLIBRI_IMX6) || \ - defined(CONFIG_TARGET_COLIBRI_IMX8X) || \ - defined(CONFIG_TARGET_VERDIN_IMX8MM) || \ - defined(CONFIG_TARGET_VERDIN_IMX8MN) || \ - defined(CONFIG_TARGET_VERDIN_IMX8MP) -#include <asm/arch/sys_proto.h> -#else -#define is_cpu_type(cpu) (0) -#endif #include <cli.h> #include <console.h> #include <env.h> @@ -76,76 +65,78 @@ bool valid_cfgblock_carrier; struct toradex_hw tdx_car_hw_tag; #endif
-const char * const toradex_modules[] = { - [0] = "UNKNOWN MODULE", - [1] = "Colibri PXA270 312MHz", - [2] = "Colibri PXA270 520MHz", - [3] = "Colibri PXA320 806MHz", - [4] = "Colibri PXA300 208MHz", - [5] = "Colibri PXA310 624MHz", - [6] = "Colibri PXA320 806MHz IT", - [7] = "Colibri PXA300 208MHz XT", - [8] = "Colibri PXA270 312MHz", - [9] = "Colibri PXA270 520MHz", - [10] = "Colibri VF50 128MB", - [11] = "Colibri VF61 256MB", - [12] = "Colibri VF61 256MB IT", - [13] = "Colibri VF50 128MB IT", - [14] = "Colibri iMX6 Solo 256MB", - [15] = "Colibri iMX6 DualLite 512MB", - [16] = "Colibri iMX6 Solo 256MB IT", - [17] = "Colibri iMX6 DualLite 512MB IT", - [18] = "UNKNOWN MODULE", - [19] = "UNKNOWN MODULE", - [20] = "Colibri T20 256MB", - [21] = "Colibri T20 512MB", - [22] = "Colibri T20 512MB IT", - [23] = "Colibri T30 1GB", - [24] = "Colibri T20 256MB IT", - [25] = "Apalis T30 2GB", - [26] = "Apalis T30 1GB", - [27] = "Apalis iMX6 Quad 1GB", - [28] = "Apalis iMX6 Quad 2GB IT", - [29] = "Apalis iMX6 Dual 512MB", - [30] = "Colibri T30 1GB IT", - [31] = "Apalis T30 1GB IT", - [32] = "Colibri iMX7 Solo 256MB", - [33] = "Colibri iMX7 Dual 512MB", - [34] = "Apalis TK1 2GB", - [35] = "Apalis iMX6 Dual 1GB IT", - [36] = "Colibri iMX6ULL 256MB", - [37] = "Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT", - [38] = "Colibri iMX8 QuadXPlus 2GB Wi-Fi / BT IT", - [39] = "Colibri iMX7 Dual 1GB (eMMC)", - [40] = "Colibri iMX6ULL 512MB Wi-Fi / BT IT", - [41] = "Colibri iMX7 Dual 512MB EPDC", - [42] = "Apalis TK1 4GB", - [43] = "Colibri T20 512MB IT SETEK", - [44] = "Colibri iMX6ULL 512MB IT", - [45] = "Colibri iMX6ULL 512MB Wi-Fi / Bluetooth", - [46] = "Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT", - [47] = "Apalis iMX8 QuadMax 4GB IT", - [48] = "Apalis iMX8 QuadPlus 2GB Wi-Fi / BT", - [49] = "Apalis iMX8 QuadPlus 2GB", - [50] = "Colibri iMX8 QuadXPlus 2GB IT", - [51] = "Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth", - [52] = "Colibri iMX8 DualX 1GB", - [53] = "Apalis iMX8 QuadXPlus 2GB ECC IT", - [54] = "Apalis iMX8 DualXPlus 1GB", - [55] = "Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT", - [56] = "Verdin iMX8M Nano Quad 1GB Wi-Fi / BT", - [57] = "Verdin iMX8M Mini DualLite 1GB", - [58] = "Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT", - [59] = "Verdin iMX8M Mini Quad 2GB IT", - [60] = "Verdin iMX8M Mini DualLite 1GB WB IT", - [61] = "Verdin iMX8M Plus Quad 2GB", - [62] = "Colibri iMX6ULL 1GB IT (eMMC)", - [63] = "Verdin iMX8M Plus Quad 4GB IT", - [64] = "Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT", - [65] = "Verdin iMX8M Plus QuadLite 1GB IT", - [66] = "Verdin iMX8M Plus Quad 8GB Wi-Fi / BT", - [67] = "Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT", - [68] = "Verdin iMX8M Mini Quad 2GB WB IT No CAN", +#define TARGET_IS_ENABLED(x) IS_ENABLED(CONFIG_TARGET_ ## x) + +const struct toradex_som toradex_modules[] = { + [0] = { "UNKNOWN MODULE", 0 }, + [1] = { "Colibri PXA270 312MHz", 0 }, + [2] = { "Colibri PXA270 520MHz", 0 }, + [3] = { "Colibri PXA320 806MHz", 0 }, + [4] = { "Colibri PXA300 208MHz", 0 }, + [5] = { "Colibri PXA310 624MHz", 0 }, + [6] = { "Colibri PXA320 806MHz IT", 0 }, + [7] = { "Colibri PXA300 208MHz XT", 0 }, + [8] = { "Colibri PXA270 312MHz", 0 }, + [9] = { "Colibri PXA270 520MHz", 0 }, + [10] = { "Colibri VF50 128MB", TARGET_IS_ENABLED(COLIBRI_VF) }, + [11] = { "Colibri VF61 256MB", TARGET_IS_ENABLED(COLIBRI_VF) }, + [12] = { "Colibri VF61 256MB IT", TARGET_IS_ENABLED(COLIBRI_VF) }, + [13] = { "Colibri VF50 128MB IT", TARGET_IS_ENABLED(COLIBRI_VF) }, + [14] = { "Colibri iMX6 Solo 256MB", TARGET_IS_ENABLED(COLIBRI_IMX6) }, + [15] = { "Colibri iMX6 DualLite 512MB", TARGET_IS_ENABLED(COLIBRI_IMX6) }, + [16] = { "Colibri iMX6 Solo 256MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6) }, + [17] = { "Colibri iMX6 DualLite 512MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6) }, + [18] = { "UNKNOWN MODULE", 0 }, + [19] = { "UNKNOWN MODULE", 0 }, + [20] = { "Colibri T20 256MB", TARGET_IS_ENABLED(COLIBRI_T20) }, + [21] = { "Colibri T20 512MB", TARGET_IS_ENABLED(COLIBRI_T20) }, + [22] = { "Colibri T20 512MB IT", TARGET_IS_ENABLED(COLIBRI_T20) }, + [23] = { "Colibri T30 1GB", TARGET_IS_ENABLED(COLIBRI_T30) }, + [24] = { "Colibri T20 256MB IT", TARGET_IS_ENABLED(COLIBRI_T20) }, + [25] = { "Apalis T30 2GB", TARGET_IS_ENABLED(APALIS_T30) }, + [26] = { "Apalis T30 1GB", TARGET_IS_ENABLED(APALIS_T30) }, + [27] = { "Apalis iMX6 Quad 1GB", TARGET_IS_ENABLED(APALIS_IMX6) }, + [28] = { "Apalis iMX6 Quad 2GB IT", TARGET_IS_ENABLED(APALIS_IMX6) }, + [29] = { "Apalis iMX6 Dual 512MB", TARGET_IS_ENABLED(APALIS_IMX6) }, + [30] = { "Colibri T30 1GB IT", TARGET_IS_ENABLED(COLIBRI_T30) }, + [31] = { "Apalis T30 1GB IT", TARGET_IS_ENABLED(APALIS_T30) }, + [32] = { "Colibri iMX7 Solo 256MB", TARGET_IS_ENABLED(COLIBRI_IMX7) }, + [33] = { "Colibri iMX7 Dual 512MB", TARGET_IS_ENABLED(COLIBRI_IMX7) }, + [34] = { "Apalis TK1 2GB", TARGET_IS_ENABLED(APALIS_TK1) }, + [35] = { "Apalis iMX6 Dual 1GB IT", TARGET_IS_ENABLED(APALIS_IMX6) }, + [36] = { "Colibri iMX6ULL 256MB", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [37] = { "Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT", TARGET_IS_ENABLED(APALIS_IMX8) }, + [38] = { "Colibri iMX8 QuadXPlus 2GB Wi-Fi / BT IT", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, + [39] = { "Colibri iMX7 Dual 1GB (eMMC)", TARGET_IS_ENABLED(COLIBRI_IMX7) }, + [40] = { "Colibri iMX6ULL 512MB Wi-Fi / BT IT", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [41] = { "Colibri iMX7 Dual 512MB EPDC", TARGET_IS_ENABLED(COLIBRI_IMX7) }, + [42] = { "Apalis TK1 4GB", TARGET_IS_ENABLED(APALIS_TK1) }, + [43] = { "Colibri T20 512MB IT SETEK", TARGET_IS_ENABLED(COLIBRI_T20) }, + [44] = { "Colibri iMX6ULL 512MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [45] = { "Colibri iMX6ULL 512MB Wi-Fi / Bluetooth", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [46] = { "Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT", 0 }, + [47] = { "Apalis iMX8 QuadMax 4GB IT", TARGET_IS_ENABLED(APALIS_IMX8) }, + [48] = { "Apalis iMX8 QuadPlus 2GB Wi-Fi / BT", TARGET_IS_ENABLED(APALIS_IMX8) }, + [49] = { "Apalis iMX8 QuadPlus 2GB", TARGET_IS_ENABLED(APALIS_IMX8) }, + [50] = { "Colibri iMX8 QuadXPlus 2GB IT", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, + [51] = { "Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, + [52] = { "Colibri iMX8 DualX 1GB", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, + [53] = { "Apalis iMX8 QuadXPlus 2GB ECC IT", 0 }, + [54] = { "Apalis iMX8 DualXPlus 1GB", TARGET_IS_ENABLED(APALIS_IMX8) }, + [55] = { "Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [56] = { "Verdin iMX8M Nano Quad 1GB Wi-Fi / BT", 0 }, + [57] = { "Verdin iMX8M Mini DualLite 1GB", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [58] = { "Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [59] = { "Verdin iMX8M Mini Quad 2GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [60] = { "Verdin iMX8M Mini DualLite 1GB WB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [61] = { "Verdin iMX8M Plus Quad 2GB", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [62] = { "Colibri iMX6ULL 1GB IT (eMMC)", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [63] = { "Verdin iMX8M Plus Quad 4GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [64] = { "Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [65] = { "Verdin iMX8M Plus QuadLite 1GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [66] = { "Verdin iMX8M Plus Quad 8GB Wi-Fi / BT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [67] = { "Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT", TARGET_IS_ENABLED(APALIS_IMX8) }, + [68] = { "Verdin iMX8M Mini Quad 2GB WB IT No CAN", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, };
const char * const toradex_carrier_boards[] = { @@ -404,204 +395,28 @@ static int parse_assembly_string(char *string_to_parse, u16 *assembly) static int get_cfgblock_interactive(void) { char message[CONFIG_SYS_CBSIZE]; - char *soc; - char it = 'n'; - char wb = 'n'; - char mem8g = 'n'; - char can = 'y'; int len = 0; int ret = 0; + unsigned int prodid; + int i;
- /* Unknown module by default */ - tdx_hw_tag.prodid = 0; - - sprintf(message, "Is the module an IT version? [y/N] "); - - len = cli_readline(message); - it = console_buffer[0]; - -#if defined(CONFIG_TARGET_APALIS_IMX8) || \ - defined(CONFIG_TARGET_COLIBRI_IMX6ULL) || \ - defined(CONFIG_TARGET_COLIBRI_IMX8X) || \ - defined(CONFIG_TARGET_VERDIN_IMX8MM) || \ - defined(CONFIG_TARGET_VERDIN_IMX8MP) - sprintf(message, "Does the module have Wi-Fi / Bluetooth? [y/N] "); - len = cli_readline(message); - wb = console_buffer[0]; - -#if defined(CONFIG_TARGET_APALIS_IMX8) - if ((wb == 'y' || wb == 'Y') && (it == 'y' || it == 'Y')) { - sprintf(message, "Does your module have 8GB of RAM? [y/N] "); - len = cli_readline(message); - mem8g = console_buffer[0]; + printf("Enabled modules:\n"); + for (i = 0; i < ARRAY_SIZE(toradex_modules); i++) { + if (toradex_modules[i].is_enabled) + printf(" %04d %s\n", i, toradex_modules[i].name); } -#endif -#if defined(CONFIG_TARGET_VERDIN_IMX8MM) - if (is_cpu_type(MXC_CPU_IMX8MM) && (wb == 'y' || wb == 'Y')) { - sprintf(message, "Does your module have CAN? [y/N] "); - len = cli_readline(message); - can = console_buffer[0]; - } -#endif -#endif
- soc = env_get("soc"); - if (!strcmp("mx6", soc)) { -#ifdef CONFIG_TARGET_APALIS_IMX6 - if (it == 'y' || it == 'Y') { - if (is_cpu_type(MXC_CPU_MX6Q)) - tdx_hw_tag.prodid = APALIS_IMX6Q_IT; - else - tdx_hw_tag.prodid = APALIS_IMX6D_IT; - } else { - if (is_cpu_type(MXC_CPU_MX6Q)) - tdx_hw_tag.prodid = APALIS_IMX6Q; - else - tdx_hw_tag.prodid = APALIS_IMX6D; - } -#elif CONFIG_TARGET_COLIBRI_IMX6 - if (it == 'y' || it == 'Y') { - if (is_cpu_type(MXC_CPU_MX6DL)) - tdx_hw_tag.prodid = COLIBRI_IMX6DL_IT; - else if (is_cpu_type(MXC_CPU_MX6SOLO)) - tdx_hw_tag.prodid = COLIBRI_IMX6S_IT; - } else { - if (is_cpu_type(MXC_CPU_MX6DL)) - tdx_hw_tag.prodid = COLIBRI_IMX6DL; - else if (is_cpu_type(MXC_CPU_MX6SOLO)) - tdx_hw_tag.prodid = COLIBRI_IMX6S; - } -#elif CONFIG_TARGET_COLIBRI_IMX6ULL - if (it == 'y' || it == 'Y') { - if (wb == 'y' || wb == 'Y') - tdx_hw_tag.prodid = COLIBRI_IMX6ULL_WIFI_BT_IT; - else - if (gd->ram_size == 0x20000000) - tdx_hw_tag.prodid = COLIBRI_IMX6ULL_IT; - else - tdx_hw_tag.prodid = COLIBRI_IMX6ULL_IT_EMMC; - } else { - if (wb == 'y' || wb == 'Y') - tdx_hw_tag.prodid = COLIBRI_IMX6ULL_WIFI_BT; - else - tdx_hw_tag.prodid = COLIBRI_IMX6ULL; - } -#endif - } else if (!strcmp("imx7d", soc)) - if (gd->ram_size == 0x20000000) - tdx_hw_tag.prodid = COLIBRI_IMX7D; - else - tdx_hw_tag.prodid = COLIBRI_IMX7D_EMMC; - else if (!strcmp("imx7s", soc)) - tdx_hw_tag.prodid = COLIBRI_IMX7S; - else if (is_cpu_type(MXC_CPU_IMX8QM)) { - if (it == 'y' || it == 'Y') { - if (wb == 'y' || wb == 'Y') { - if (mem8g == 'y' || mem8g == 'Y') - tdx_hw_tag.prodid = APALIS_IMX8QM_8GB_WIFI_BT_IT; - else - tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT; - } - else - tdx_hw_tag.prodid = APALIS_IMX8QM_IT; - } else { - if (wb == 'y' || wb == 'Y') - tdx_hw_tag.prodid = APALIS_IMX8QP_WIFI_BT; - else - tdx_hw_tag.prodid = APALIS_IMX8QP; - } - } else if (is_cpu_type(MXC_CPU_IMX8QXP)) { -#ifdef CONFIG_TARGET_COLIBRI_IMX8X - if (it == 'y' || it == 'Y') { - if (wb == 'y' || wb == 'Y') - tdx_hw_tag.prodid = COLIBRI_IMX8QXP_WIFI_BT_IT; - else - tdx_hw_tag.prodid = COLIBRI_IMX8QXP_IT; - } else { - if (wb == 'y' || wb == 'Y') - tdx_hw_tag.prodid = COLIBRI_IMX8DX_WIFI_BT; - else - tdx_hw_tag.prodid = COLIBRI_IMX8DX; - } -#endif - } else if (is_cpu_type(MXC_CPU_IMX8MMDL)) { - if (wb == 'y' || wb == 'Y') - tdx_hw_tag.prodid = VERDIN_IMX8MMDL_WIFI_BT_IT; - else - tdx_hw_tag.prodid = VERDIN_IMX8MMDL; - } else if (is_cpu_type(MXC_CPU_IMX8MM)) { - if (can == 'n' || can == 'N') - tdx_hw_tag.prodid = VERDIN_IMX8MMQ_WIFI_BT_IT_NO_CAN; - else if (wb == 'y' || wb == 'Y') - tdx_hw_tag.prodid = VERDIN_IMX8MMQ_WIFI_BT_IT; - else - tdx_hw_tag.prodid = VERDIN_IMX8MMQ_IT; - } else if (is_cpu_type(MXC_CPU_IMX8MN)) { - tdx_hw_tag.prodid = VERDIN_IMX8MNQ_WIFI_BT; - } else if (is_cpu_type(MXC_CPU_IMX8MPL)) { - tdx_hw_tag.prodid = VERDIN_IMX8MPQL_IT; - } else if (is_cpu_type(MXC_CPU_IMX8MP)) { - if (wb == 'y' || wb == 'Y') - if (gd->ram_size == 0x80000000) - tdx_hw_tag.prodid = VERDIN_IMX8MPQ_2GB_WIFI_BT_IT; - else if (gd->ram_size == 0x200000000) - tdx_hw_tag.prodid = VERDIN_IMX8MPQ_8GB_WIFI_BT; - else - tdx_hw_tag.prodid = VERDIN_IMX8MPQ_WIFI_BT_IT; - else - if (it == 'y' || it == 'Y') - tdx_hw_tag.prodid = VERDIN_IMX8MPQ_IT; - else - tdx_hw_tag.prodid = VERDIN_IMX8MPQ; - } else if (!strcmp("tegra20", soc)) { - if (it == 'y' || it == 'Y') - if (gd->ram_size == 0x10000000) - tdx_hw_tag.prodid = COLIBRI_T20_256MB_IT; - else - tdx_hw_tag.prodid = COLIBRI_T20_512MB_IT; - else - if (gd->ram_size == 0x10000000) - tdx_hw_tag.prodid = COLIBRI_T20_256MB; - else - tdx_hw_tag.prodid = COLIBRI_T20_512MB; - } -#if defined(CONFIG_TARGET_APALIS_T30) || defined(CONFIG_TARGET_COLIBRI_T30) - else if (!strcmp("tegra30", soc)) { -#ifdef CONFIG_TARGET_APALIS_T30 - if (it == 'y' || it == 'Y') - tdx_hw_tag.prodid = APALIS_T30_IT; - else - if (gd->ram_size == 0x40000000) - tdx_hw_tag.prodid = APALIS_T30_1GB; - else - tdx_hw_tag.prodid = APALIS_T30_2GB; -#else - if (it == 'y' || it == 'Y') - tdx_hw_tag.prodid = COLIBRI_T30_IT; - else - tdx_hw_tag.prodid = COLIBRI_T30; -#endif - } -#endif /* CONFIG_TARGET_APALIS_T30 || CONFIG_TARGET_COLIBRI_T30 */ - else if (!strcmp("tegra124", soc)) { - tdx_hw_tag.prodid = APALIS_TK1_2GB; - } else if (!strcmp("vf500", soc)) { - if (it == 'y' || it == 'Y') - tdx_hw_tag.prodid = COLIBRI_VF50_IT; - else - tdx_hw_tag.prodid = COLIBRI_VF50; - } else if (!strcmp("vf610", soc)) { - if (it == 'y' || it == 'Y') - tdx_hw_tag.prodid = COLIBRI_VF61_IT; - else - tdx_hw_tag.prodid = COLIBRI_VF61; - } + sprintf(message, "Enter the module ID: "); + len = cli_readline(message);
- if (!tdx_hw_tag.prodid) { - printf("Module type not detectable due to unknown SoC\n"); + prodid = dectoul(console_buffer, NULL); + if (prodid >= ARRAY_SIZE(toradex_modules) || !toradex_modules[prodid].is_enabled) { + printf("Parsing module id failed\n"); return -1; } + tdx_hw_tag.prodid = prodid;
+ len = 0; while (len < 4) { sprintf(message, "Enter the module version (e.g. V1.1B or V1.1#26): V"); len = cli_readline(message); diff --git a/board/toradex/common/tdx-cfg-block.h b/board/toradex/common/tdx-cfg-block.h index 028e6b12735f..32e4c6f6879f 100644 --- a/board/toradex/common/tdx-cfg-block.h +++ b/board/toradex/common/tdx-cfg-block.h @@ -20,6 +20,11 @@ struct toradex_eth_addr { u32 nic:24; } __attribute__((__packed__));
+struct toradex_som { + const char *name; + int is_enabled; +}; + enum { COLIBRI_PXA270_V1_312MHZ = 1, COLIBRI_PXA270_V1_520MHZ, @@ -101,7 +106,7 @@ enum { VERDIN_DSI_TO_LVDS_ADAPTER = 159, };
-extern const char * const toradex_modules[]; +extern const struct toradex_som toradex_modules[]; extern const char * const toradex_carrier_boards[]; extern bool valid_cfgblock; extern struct toradex_hw tdx_hw_tag; diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c index 3798bf95378e..3643ebbb1632 100644 --- a/board/toradex/common/tdx-common.c +++ b/board/toradex/common/tdx-common.c @@ -116,7 +116,7 @@ int show_board_info(void) env_set("serial#", tdx_serial_str);
printf("Model: Toradex %s %s, Serial# %s\n", - toradex_modules[tdx_hw_tag.prodid], + toradex_modules[tdx_hw_tag.prodid].name, tdx_board_rev_str, tdx_serial_str); #ifdef CONFIG_TDX_CFG_BLOCK_EXTRA

Remove stale show_boot_logo() declaration, not used anywhere.
Fixes: e6fd30dd9eef ("toradex: drop legacy show_boot_logo function and use splashscreen") Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com --- board/toradex/common/tdx-common.h | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/board/toradex/common/tdx-common.h b/board/toradex/common/tdx-common.h index c96e8754e9e2..d446e9f1d5ca 100644 --- a/board/toradex/common/tdx-common.h +++ b/board/toradex/common/tdx-common.h @@ -12,8 +12,4 @@ int ft_common_board_setup(void *blob, struct bd_info *bd); u32 get_board_revision(void);
-#if defined(CONFIG_DM_VIDEO) -int show_boot_logo(void); -#endif - #endif /* _TDX_COMMON_H */

Fix checkpatch warn, use `IS_ENABLED(CONFIG_TDX_CFG_BLOCK_2ND_ETHADDR)` instead of `#ifdef CONFIG_TDX_CFG_BLOCK_2ND_ETHADDR`.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com --- board/toradex/common/tdx-common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c index 3643ebbb1632..2284fcddb510 100644 --- a/board/toradex/common/tdx-common.c +++ b/board/toradex/common/tdx-common.c @@ -151,8 +151,8 @@ int show_board_info(void) if (!eth_env_get_enetaddr("ethaddr", ethaddr)) eth_env_set_enetaddr("ethaddr", (u8 *)&tdx_eth_addr);
-#ifdef CONFIG_TDX_CFG_BLOCK_2ND_ETHADDR - if (!eth_env_get_enetaddr("eth1addr", ethaddr)) { + if (IS_ENABLED(CONFIG_TDX_CFG_BLOCK_2ND_ETHADDR) && + !eth_env_get_enetaddr("eth1addr", ethaddr)) { /* * Secondary MAC address is allocated from block * 0x100000 higher then the first MAC address @@ -161,7 +161,6 @@ int show_board_info(void) ethaddr[3] += 0x10; eth_env_set_enetaddr("eth1addr", ethaddr); } -#endif
return 0; }

Up to now in the code we named Toradex SKUs in a slightly different way compared to the official product name, start using the official names from now on to avoid misunderstanding.
This has also the nice benefit of the string being shorter, allowing to fit nicely in 80 columns even adding the product ID when printing the hardware information.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com --- board/toradex/common/tdx-cfg-block.c | 138 +++++++++++++-------------- 1 file changed, 69 insertions(+), 69 deletions(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index b7c7301af8f7..7cf2dfae9746 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -68,75 +68,75 @@ struct toradex_hw tdx_car_hw_tag; #define TARGET_IS_ENABLED(x) IS_ENABLED(CONFIG_TARGET_ ## x)
const struct toradex_som toradex_modules[] = { - [0] = { "UNKNOWN MODULE", 0 }, - [1] = { "Colibri PXA270 312MHz", 0 }, - [2] = { "Colibri PXA270 520MHz", 0 }, - [3] = { "Colibri PXA320 806MHz", 0 }, - [4] = { "Colibri PXA300 208MHz", 0 }, - [5] = { "Colibri PXA310 624MHz", 0 }, - [6] = { "Colibri PXA320 806MHz IT", 0 }, - [7] = { "Colibri PXA300 208MHz XT", 0 }, - [8] = { "Colibri PXA270 312MHz", 0 }, - [9] = { "Colibri PXA270 520MHz", 0 }, - [10] = { "Colibri VF50 128MB", TARGET_IS_ENABLED(COLIBRI_VF) }, - [11] = { "Colibri VF61 256MB", TARGET_IS_ENABLED(COLIBRI_VF) }, - [12] = { "Colibri VF61 256MB IT", TARGET_IS_ENABLED(COLIBRI_VF) }, - [13] = { "Colibri VF50 128MB IT", TARGET_IS_ENABLED(COLIBRI_VF) }, - [14] = { "Colibri iMX6 Solo 256MB", TARGET_IS_ENABLED(COLIBRI_IMX6) }, - [15] = { "Colibri iMX6 DualLite 512MB", TARGET_IS_ENABLED(COLIBRI_IMX6) }, - [16] = { "Colibri iMX6 Solo 256MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6) }, - [17] = { "Colibri iMX6 DualLite 512MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6) }, - [18] = { "UNKNOWN MODULE", 0 }, - [19] = { "UNKNOWN MODULE", 0 }, - [20] = { "Colibri T20 256MB", TARGET_IS_ENABLED(COLIBRI_T20) }, - [21] = { "Colibri T20 512MB", TARGET_IS_ENABLED(COLIBRI_T20) }, - [22] = { "Colibri T20 512MB IT", TARGET_IS_ENABLED(COLIBRI_T20) }, - [23] = { "Colibri T30 1GB", TARGET_IS_ENABLED(COLIBRI_T30) }, - [24] = { "Colibri T20 256MB IT", TARGET_IS_ENABLED(COLIBRI_T20) }, - [25] = { "Apalis T30 2GB", TARGET_IS_ENABLED(APALIS_T30) }, - [26] = { "Apalis T30 1GB", TARGET_IS_ENABLED(APALIS_T30) }, - [27] = { "Apalis iMX6 Quad 1GB", TARGET_IS_ENABLED(APALIS_IMX6) }, - [28] = { "Apalis iMX6 Quad 2GB IT", TARGET_IS_ENABLED(APALIS_IMX6) }, - [29] = { "Apalis iMX6 Dual 512MB", TARGET_IS_ENABLED(APALIS_IMX6) }, - [30] = { "Colibri T30 1GB IT", TARGET_IS_ENABLED(COLIBRI_T30) }, - [31] = { "Apalis T30 1GB IT", TARGET_IS_ENABLED(APALIS_T30) }, - [32] = { "Colibri iMX7 Solo 256MB", TARGET_IS_ENABLED(COLIBRI_IMX7) }, - [33] = { "Colibri iMX7 Dual 512MB", TARGET_IS_ENABLED(COLIBRI_IMX7) }, - [34] = { "Apalis TK1 2GB", TARGET_IS_ENABLED(APALIS_TK1) }, - [35] = { "Apalis iMX6 Dual 1GB IT", TARGET_IS_ENABLED(APALIS_IMX6) }, - [36] = { "Colibri iMX6ULL 256MB", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, - [37] = { "Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT", TARGET_IS_ENABLED(APALIS_IMX8) }, - [38] = { "Colibri iMX8 QuadXPlus 2GB Wi-Fi / BT IT", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, - [39] = { "Colibri iMX7 Dual 1GB (eMMC)", TARGET_IS_ENABLED(COLIBRI_IMX7) }, - [40] = { "Colibri iMX6ULL 512MB Wi-Fi / BT IT", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, - [41] = { "Colibri iMX7 Dual 512MB EPDC", TARGET_IS_ENABLED(COLIBRI_IMX7) }, - [42] = { "Apalis TK1 4GB", TARGET_IS_ENABLED(APALIS_TK1) }, - [43] = { "Colibri T20 512MB IT SETEK", TARGET_IS_ENABLED(COLIBRI_T20) }, - [44] = { "Colibri iMX6ULL 512MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, - [45] = { "Colibri iMX6ULL 512MB Wi-Fi / Bluetooth", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, - [46] = { "Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT", 0 }, - [47] = { "Apalis iMX8 QuadMax 4GB IT", TARGET_IS_ENABLED(APALIS_IMX8) }, - [48] = { "Apalis iMX8 QuadPlus 2GB Wi-Fi / BT", TARGET_IS_ENABLED(APALIS_IMX8) }, - [49] = { "Apalis iMX8 QuadPlus 2GB", TARGET_IS_ENABLED(APALIS_IMX8) }, - [50] = { "Colibri iMX8 QuadXPlus 2GB IT", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, - [51] = { "Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, - [52] = { "Colibri iMX8 DualX 1GB", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, - [53] = { "Apalis iMX8 QuadXPlus 2GB ECC IT", 0 }, - [54] = { "Apalis iMX8 DualXPlus 1GB", TARGET_IS_ENABLED(APALIS_IMX8) }, - [55] = { "Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, - [56] = { "Verdin iMX8M Nano Quad 1GB Wi-Fi / BT", 0 }, - [57] = { "Verdin iMX8M Mini DualLite 1GB", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, - [58] = { "Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, - [59] = { "Verdin iMX8M Mini Quad 2GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, - [60] = { "Verdin iMX8M Mini DualLite 1GB WB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, - [61] = { "Verdin iMX8M Plus Quad 2GB", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, - [62] = { "Colibri iMX6ULL 1GB IT (eMMC)", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, - [63] = { "Verdin iMX8M Plus Quad 4GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, - [64] = { "Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, - [65] = { "Verdin iMX8M Plus QuadLite 1GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, - [66] = { "Verdin iMX8M Plus Quad 8GB Wi-Fi / BT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, - [67] = { "Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT", TARGET_IS_ENABLED(APALIS_IMX8) }, - [68] = { "Verdin iMX8M Mini Quad 2GB WB IT No CAN", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [0] = { "UNKNOWN MODULE", 0 }, + [1] = { "Colibri PXA270 312MHz", 0 }, + [2] = { "Colibri PXA270 520MHz", 0 }, + [3] = { "Colibri PXA320 806MHz", 0 }, + [4] = { "Colibri PXA300 208MHz", 0 }, + [5] = { "Colibri PXA310 624MHz", 0 }, + [6] = { "Colibri PXA320IT 806MHz", 0 }, + [7] = { "Colibri PXA300 208MHz XT", 0 }, + [8] = { "Colibri PXA270 312MHz", 0 }, + [9] = { "Colibri PXA270 520MHz", 0 }, + [10] = { "Colibri VF50 128MB", TARGET_IS_ENABLED(COLIBRI_VF) }, + [11] = { "Colibri VF61 256MB", TARGET_IS_ENABLED(COLIBRI_VF) }, + [12] = { "Colibri VF61 256MB IT", TARGET_IS_ENABLED(COLIBRI_VF) }, + [13] = { "Colibri VF50 128MB IT", TARGET_IS_ENABLED(COLIBRI_VF) }, + [14] = { "Colibri iMX6S 256MB", TARGET_IS_ENABLED(COLIBRI_IMX6) }, + [15] = { "Colibri iMX6DL 512MB", TARGET_IS_ENABLED(COLIBRI_IMX6) }, + [16] = { "Colibri iMX6S 256MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6) }, + [17] = { "Colibri iMX6DL 512MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6) }, + [18] = { "UNKNOWN MODULE", 0 }, + [19] = { "UNKNOWN MODULE", 0 }, + [20] = { "Colibri T20 256MB", TARGET_IS_ENABLED(COLIBRI_T20) }, + [21] = { "Colibri T20 512MB", TARGET_IS_ENABLED(COLIBRI_T20) }, + [22] = { "Colibri T20 512MB IT", TARGET_IS_ENABLED(COLIBRI_T20) }, + [23] = { "Colibri T30 1GB", TARGET_IS_ENABLED(COLIBRI_T30) }, + [24] = { "Colibri T20 256MB IT", TARGET_IS_ENABLED(COLIBRI_T20) }, + [25] = { "Apalis T30 2GB", TARGET_IS_ENABLED(APALIS_T30) }, + [26] = { "Apalis T30 1GB", TARGET_IS_ENABLED(APALIS_T30) }, + [27] = { "Apalis iMX6Q 1GB", TARGET_IS_ENABLED(APALIS_IMX6) }, + [28] = { "Apalis iMX6Q 2GB IT", TARGET_IS_ENABLED(APALIS_IMX6) }, + [29] = { "Apalis iMX6D 512MB", TARGET_IS_ENABLED(APALIS_IMX6) }, + [30] = { "Colibri T30 1GB IT", TARGET_IS_ENABLED(COLIBRI_T30) }, + [31] = { "Apalis T30 1GB IT", TARGET_IS_ENABLED(APALIS_T30) }, + [32] = { "Colibri iMX7S 256MB", TARGET_IS_ENABLED(COLIBRI_IMX7) }, + [33] = { "Colibri iMX7D 512MB", TARGET_IS_ENABLED(COLIBRI_IMX7) }, + [34] = { "Apalis TK1 2GB", TARGET_IS_ENABLED(APALIS_TK1) }, + [35] = { "Apalis iMX6D 1GB IT", TARGET_IS_ENABLED(APALIS_IMX6) }, + [36] = { "Colibri iMX6ULL 256MB", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [37] = { "Apalis iMX8QM 4GB WB IT", TARGET_IS_ENABLED(APALIS_IMX8) }, + [38] = { "Colibri iMX8QXP 2GB WB IT", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, + [39] = { "Colibri iMX7D 1GB", TARGET_IS_ENABLED(COLIBRI_IMX7) }, + [40] = { "Colibri iMX6ULL 512MB WB IT", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [41] = { "Colibri iMX7D 512MB EPDC", TARGET_IS_ENABLED(COLIBRI_IMX7) }, + [42] = { "Apalis TK1 4GB", TARGET_IS_ENABLED(APALIS_TK1) }, + [43] = { "Colibri T20 512MB IT SETEK", TARGET_IS_ENABLED(COLIBRI_T20) }, + [44] = { "Colibri iMX6ULL 512MB IT", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [45] = { "Colibri iMX6ULL 512MB WB", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [46] = { "Apalis iMX8QXP 2GB WB IT", 0 }, + [47] = { "Apalis iMX8QM 4GB IT", TARGET_IS_ENABLED(APALIS_IMX8) }, + [48] = { "Apalis iMX8QP 2GB WB", TARGET_IS_ENABLED(APALIS_IMX8) }, + [49] = { "Apalis iMX8QP 2GB", TARGET_IS_ENABLED(APALIS_IMX8) }, + [50] = { "Colibri iMX8QXP 2GB IT", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, + [51] = { "Colibri iMX8DX 1GB WB", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, + [52] = { "Colibri iMX8DX 1GB", TARGET_IS_ENABLED(COLIBRI_IMX8X) }, + [53] = { "Apalis iMX8QXP 2GB ECC IT", 0 }, + [54] = { "Apalis iMX8DXP 1GB", TARGET_IS_ENABLED(APALIS_IMX8) }, + [55] = { "Verdin iMX8M Mini Quad 2GB WB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [56] = { "Verdin iMX8M Nano Quad 1GB WB", 0 }, + [57] = { "Verdin iMX8M Mini DualLite 1GB", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [58] = { "Verdin iMX8M Plus Quad 4GB WB IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [59] = { "Verdin iMX8M Mini Quad 2GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [60] = { "Verdin iMX8M Mini DualLite 1GB WB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, + [61] = { "Verdin iMX8M Plus Quad 2GB", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [62] = { "Colibri iMX6ULL 1GB IT", TARGET_IS_ENABLED(COLIBRI_IMX6ULL) }, + [63] = { "Verdin iMX8M Plus Quad 4GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [64] = { "Verdin iMX8M Plus Quad 2GB WB IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [65] = { "Verdin iMX8M Plus QuadLite 1GB IT", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [66] = { "Verdin iMX8M Plus Quad 8GB WB", TARGET_IS_ENABLED(VERDIN_IMX8MP) }, + [67] = { "Apalis iMX8QM 8GB WB IT", TARGET_IS_ENABLED(APALIS_IMX8) }, + [68] = { "Verdin iMX8M Mini Quad 2GB WB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, };
const char * const toradex_carrier_boards[] = {

Add product id print in show_board_info(), with an increasing number of Toradex SKUs available with small differences it makes sense to print it.
Move serial number print to a dedicated line, this prevents the previous line with the product name to overflow the 80 columns with any reasonable product name length.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com --- board/toradex/common/tdx-common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c index 2284fcddb510..fadbe455419c 100644 --- a/board/toradex/common/tdx-common.c +++ b/board/toradex/common/tdx-common.c @@ -115,10 +115,11 @@ int show_board_info(void)
env_set("serial#", tdx_serial_str);
- printf("Model: Toradex %s %s, Serial# %s\n", + printf("Model: Toradex %04d %s %s\n", + tdx_hw_tag.prodid, toradex_modules[tdx_hw_tag.prodid].name, - tdx_board_rev_str, - tdx_serial_str); + tdx_board_rev_str); + printf("Serial#: %s\n", tdx_serial_str); #ifdef CONFIG_TDX_CFG_BLOCK_EXTRA if (read_tdx_cfg_block_carrier()) { printf("MISSING TORADEX CARRIER CONFIG BLOCKS\n");

On Thu, 2022-07-21 at 15:17 +0200, Francesco Dolcini wrote:
Hi all, this series introduces some cleanup in the board/toradex common code, mainly around the config block handling and related informations.
The main change is a major rework of the interactive block creation function (used to re-create production data information, e.g. serial# and SKU number) to select the product ID from a short list instead of a long y/n question/answer list that was deciding the exact product ID depending on the answer. This code was getting too complex and not possible to maintain anymore.
This change is build on top of `toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku` from Philippe that is not yet applied to u-boot/master, for simplicity it is now integrated into this series.
All the other changes are small cleanups on the board info prints (product id is now printed), the product names are now the official Toradex products names and a couple of other trivial improvements I did while working on this.
Francesco Dolcini (7): toradex: common: Remove stale comments about modules availability toradex: common: Use ARRAY_SIZE macro toradex: tdx-cfg-block: Cleanup interactive cfg block creation toradex: common: Remove stale function declaration toradex: common: Remove #ifdef usage for 2nd ethaddr toradex: tdx-cfg-block: Use official SKU names toradex: common: Improve product/serial print during boot
Philippe Schenker (1): toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku
Entire series:
Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
board/toradex/common/tdx-cfg-block.c | 350 +++++--------------- board/toradex/common/tdx-cfg-block.h | 12 +- board/toradex/common/tdx-common.c | 14 +- board/toradex/common/tdx-common.h | 4 - board/toradex/verdin-imx8mm/verdin-imx8mm.c | 3 +- 5 files changed, 105 insertions(+), 278 deletions(-)

Hello Tom, this series is supposed to go through you or someone else? Merge window is supposed to close today, there is no rush, but would be great to have this in v2022.10.
Francesco
On Fri, Jul 22, 2022 at 10:35:23AM +0200, Marcel Ziswiler wrote:
On Thu, 2022-07-21 at 15:17 +0200, Francesco Dolcini wrote:
Hi all, this series introduces some cleanup in the board/toradex common code, mainly around the config block handling and related informations.
The main change is a major rework of the interactive block creation function (used to re-create production data information, e.g. serial# and SKU number) to select the product ID from a short list instead of a long y/n question/answer list that was deciding the exact product ID depending on the answer. This code was getting too complex and not possible to maintain anymore.
This change is build on top of `toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku` from Philippe that is not yet applied to u-boot/master, for simplicity it is now integrated into this series.
All the other changes are small cleanups on the board info prints (product id is now printed), the product names are now the official Toradex products names and a couple of other trivial improvements I did while working on this.
Francesco Dolcini (7): toradex: common: Remove stale comments about modules availability toradex: common: Use ARRAY_SIZE macro toradex: tdx-cfg-block: Cleanup interactive cfg block creation toradex: common: Remove stale function declaration toradex: common: Remove #ifdef usage for 2nd ethaddr toradex: tdx-cfg-block: Use official SKU names toradex: common: Improve product/serial print during boot
Philippe Schenker (1): toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku
Entire series:
Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com

On Mon, Jul 25, 2022 at 01:25:04PM +0200, Francesco Dolcini wrote:
Hello Tom, this series is supposed to go through you or someone else? Merge window is supposed to close today, there is no rush, but would be great to have this in v2022.10.
I think I had assigned this to myself to start with, but it looks like Stefano is reviewing it now, which also works for me. I do expect this to come in for v2022.10 one way or another.
Francesco
On Fri, Jul 22, 2022 at 10:35:23AM +0200, Marcel Ziswiler wrote:
On Thu, 2022-07-21 at 15:17 +0200, Francesco Dolcini wrote:
Hi all, this series introduces some cleanup in the board/toradex common code, mainly around the config block handling and related informations.
The main change is a major rework of the interactive block creation function (used to re-create production data information, e.g. serial# and SKU number) to select the product ID from a short list instead of a long y/n question/answer list that was deciding the exact product ID depending on the answer. This code was getting too complex and not possible to maintain anymore.
This change is build on top of `toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku` from Philippe that is not yet applied to u-boot/master, for simplicity it is now integrated into this series.
All the other changes are small cleanups on the board info prints (product id is now printed), the product names are now the official Toradex products names and a couple of other trivial improvements I did while working on this.
Francesco Dolcini (7): toradex: common: Remove stale comments about modules availability toradex: common: Use ARRAY_SIZE macro toradex: tdx-cfg-block: Cleanup interactive cfg block creation toradex: common: Remove stale function declaration toradex: common: Remove #ifdef usage for 2nd ethaddr toradex: tdx-cfg-block: Use official SKU names toradex: common: Improve product/serial print during boot
Philippe Schenker (1): toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku
Entire series:
Acked-by: Marcel Ziswiler marcel.ziswiler@toradex.com
participants (3)
-
Francesco Dolcini
-
Marcel Ziswiler
-
Tom Rini