board: stm32mp1: add finished good in board identifier OTP
PATCH v2 1/1 board: stm32mp1: add finished good in board identifier OTP
Update the command stboard to support the updated coding of OTP 59 with finished good.
The ST product codification have several element
- "Commercial Product Name" (CPN): type of product board (DKX, EVX) associated to the board ID "MBxxxx"
- "Finished Good" or "Finish Good" (FG):
effective content of the product without chip STM32MP1 (LCD, Wifi, ?)
- BOM: cost variant for same FG
(for example, several provider of the same component)
For example
- commercial product = STM32MP157C-EV1
- Finished Good = EVA32MP157A1$AU1
Booth information are written on board and this information is also saved in OTP59:
bit [31:16] (hex) => Board id, MBxxxx
bit [15:12] (dec) => Variant CPN (1....15)
bit [11:8] (dec) => Revision board (index with A = 1, Z = 26) bit [7:4] (dec) => Variant FG : finished good (NEW) bit [3:0] (dec) => BOM (01, .... 255)
The updated command is:
stboard [-y] <Board> <VarCPN> <Revision> <VarFG> <BOM>
And the displayed STMicroelectronics board identification is:
Board: MB<Board> Var<VarCPN>.<VarFG> Rev.<Revision>-<BOM>
---
Changes in v2:
- update commit message
- add comments in cmd_stboard.c
board/st/common/cmd_stboard.c | 60 ++++++++++++++++++++++++++++------- board/st/stm32mp1/stm32mp1.c | 4 ++- 2 files changed, 52 insertions(+), 12 deletions(-)
board/st/common/cmd_stboard.c +49 -11
@@ -1,6 +1,32 @@// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause /* * Copyright (C) 2019, STMicroelectronics - All Rights Reserved +* +* the st command stboard supports the STMicroelectronics board identification +* saved in OTP 59. +* +* The ST product codification have several element +* - "Commercial Product Name" (CPN): type of product board (DKX, EVX) +* associated to the board ID "MBxxxx" +* - "Finished Good" or "Finish Good" (FG): +* effective content of the product without chip STM32MP1xx (LCD, Wifi,?) +* - BOM: cost variant for same FG (for example, several provider of the same +* component) +* +* For example +* - commercial product = STM32MP157C-EV1 for board MB1263 +* - Finished Good = EVA32MP157A1$AU1 +* +* Booth information are written on board and this information is also saved +* in OTP59, with: +* bit [31:16] (hex) => Board id, MBxxxx +* bit [15:12] (dec) => Variant CPN (1....15) +* bit [11:8] (dec) => Revision board (index with A = 1, Z = 26) +* bit [7:4] (dec) => Variant FG : finished good index +* bit [3:0] (dec) => BOM (01, .... 255) +* +* and displayed with the format: +* Board: MB<Board> Var<VarCPN>.<VarFG> Rev.<Revision>-<BOM> */ #ifndef CONFIG_SPL_BUILD
@@ -13,6 +39,7 @@static bool check_stboard (u16 board) {unsigned int i; +/* list of supported ST boards */ const u16 st_board_id[] = {0x1272 ,0x1263 ,
@@ -31,9 +58,11 @@ static bool check_stboard(u16 board)static void display_stboard (u32 otp) { -printf ("Board: MB%04x Var%d Rev.%c-%02d\n" , +/* display board indentification with OPT coding */ +printf ("Board: MB%04x Var%d.%d Rev.%c-%02d\n" , otp >>16 , (otp >>12 ) &0xF , + (otp >>4 ) &0xF , ((otp >>8 ) &0xF ) -1 +'A' , otp &0xF ); }
@@ -44,14 +73,14 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,int ret;u32 otp, lock;u8 revision; -unsigned long board, variant, bom; +unsigned long board, var_cpn, var_fg, bom;struct udevice *dev; -int confirmed = argc ==6 && !strcmp (argv[1 ],"-y" ); +int confirmed = argc ==7 && !strcmp (argv[1 ],"-y" ); argc -=1 + confirmed; argv +=1 + confirmed; -if (argc !=0 && argc !=4 ) +if (argc !=0 && argc !=5 )return CMD_RET_USAGE ; ret = uclass_get_device_by_driver(UCLASS_MISC,
@@ -95,8 +124,8 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,return CMD_RET_USAGE ; } -if (strict_strtoul (argv[1 ],10 , &variant) <0 || - variant ==0 || variant >15 ) { +if (strict_strtoul (argv[1 ],10 , &var_cpn) <0 || + var_cpn ==0 || var_cpn >15 ) {printf ("argument %d invalid: %s\n" ,2 , argv[1 ]);return CMD_RET_USAGE ; }
@@ -107,13 +136,21 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,return CMD_RET_USAGE ; } -if (strict_strtoul (argv[3 ],10 , &bom) <0 || +if (strict_strtoul (argv[3 ],10 , &var_fg) <0 || + var_fg >15 ) { +printf ("argument %d invalid: %s\n" ,4 , argv[3 ]); +return CMD_RET_USAGE ; + } + +if (strict_strtoul (argv[4 ],10 , &bom) <0 || bom ==0 || bom >15 ) {printf ("argument %d invalid: %s\n" ,4 , argv[3 ]);return CMD_RET_USAGE ; } - otp = (board <<16 ) | (variant <<12 ) | (revision <<8 ) | bom; +/* st board indentification value */ + otp = (board <<16 ) | (var_cpn <<12 ) | (revision <<8 ) | + (var_fg <<4 ) | bom;display_stboard (otp);printf ("=> OTP[%d] = %08X\n" ,BSEC_OTP_BOARD , otp);
@@ -153,15 +190,16 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } -U_BOOT_CMD (stboard,6 ,0 , do_stboard, +U_BOOT_CMD (stboard,7 ,0 , do_stboard,"read/write board reference in OTP" ,"\n" " Print current board information\n" -"stboard [-y] <Board> <Variant> <Revision> <BOM>\n" +"stboard [-y] <Board> <VarCPN> <Revision> <VarFG> <BOM>\n" " Write board information\n" " - Board: xxxx, example 1264 for MB1264\n" -" - Variant: 1 ... 15\n" +" - VarCPN: 1...15\n" " - Revision: A...O\n" +" - VarFG: 0...15\n" " - BOM: 1...15\n" );#endif
board/st/stm32mp1/stm32mp1.c +3 -1
@@ -108,13 +108,15 @@ int checkboard(void)DM_GET_DRIVER (stm32mp_bsec), &dev); +/* display the STMicroelectronics board identification */ if (!ret) ret =misc_read (dev,STM32_BSEC_SHADOW (BSEC_OTP_BOARD ), &otp,sizeof (otp));if (ret >0 && otp) { -printf ("Board: MB%04x Var%d Rev.%c-%02d\n" , +printf ("Board: MB%04x Var%d.%d Rev.%c-%02d\n" , otp >>16 , (otp >>12 ) &0xF , + (otp >>4 ) &0xF , ((otp >>8 ) &0xF ) -1 +'A' , otp &0xF ); }
Signature · 1 line
2.17.1
PATCH v2 1/1 board: stm32mp1: add finished good in board identifier OTP
Hi Patrick
Quoted 11 lines · Patrick Delaunay
Update the command stboard to support the updated coding of OTP 59 with finished good.
The ST product codification have several element
- "Commercial Product Name" (CPN): type of product board (DKX, EVX) associated to the board ID "MBxxxx"
- "Finished Good" or "Finish Good" (FG):
effective content of the product without chip STM32MP1 (LCD, Wifi, ?)
- BOM: cost variant for same FG
(for example, several provider of the same component)
Quoted 6 lines
For example
- commercial product = STM32MP157C-EV1
- Finished Good = EVA32MP157A1$AU1Booth information are written on board and this information is also saved in OTP59:
s/Booth/Both
s/this information is/these information are
Quoted 167 lines
bit [31:16] (hex) => Board id, MBxxxx
bit [15:12] (dec) => Variant CPN (1....15)bit [11:8] (dec) => Revision board (index with A = 1, Z = 26) bit [7:4] (dec) => Variant FG : finished good (NEW) bit [3:0] (dec) => BOM (01, .... 255)The updated command is:
stboard [-y] <Board> <VarCPN> <Revision> <VarFG> <BOM>And the displayed STMicroelectronics board identification is:
Board: MB<Board> Var<VarCPN>.<VarFG> Rev.<Revision>-<BOM>Signed-off-by Patrick Delaunay <[email protected]>---
Changes in v2:
- update commit message
- add comments incmd_stboard.cboard/st/common/cmd_stboard.c | 60 ++++++++++++++++++++++++++++------- board/st/stm32mp1/stm32mp1.c | 4 ++- 2 files changed, 52 insertions(+), 12 deletions(-)board/st/common/cmd_stboard.c +49
-11@@ -1,6 +1,32 @@// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause /* * Copyright (C) 2019, STMicroelectronics - All Rights Reserved +* +* the st command stboard supports the STMicroelectronics board identification +* saved in OTP 59. +* +* The ST product codification have several element +* - "Commercial Product Name" (CPN): type of product board (DKX, EVX) +* associated to the board ID "MBxxxx" +* - "Finished Good" or "Finish Good" (FG): +* effective content of the product without chip STM32MP1xx (LCD, Wifi,?) +* - BOM: cost variant for same FG (for example, several provider of the same +* component) +* +* For example +* - commercial product = STM32MP157C-EV1 for board MB1263 +* - Finished Good = EVA32MP157A1$AU1 +* +* Booth information are written on board and this information is also saved +* in OTP59, with: +* bit [31:16] (hex) => Board id, MBxxxx +* bit [15:12] (dec) => Variant CPN (1....15) +* bit [11:8] (dec) => Revision board (index with A = 1, Z = 26) +* bit [7:4] (dec) => Variant FG : finished good index +* bit [3:0] (dec) => BOM (01, .... 255) +* +* and displayed with the format: +* Board: MB<Board> Var<VarCPN>.<VarFG> Rev.<Revision>-<BOM> */ #ifndef CONFIG_SPL_BUILD @@ -13,6 +39,7 @@static bool check_stboard (u16 board) {unsigned int i; +/* list of supported ST boards */ const u16 st_board_id[] = {0x1272 ,0x1263 ,@@ -31,9 +58,11 @@ static bool check_stboard(u16 board)static void display_stboard (u32 otp) { -printf ("Board: MB%04x Var%d Rev.%c-%02d\n" , +/* display board indentification with OPT coding */ +printf ("Board: MB%04x Var%d.%d Rev.%c-%02d\n" , otp >>16 , (otp >>12 ) &0xF , + (otp >>4 ) &0xF , ((otp >>8 ) &0xF ) -1 +'A' , otp &0xF ); }@@ -44,14 +73,14 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,int ret;u32 otp, lock;u8 revision; -unsigned long board, variant, bom; +unsigned long board, var_cpn, var_fg, bom;struct udevice *dev; -int confirmed = argc ==6 && !strcmp (argv[1 ],"-y" ); +int confirmed = argc ==7 && !strcmp (argv[1 ],"-y" ); argc -=1 + confirmed; argv +=1 + confirmed; -if (argc !=0 && argc !=4 ) +if (argc !=0 && argc !=5 )return CMD_RET_USAGE ; ret = uclass_get_device_by_driver(UCLASS_MISC,@@ -95,8 +124,8 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,return CMD_RET_USAGE ; } -if (strict_strtoul (argv[1 ],10 , &variant) <0 || - variant ==0 || variant >15 ) { +if (strict_strtoul (argv[1 ],10 , &var_cpn) <0 || + var_cpn ==0 || var_cpn >15 ) {printf ("argument %d invalid: %s\n" ,2 , argv[1 ]);return CMD_RET_USAGE ; }@@ -107,13 +136,21 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,return CMD_RET_USAGE ; } -if (strict_strtoul (argv[3 ],10 , &bom) <0 || +if (strict_strtoul (argv[3 ],10 , &var_fg) <0 || + var_fg >15 ) { +printf ("argument %d invalid: %s\n" ,4 , argv[3 ]); +return CMD_RET_USAGE ; + } + +if (strict_strtoul (argv[4 ],10 , &bom) <0 || bom ==0 || bom >15 ) {printf ("argument %d invalid: %s\n" ,4 , argv[3 ]);return CMD_RET_USAGE ; } - otp = (board <<16 ) | (variant <<12 ) | (revision <<8 ) | bom; +/* st board indentification value */ + otp = (board <<16 ) | (var_cpn <<12 ) | (revision <<8 ) | + (var_fg <<4 ) | bom;display_stboard (otp);printf ("=> OTP[%d] = %08X\n" ,BSEC_OTP_BOARD , otp);@@ -153,15 +190,16 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } -U_BOOT_CMD (stboard,6 ,0 , do_stboard, +U_BOOT_CMD (stboard,7 ,0 , do_stboard,"read/write board reference in OTP" ,"\n" " Print current board information\n" -"stboard [-y] <Board> <Variant> <Revision> <BOM>\n" +"stboard [-y] <Board> <VarCPN> <Revision> <VarFG> <BOM>\n" " Write board information\n" " - Board: xxxx, example 1264 for MB1264\n" -" - Variant: 1 ... 15\n" +" - VarCPN: 1...15\n" " - Revision: A...O\n" +" - VarFG: 0...15\n" " - BOM: 1...15\n" );#endif board/st/stm32mp1/stm32mp1.c +1
-0@@ -108,13 +108,15 @@ int checkboard(void)DM_GET_DRIVER (stm32mp_bsec), &dev); +/* display the STMicroelectronics board identification */ if (!ret) ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
board/st/stm32mp1/stm32mp1.c int checkboard(void) · line 122
Quoted 10 lines
board/st/stm32mp1/stm32mp1.c +2
-1&otp, sizeof(otp));if (ret >0 && otp) { -printf ("Board: MB%04x Var%d Rev.%c-%02d\n" , +printf ("Board: MB%04x Var%d.%d Rev.%c-%02d\n" , otp >>16 , (otp >>12 ) &0xF , + (otp >>4 ) &0xF , ((otp >>8 ) &0xF ) -1 +'A' , otp &0xF ); }
Thanks
Patrice