From: Ye Li Date: Mon, 30 Jan 2023 10:39:54 +0000 (+0800) Subject: imx: ele_ahab: confirm lifecycle before closing the part X-Git-Tag: baikal/mips/sdk6.2~4^2~3^2~175^2~16^2~66 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=278829747acd2173b4a8d733a1bf8fe150b2e832;p=uboot.git imx: ele_ahab: confirm lifecycle before closing the part Before moving the lifecycle to OEM closed, confirm the lifecycle is OEM open, otherwise cancel to move forward the lifecycle. Signed-off-by: Ye Li Reviewed-by: Peng Fan --- diff --git a/arch/arm/mach-imx/ele_ahab.c b/arch/arm/mach-imx/ele_ahab.c index da8c99b8b0..58b6542b8e 100644 --- a/arch/arm/mach-imx/ele_ahab.c +++ b/arch/arm/mach-imx/ele_ahab.c @@ -474,10 +474,20 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc, { int err; u32 resp; + u32 lc; if (!confirm_close()) return -EACCES; + lc = readl(FSB_BASE_ADDR + 0x41c); + lc &= 0x3ff; + + if (lc != 0x8) { + puts("Current lifecycle is NOT OEM open, can't move to OEM closed\n"); + display_life_cycle(lc); + return -EPERM; + } + err = ahab_forward_lifecycle(8, &resp); if (err != 0) { printf("Error in forward lifecycle to OEM closed\n");