From: Franz Schnyder <[email protected]> The sysinfo currently uses the Toradex product ID table to print a detailed board model string. With various new SoMs that are released by Toradex, the PID table grows and needs maintenance effort which can be avoided.
Rather than printing the board model based on the PID table, rely on the model property of the device tree and the data written to the config block during manufacturing, which already describes the HW correctly. For example, the printed board model string will change from: Model: Toradex 0075 Verdin AM62 Dual 1GB WB IT V1.2A Serial#: 15412798 and become: Model: Toradex Verdin AM62 WB on Verdin Development Board Toradex SoM: 0075 V1.2A (00751200) Serial#: 15412798 This removes detailed SKU information such as the number of cores, memory size, WB capability and temperature rating, but the PID4, PID8 and revision of the SoM are still printed. The detailed information of the SoM can still be looked up using the printed information on the official Toradex website. Decouple board sysinfo from the Toradex product ID table, making the 0243 Aquila iMX95 the last entry being made to it. Link: https://www.toradex.com/computer-on-modules Signed-off-by: Franz Schnyder <[email protected]> --- board/toradex/common/tdx-common.c | 53 +++++++++++++++++++++++++++++---------- board/toradex/common/tdx-common.h | 7 ++++++ 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c index 81f7fa09002..2a8589f5e41 100644 --- a/board/toradex/common/tdx-common.c +++ b/board/toradex/common/tdx-common.c @@ -104,8 +104,25 @@ __weak int print_bootinfo(void) int checkboard(void) { - if (valid_cfgblock) - printf("Serial#: %s\n", tdx_serial_str); + struct udevice *sysinfo; + int ret; + + if (valid_cfgblock) { + char str[96], str2[96]; + + ret = sysinfo_get_and_detect(&sysinfo); + if (ret) { + log_debug("Failed to get sysinfo data: %d\n", ret); + return ret; + } + + if (!sysinfo_get_str(sysinfo, SYSID_TDX_PID8, sizeof(str), str) && + !sysinfo_get_str(sysinfo, SYSID_TDX_BOARD_REV, sizeof(str2), str2)) + printf("Toradex SoM: %s (%s)\n", str2, str); + + if (!sysinfo_get_str(sysinfo, SYSID_TDX_SERIAL, sizeof(str), str)) + printf("Serial#: %s\n", str); + } #ifdef CONFIG_TDX_CFG_BLOCK_EXTRA if (tdx_carrier_board_name) @@ -202,23 +219,33 @@ static int tdx_detect(struct udevice *dev) static int tdx_get_str(struct udevice *dev, int id, size_t size, char *val) { - int ret = -ENOTSUPP; - int idx; - switch (id) { case SYSID_BOARD_MODEL: - idx = get_toradex_modules_idx(tdx_hw_tag.prodid); + const char *model; - snprintf(val, size, - "Toradex %04d %s %s", - tdx_hw_tag.prodid, - toradex_modules[idx].name, - tdx_board_rev_str); + model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); + if (!model) + return -ENODATA; - ret = 0; + strlcpy(val, model, size); + return 0; + + case SYSID_TDX_BOARD_REV: + snprintf(val, size, "%04d %s", tdx_hw_tag.prodid, tdx_board_rev_str); + return 0; + + case SYSID_TDX_PID8: + snprintf(val, size, "%04d%0d%0d%02d", tdx_hw_tag.prodid, + tdx_hw_tag.ver_major, tdx_hw_tag.ver_minor, + tdx_hw_tag.ver_assembly); + return 0; + + case SYSID_TDX_SERIAL: + strlcpy(val, tdx_serial_str, size); + return 0; } - return ret; + return -EOPNOTSUPP; } static const struct udevice_id sysinfo_tdx_ids[] = { diff --git a/board/toradex/common/tdx-common.h b/board/toradex/common/tdx-common.h index db3369a8f9e..7fb1cc8ecc8 100644 --- a/board/toradex/common/tdx-common.h +++ b/board/toradex/common/tdx-common.h @@ -7,6 +7,7 @@ #define _TDX_COMMON_H #include <asm-generic/u-boot.h> +#include <sysinfo.h> #define TORADEX_USB_PRODUCT_NUM_OFFSET 0x4000 #define TDX_USB_VID 0x1B67 @@ -14,4 +15,10 @@ int ft_common_board_setup(void *blob, struct bd_info *bd); u32 get_board_revision(void); +enum { + SYSID_TDX_BOARD_REV = SYSID_USER, + SYSID_TDX_PID8, + SYSID_TDX_SERIAL, +}; + #endif /* _TDX_COMMON_H */ -- 2.43.0
