All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH 07/10] board: stm32mp1: add finished good in board identifier OTP
Date: Wed, 12 Feb 2020 19:37:41 +0100	[thread overview]
Message-ID: <20200212183744.5309-8-patrick.delaunay@st.com> (raw)
In-Reply-To: <20200212183744.5309-1-patrick.delaunay@st.com>

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@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);
 	}
-- 
2.17.1

  parent reply	other threads:[~2020-02-12 18:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 18:37 [PATCH 00/10] stm32mp1: board and SOC identifications Patrick Delaunay
2020-02-12 18:37 ` [PATCH 01/10] board: stm32mp1: update command stboard on misc_write result Patrick Delaunay
2020-03-18 10:04   ` [Uboot-stm32] " Patrice CHOTARD
2020-03-24  8:32   ` Patrick DELAUNAY
2020-02-12 18:37 ` [PATCH 02/10] board: stm32mp1: read OTP in command stboard Patrick Delaunay
2020-03-18 10:05   ` [Uboot-stm32] " Patrice CHOTARD
2020-03-24  8:33   ` Patrick DELAUNAY
2020-02-12 18:37 ` [PATCH 03/10] arm: stm32mp: bsec: remove unneeded test Patrick Delaunay
2020-03-18 10:04   ` Patrice CHOTARD
2020-04-24 14:24     ` Patrick DELAUNAY
2020-03-24  8:34   ` Patrick DELAUNAY
2020-02-12 18:37 ` [PATCH 04/10] arm: stm32mp: bsec: add permanent lock support in bsec driver Patrick Delaunay
2020-03-18 10:07   ` Patrice CHOTARD
2020-03-24  8:35   ` Patrick DELAUNAY
2020-02-12 18:37 ` [PATCH 05/10] board: stm32mp1: stboard: lock the OTP after programming Patrick Delaunay
2020-03-18 10:10   ` [Uboot-stm32] " Patrice CHOTARD
2020-03-24  8:36   ` Patrick DELAUNAY
2020-02-12 18:37 ` [PATCH 06/10] arm: stm32mp: improve the error message for smc Patrick Delaunay
2020-03-18 10:10   ` Patrice CHOTARD
2020-03-24  8:36   ` Patrick DELAUNAY
2020-02-12 18:37 ` Patrick Delaunay [this message]
2020-03-18 10:13   ` [Uboot-stm32] [PATCH 07/10] board: stm32mp1: add finished good in board identifier OTP Patrice CHOTARD
2020-03-18 10:44   ` Wolfgang Denk
2020-03-19  8:57     ` Patrick DELAUNAY
2020-03-19  9:13       ` Wolfgang Denk
2020-03-23  8:59         ` Patrick DELAUNAY
2020-02-12 18:37 ` [PATCH 08/10] board: stm32mp1: display reference only for STMicroelectronics board Patrick Delaunay
2020-03-18 10:15   ` [Uboot-stm32] " Patrice CHOTARD
2020-03-24  8:37   ` Patrick DELAUNAY
2020-02-12 18:37 ` [PATCH 09/10] arm: stm32mp: add function get_soc_name Patrick Delaunay
2020-03-18 10:16   ` Patrice CHOTARD
2020-03-24  8:37   ` Patrick DELAUNAY
2020-02-12 18:37 ` [PATCH 10/10] arm: stm32mp: fdt: update kernel device tree according the part number Patrick Delaunay
2020-03-18 10:16   ` Patrice CHOTARD
2020-03-24  8:37   ` Patrick DELAUNAY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200212183744.5309-8-patrick.delaunay@st.com \
    --to=patrick.delaunay@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.