From: Francesco Dolcini Date: Thu, 21 Jul 2022 13:17:34 +0000 (+0200) Subject: toradex: tdx-cfg-block: Cleanup interactive cfg block creation X-Git-Url: http://git.dujemihanovic.xyz/html/static/%7B%7B%20.Permalink%20%7D%7D?a=commitdiff_plain;h=8b6dc5d3943c269892acb2a426ad4a46a7f7fc49;p=u-boot.git toradex: tdx-cfg-block: Cleanup interactive cfg block creation 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 --- diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 26596199a3..b7c7301af8 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -11,17 +11,6 @@ #include #include -#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 -#else -#define is_cpu_type(cpu) (0) -#endif #include #include #include @@ -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 028e6b1273..32e4c6f687 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 3798bf9537..3643ebbb16 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