]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(stm32mp1): update CFG0 OTP for STM32MP13
authorNicolas Le Bayon <nicolas.le.bayon@st.com>
Thu, 26 Nov 2020 08:57:09 +0000 (09:57 +0100)
committerYann Gautier <yann.gautier@st.com>
Tue, 22 Mar 2022 08:09:23 +0000 (09:09 +0100)
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>
plat/st/stm32mp1/stm32mp1_def.h
plat/st/stm32mp1/stm32mp1_private.c

index dd4559ffda84085716480fece66dc4b6f50a950c..6fde3b5bac4335fac1496ac1c95cb37eeaef4b47 100644 (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
index 738cd8cc4e3166fce160c34ec936fcdb143a5bd9..a9b9f4c5acd338ca5eccd6f2032254b00d0ef683 100644 (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 */