rockchip: rk3399: Add bootcount support
authorJagan Teki <jagan@amarulasolutions.com>
Thu, 9 Jan 2020 08:52:19 +0000 (14:22 +0530)
committerKever Yang <kever.yang@rock-chips.com>
Thu, 30 Jan 2020 03:44:01 +0000 (11:44 +0800)
Add bootcount support for Rockchip rk3399.

The bootcount value is preserved in PMU_SYS_REG0 register,
this would help to support redundent boot.

Once the redundant boot triggers, the altboot command
will look for extlinux-rollback.conf on particular
bootable partition which supposed to be a recovery
partition where redundant boot required.

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
arch/arm/mach-rockchip/Kconfig
arch/arm/mach-rockchip/rk3399/Kconfig
include/configs/rk3399_common.h

index b689a420bdbfa6f9e9aed344c8a3549a2f30d125..2f260a5c5f1dcfe65d9d44b8361a6ebd1e33b976 100644 (file)
@@ -244,6 +244,8 @@ config ROCKCHIP_RK3399
        imply TPL_CLK
        imply TPL_TINY_MEMSET
        imply TPL_ROCKCHIP_COMMON_BOARD
+       imply SYS_BOOTCOUNT_SINGLEWORD if BOOTCOUNT_LIMIT
+       imply CMD_BOOTCOUNT if BOOTCOUNT_LIMIT
        help
          The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72
          and quad-core Cortex-A53.
index 868e85fc2a027c1c5202234dfda751dbc2b2790f..f99415280356599f27e20ea26600421075d95011 100644 (file)
@@ -113,6 +113,16 @@ config TPL_TEXT_BASE
 config SPL_STACK_R_ADDR
        default 0x04000000
 
+if BOOTCOUNT_LIMIT
+
+config BOOTCOUNT_BOOTLIMIT
+       default 3
+
+config SYS_BOOTCOUNT_ADDR
+       default 0xff3100f0      # PMU_SYS_REG0
+
+endif # BOOTCOUNT_LIMIT
+
 source "board/rockchip/evb_rk3399/Kconfig"
 source "board/theobroma-systems/puma_rk3399/Kconfig"
 source "board/vamrs/rock960_rk3399/Kconfig"
index 127ca1f09cda2ed16f0baebb2626a0acc38d74b5..89a8a44bbe22030aa3160ba66d9e4b5bfe910373 100644 (file)
        "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
        "partitions=" PARTS_DEFAULT \
        ROCKCHIP_DEVICE_SETTINGS \
-       BOOTENV
+       BOOTENV \
+       "altbootcmd=" \
+               "setenv boot_syslinux_conf extlinux/extlinux-rollback.conf;" \
+               "run distro_bootcmd\0"
 
 #endif