stm32mp1: add bootcount support
authorPatrick Delaunay <patrick.delaunay@st.com>
Thu, 18 Apr 2019 15:32:45 +0000 (17:32 +0200)
committerPatrice Chotard <patrice.chotard@st.com>
Thu, 23 May 2019 09:36:47 +0000 (11:36 +0200)
Activate bootcount and use TAMP register to store the count value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
arch/arm/mach-stm32mp/Kconfig
arch/arm/mach-stm32mp/include/mach/stm32.h

index 26dace10859babff8d874abb61ae5226674bbed8..c9846169610683f5794b54983e9d9f135d18af8e 100644 (file)
@@ -39,6 +39,8 @@ config TARGET_STM32MP1
        select STM32_RCC
        select STM32_RESET
        select SYS_ARCH_TIMER
+       imply BOOTCOUNT_LIMIT
+       imply CMD_BOOTCOUNT
        imply SYSRESET_PSCI if STM32MP1_TRUSTED
        imply SYSRESET_SYSCON if !STM32MP1_TRUSTED
        help
@@ -76,6 +78,15 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
          Partition on the second MMC to load U-Boot from when the MMC is being
          used in raw mode
 
+if BOOTCOUNT_LIMIT
+config SYS_BOOTCOUNT_SINGLEWORD
+       default y
+
+# TAMP_BOOTCOUNT = TAMP_BACKUP_REGISTER(21)
+config SYS_BOOTCOUNT_ADDR
+       default 0x5C00A154
+endif
+
 if DEBUG_UART
 
 config DEBUG_UART_BOARD_INIT
index c526c88e3ee9caf25558c66c80d976c8bacdb37b..67953520448572814c91b22d8d80d8afe4198790 100644 (file)
@@ -88,6 +88,7 @@ enum boot_device {
 #define TAMP_BACKUP_MAGIC_NUMBER       TAMP_BACKUP_REGISTER(4)
 #define TAMP_BACKUP_BRANCH_ADDRESS     TAMP_BACKUP_REGISTER(5)
 #define TAMP_BOOT_CONTEXT              TAMP_BACKUP_REGISTER(20)
+#define TAMP_BOOTCOUNT                 TAMP_BACKUP_REGISTER(21)
 
 #define TAMP_BOOT_MODE_MASK            GENMASK(15, 8)
 #define TAMP_BOOT_MODE_SHIFT           8