All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] toradex: configblock: fix module revision in config block
@ 2021-04-07 12:28 denys.drozdov at toradex.com
  2021-04-07 14:28 ` Oleksandr Suvorov
  2021-04-20 14:21 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: denys.drozdov at toradex.com @ 2021-04-07 12:28 UTC (permalink / raw)
  To: u-boot

From: Denys Drozdov <denys.drozdov@toradex.com>

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 <denys.drozdov@toradex.com>
---
 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 adab0a0802..9be58d538b 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -555,6 +555,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;
@@ -563,7 +565,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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] toradex: configblock: fix module revision in config block
  2021-04-07 12:28 [PATCH] toradex: configblock: fix module revision in config block denys.drozdov at toradex.com
@ 2021-04-07 14:28 ` Oleksandr Suvorov
  2021-04-20 14:21 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Oleksandr Suvorov @ 2021-04-07 14:28 UTC (permalink / raw)
  To: u-boot

On Wed, Apr 7, 2021 at 3:31 PM <denys.drozdov@toradex.com> wrote:
>
> From: Denys Drozdov <denys.drozdov@toradex.com>
>
> 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 <denys.drozdov@toradex.com>

Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

> ---
>  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 adab0a0802..9be58d538b 100644
> --- a/board/toradex/common/tdx-cfg-block.c
> +++ b/board/toradex/common/tdx-cfg-block.c
> @@ -555,6 +555,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;
> @@ -563,7 +565,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);
> --
> 2.17.1
>


-- 
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] toradex: configblock: fix module revision in config block
  2021-04-07 12:28 [PATCH] toradex: configblock: fix module revision in config block denys.drozdov at toradex.com
  2021-04-07 14:28 ` Oleksandr Suvorov
@ 2021-04-20 14:21 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-04-20 14:21 UTC (permalink / raw)
  To: u-boot

On Wed, Apr 07, 2021 at 03:28:24PM +0300, denys.drozdov at toradex.com wrote:

> From: Denys Drozdov <denys.drozdov@toradex.com>
> 
> 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 <denys.drozdov@toradex.com>
> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210420/5bb49de7/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-20 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 12:28 [PATCH] toradex: configblock: fix module revision in config block denys.drozdov at toradex.com
2021-04-07 14:28 ` Oleksandr Suvorov
2021-04-20 14:21 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.