Message ID | 20200212183744.5309-6-patrick.delaunay@st.com |
---|---|
State | Accepted |
Commit | 658fde8a36ff1f1e95b8f0cbe7382b6f2b83725a |
Headers | show |
Series | stm32mp1: board and SOC identifications | expand |
On 2/12/20 7:37 PM, Patrick Delaunay wrote: > Lock the OTP used for board identification for the ST boards after > programming. > > Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com> > --- > > board/st/common/cmd_stboard.c | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > > diff --git a/board/st/common/cmd_stboard.c b/board/st/common/cmd_stboard.c > index c7ca773b1c..1573e35410 100644 > --- a/board/st/common/cmd_stboard.c > +++ b/board/st/common/cmd_stboard.c > @@ -42,7 +42,7 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc, > char * const argv[]) > { > int ret; > - u32 otp; > + u32 otp, lock; > u8 revision; > unsigned long board, variant, bom; > struct udevice *dev; > @@ -66,11 +66,20 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc, > return CMD_RET_FAILURE; > } > > + ret = misc_read(dev, STM32_BSEC_LOCK(BSEC_OTP_BOARD), > + &lock, sizeof(lock)); > + if (ret < 0) { > + puts("LOCK read error"); > + return CMD_RET_FAILURE; > + } > + > if (argc == 0) { > if (!otp) > puts("Board : OTP board FREE\n"); > else > display_stboard(otp); > + printf(" OTP %d %s locked !\n", BSEC_OTP_BOARD, > + lock == 1 ? "" : "NOT"); > return CMD_RET_SUCCESS; > } > > @@ -129,6 +138,16 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc, > puts("BOARD programming error\n"); > return CMD_RET_FAILURE; > } > + > + /* write persistent lock */ > + otp = 1; > + ret = misc_write(dev, STM32_BSEC_LOCK(BSEC_OTP_BOARD), > + &otp, sizeof(otp)); > + if (ret < 0) { > + puts("BOARD lock error\n"); > + return CMD_RET_FAILURE; > + } > + > puts("BOARD programming done\n"); > > return CMD_RET_SUCCESS; Acked-by: Patrice Chotard <patrice.chotard at st.com> Thanks Patrice
Hi, > From: Patrick DELAUNAY <patrick.delaunay at st.com> > Sent: mercredi 12 f?vrier 2020 19:38 > > Lock the OTP used for board identification for the ST boards after programming. > > Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com> > --- Applied to u-boot-stm/next, thanks! Regards Patrick
diff --git a/board/st/common/cmd_stboard.c b/board/st/common/cmd_stboard.c index c7ca773b1c..1573e35410 100644 --- a/board/st/common/cmd_stboard.c +++ b/board/st/common/cmd_stboard.c @@ -42,7 +42,7 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int ret; - u32 otp; + u32 otp, lock; u8 revision; unsigned long board, variant, bom; struct udevice *dev; @@ -66,11 +66,20 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc, return CMD_RET_FAILURE; } + ret = misc_read(dev, STM32_BSEC_LOCK(BSEC_OTP_BOARD), + &lock, sizeof(lock)); + if (ret < 0) { + puts("LOCK read error"); + return CMD_RET_FAILURE; + } + if (argc == 0) { if (!otp) puts("Board : OTP board FREE\n"); else display_stboard(otp); + printf(" OTP %d %s locked !\n", BSEC_OTP_BOARD, + lock == 1 ? "" : "NOT"); return CMD_RET_SUCCESS; } @@ -129,6 +138,16 @@ static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc, puts("BOARD programming error\n"); return CMD_RET_FAILURE; } + + /* write persistent lock */ + otp = 1; + ret = misc_write(dev, STM32_BSEC_LOCK(BSEC_OTP_BOARD), + &otp, sizeof(otp)); + if (ret < 0) { + puts("BOARD lock error\n"); + return CMD_RET_FAILURE; + } + puts("BOARD programming done\n"); return CMD_RET_SUCCESS;
Lock the OTP used for board identification for the ST boards after programming. Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com> --- board/st/common/cmd_stboard.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)