Message ID | 20200212183744.5309-8-patrick.delaunay@st.com |
---|---|
State | New |
Headers | show |
Series | stm32mp1: board and SOC identifications | expand |
On 2/12/20 7:37 PM, Patrick Delaunay wrote: > Update the command stboard to support the coding of OTP 59 with > finished good: > > bit [31:16] (hex) => 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 command is: > stboard [-y] <Board> <VarCPN> <Revision> <VarFG> <BOM> > > Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com> > --- > > board/st/common/cmd_stboard.c | 31 ++++++++++++++++++++----------- > board/st/stm32mp1/stm32mp1.c | 3 ++- > 2 files changed, 22 insertions(+), 12 deletions(-) > > diff --git a/board/st/common/cmd_stboard.c b/board/st/common/cmd_stboard.c > index 1573e35410..3ead1edecd 100644 > --- a/board/st/common/cmd_stboard.c > +++ b/board/st/common/cmd_stboard.c > @@ -31,9 +31,10 @@ static bool check_stboard(u16 board) > > static void display_stboard(u32 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); > } > @@ -44,14 +45,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 +96,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 +108,20 @@ 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; > + 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 +161,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 > diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c > index e82a43074f..76399e2d62 100644 > --- a/board/st/stm32mp1/stm32mp1.c > +++ b/board/st/stm32mp1/stm32mp1.c > @@ -109,9 +109,10 @@ int checkboard(void) > 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); > } Acked-by: Patrice Chotard <patrice.chotard at st.com> Thanks Patrice
Dear Patrick, In message <20200212183744.5309-8-patrick.delaunay at st.com> you wrote: > Update the command stboard to support the coding of OTP 59 with > finished good: Can you please explain what "finished good" means? I can't parse the sentence above, sorry. Best regards, Wolfgang Denk
Hi Wolfgang, > From: Wolfgang Denk <wd at denx.de> > Sent: mercredi 18 mars 2020 11:45 > > Dear Patrick, > > In message <20200212183744.5309-8-patrick.delaunay at st.com> you wrote: > > Update the command stboard to support the coding of OTP 59 with > > finished good: > > Can you please explain what "finished good" means? > > I can't parse the sentence above, sorry. It is a part of the codification used in production of ST board, sorry if it is not clear. The ST product codification have several element - "Commercial Product Name" (CPN) : type of product board (DKX, EVX) - "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. During production, this information is also save in OTP. And the stm32mp1 software can change its behavior based on this information. The FG information is introduced because on DK2 board (same product / same CPN) , we have a risk to manage 2 types of display in future production batch (no more availability of the current LCD => new FG for the same product with new display) > Best regards, > > Wolfgang Denk > Regards Patrick
Dear Patrick, In message <07159b22a76a445089aa6cd646c0ef1c at SFHDAG6NODE3.st.com> you wrote: > > > I can't parse the sentence above, sorry. > > It is a part of the codification used in production of ST board, sorry if it is not clear. I see. Please add suich explanation to the commit message and maybe even comment in the code. Best regards, Wolfgang Denk
Hi Wolfgang, > From: Wolfgang Denk <wd at denx.de> > Sent: jeudi 19 mars 2020 10:14 > > Dear Patrick, > > In message <07159b22a76a445089aa6cd646c0ef1c at SFHDAG6NODE3.st.com> > you wrote: > > > > > I can't parse the sentence above, sorry. > > > > It is a part of the codification used in production of ST board, sorry if it is not > clear. > > I see. > > Please add suich explanation to the commit message and maybe even comment > in the code. Sure, I will add explanation in commit message and in "cmd_stboard.c" file header. > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de > Everyone, in some small sacred sanctuary of the self, is nuts. > - Leo Rosten
diff --git a/board/st/common/cmd_stboard.c b/board/st/common/cmd_stboard.c index 1573e35410..3ead1edecd 100644 --- a/board/st/common/cmd_stboard.c +++ b/board/st/common/cmd_stboard.c @@ -31,9 +31,10 @@ static bool check_stboard(u16 board) static void display_stboard(u32 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); } @@ -44,14 +45,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 +96,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 +108,20 @@ 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; + 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 +161,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 diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index e82a43074f..76399e2d62 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -109,9 +109,10 @@ int checkboard(void) 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); }
Update the command stboard to support the coding of OTP 59 with finished good: bit [31:16] (hex) => 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 command is: stboard [-y] <Board> <VarCPN> <Revision> <VarFG> <BOM> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com> --- board/st/common/cmd_stboard.c | 31 ++++++++++++++++++++----------- board/st/stm32mp1/stm32mp1.c | 3 ++- 2 files changed, 22 insertions(+), 12 deletions(-)