feat(stm32mp1): update CFG0 OTP for STM32MP13

This field is now declared on the 10 LSB bits on STM32MP13.
Several possible values are specified in the Reference Manual, and
indicate an open or closed device. Other values lead to a system panic.

Change-Id: I697124a21db66a56e7e223d601aa7cf44bb183c4
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
This commit is contained in:
Nicolas Le Bayon 2020-11-26 09:57:09 +01:00 committed by Yann Gautier
parent d59b9d53b9
commit 1c37d0c1d3
2 changed files with 26 additions and 0 deletions

View File

@ -431,7 +431,17 @@ enum ddr_type {
/* OTP mask */
/* CFG0 */
#if STM32MP13
#define CFG0_OTP_MODE_MASK GENMASK_32(9, 0)
#define CFG0_OTP_MODE_SHIFT 0
#define CFG0_OPEN_DEVICE 0x17U
#define CFG0_CLOSED_DEVICE 0x3FU
#define CFG0_CLOSED_DEVICE_NO_BOUNDARY_SCAN 0x17FU
#define CFG0_CLOSED_DEVICE_NO_JTAG 0x3FFU
#endif
#if STM32MP15
#define CFG0_CLOSED_DEVICE BIT(6)
#endif
/* PART NUMBER */
#if STM32MP13

View File

@ -549,7 +549,23 @@ bool stm32mp_is_closed_device(void)
return true;
}
#if STM32MP13
value = (value & CFG0_OTP_MODE_MASK) >> CFG0_OTP_MODE_SHIFT;
switch (value) {
case CFG0_OPEN_DEVICE:
return false;
case CFG0_CLOSED_DEVICE:
case CFG0_CLOSED_DEVICE_NO_BOUNDARY_SCAN:
case CFG0_CLOSED_DEVICE_NO_JTAG:
return true;
default:
panic();
}
#endif
#if STM32MP15
return (value & CFG0_CLOSED_DEVICE) == CFG0_CLOSED_DEVICE;
#endif
}
/* Return true when device supports secure boot */