toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
index 94e603c..5ad5d00 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -24,7 +24,7 @@
 
 #define SERIAL_STR_LEN 8
 #define MODULE_VER_STR_LEN 4 // V1.1
-#define MODULE_REV_STR_LEN 1 // [A-Z]
+#define MODULE_REV_STR_LEN 3 // [A-Z] or #[26-99]
 
 #ifdef CONFIG_TDX_CFG_BLOCK
 static char tdx_serial_str[SERIAL_STR_LEN + 1];
@@ -83,6 +83,21 @@
 }
 #endif /* CONFIG_SERIAL_TAG */
 
+static const char *get_board_assembly(u16 ver_assembly)
+{
+	static char ver_name[MODULE_REV_STR_LEN + 1];
+
+	if (ver_assembly < 26) {
+		ver_name[0] = (char)ver_assembly + 'A';
+		ver_name[1] = '\0';
+	} else {
+		snprintf(ver_name, sizeof(ver_name),
+			 "#%u", ver_assembly);
+	}
+
+	return ver_name;
+}
+
 int show_board_info(void)
 {
 	unsigned char ethaddr[6];
@@ -96,10 +111,10 @@
 		snprintf(tdx_serial_str, sizeof(tdx_serial_str),
 			 "%08u", tdx_serial);
 		snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
-			 "V%1d.%1d%c",
+			 "V%1d.%1d%s",
 			 tdx_hw_tag.ver_major,
 			 tdx_hw_tag.ver_minor,
-			 (char)tdx_hw_tag.ver_assembly + 'A');
+			 get_board_assembly(tdx_hw_tag.ver_assembly));
 
 		env_set("serial#", tdx_serial_str);
 
@@ -118,10 +133,10 @@
 			snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str),
 				 "%08u", tdx_car_serial);
 			snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str),
-				 "V%1d.%1d%c",
+				 "V%1d.%1d%s",
 				 tdx_car_hw_tag.ver_major,
 				 tdx_car_hw_tag.ver_minor,
-				 (char)tdx_car_hw_tag.ver_assembly + 'A');
+				 get_board_assembly(tdx_car_hw_tag.ver_assembly));
 
 			env_set("carrier_serial#", tdx_car_serial_str);
 			printf("Carrier: Toradex %s %s, Serial# %s\n",