Skip to content

Commit

Permalink
toradex: configblock: fix module revision in config block
Browse files Browse the repository at this point in the history
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 all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <[email protected]>
Reviewed-by: Oleksandr Suvorov <[email protected]>
  • Loading branch information
denisdrozdov authored and trini committed Apr 20, 2021
1 parent 1aa2a74 commit fd90aca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion board/toradex/common/tdx-cfg-block.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,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;
Expand All @@ -564,7 +566,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);
Expand Down

0 comments on commit fd90aca

Please sign in to comment.