[U-Boot,v1,5/5] arm: display5: Extend SPL to support bootcount checking

Message ID 20180210102032.315-6-lukma@denx.de
State Superseded
Delegated to: Tom Rini
Headers show
Series
  • Provide SPL support for bootcount (in the case of using falcon boot mode)
Related show

Commit Message

Lukasz Majewski Feb. 10, 2018, 10:20 a.m.
This patch is necessary for providing basic bootcount checking in the case
of using "falcon" boot mode.

It forces u-boot proper boot, when we exceed the number of errors.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 board/liebherr/display5/spl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c
index 0a36e656c0..e21b4bee75 100644
--- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c
@@ -20,6 +20,7 @@ 
 #include <environment.h>
 #include <fsl_esdhc.h>
 #include <netdev.h>
+#include <bootcount.h>
 #include "common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -214,7 +215,7 @@  void board_boot_order(u32 *spl_boot_list)
 	env_load();
 
 	s = env_get("BOOT_FROM");
-	if (s && strcmp(s, "ACTIVE") == 0) {
+	if (s && !bootcount_error() && strcmp(s, "ACTIVE") == 0) {
 		spl_boot_list[0] = BOOT_DEVICE_MMC1;
 		spl_boot_list[1] = spl_boot_device();
 	}
@@ -242,6 +243,7 @@  int spl_start_uboot(void)
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
+	bootcount_inc();
 	return 0;
 }
 #endif