From 6100a36a0e13ff82add19110067cc2d7ded5eaef Mon Sep 17 00:00:00 2001 From: Denys Drozdov Date: Thu, 1 Apr 2021 19:56:40 +0300 Subject: toradex: configblock: fix module revision in config block U-boot might display wrong module revision information for modules with an assembly version 'K'. "cfgblock create" does not takes into account all revision digits from PID8. This fix takes into account 6th,7th digits of PID8 to store module revision. Related-to: ELB-3893 Signed-off-by: Denys Drozdov (cherry picked from commit 76fd4496a40b9dd7271ceb9ff330982c954fe8e9) --- board/toradex/common/tdx-cfg-block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 9e5fe95982..6059213615 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -578,6 +578,8 @@ static int get_cfgblock_interactive(void) static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag, u32 *serial) { + char revision[3] = {barcode[6], barcode[7], '\0'}; + if (strlen(barcode) < 16) { printf("Argument too short, barcode is 16 chars long\n"); return -1; @@ -586,7 +588,7 @@ static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag, /* Get hardware information from the first 8 digits */ tag->ver_major = barcode[4] - '0'; tag->ver_minor = barcode[5] - '0'; - tag->ver_assembly = barcode[7] - '0'; + tag->ver_assembly = simple_strtoul(revision, NULL, 10); barcode[4] = '\0'; tag->prodid = simple_strtoul(barcode, NULL, 10); -- cgit v1.2.3