app: aboot: check hard reset reason when device reboot

Use the spare register in PMIC power-on peripheral to store the device
restart reason. So need to check hard reset reason when device boot up

Change-Id: I74051e915b6e8089fe5d16ed0c3ca1eb70462335
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 78164e5..ae9a564 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -106,6 +106,10 @@
 
 #define MAX_TAGS_SIZE   1024
 
+#define RECOVERY_HARD_RESET_MODE   0x01
+#define FASTBOOT_HARD_RESET_MODE   0x02
+#define RTC_HARD_RESET_MODE        0x03
+
 #define RECOVERY_MODE   0x77665502
 #define FASTBOOT_MODE   0x77665500
 #define ALARM_BOOT      0x77665503
@@ -2724,6 +2728,7 @@
 void aboot_init(const struct app_descriptor *app)
 {
 	unsigned reboot_mode = 0;
+	unsigned hard_reboot_mode = 0;
 	bool boot_into_fastboot = false;
 
 	/* Setup page size information for nv storage */
@@ -2791,11 +2796,15 @@
 	#endif
 
 	reboot_mode = check_reboot_mode();
-	if (reboot_mode == RECOVERY_MODE) {
+	hard_reboot_mode = check_hard_reboot_mode();
+	if (reboot_mode == RECOVERY_MODE ||
+		hard_reboot_mode == RECOVERY_HARD_RESET_MODE) {
 		boot_into_recovery = 1;
-	} else if(reboot_mode == FASTBOOT_MODE) {
+	} else if(reboot_mode == FASTBOOT_MODE ||
+		hard_reboot_mode == FASTBOOT_HARD_RESET_MODE) {
 		boot_into_fastboot = true;
-	} else if(reboot_mode == ALARM_BOOT) {
+	} else if(reboot_mode == ALARM_BOOT ||
+		hard_reboot_mode == RTC_HARD_RESET_MODE) {
 		boot_reason_alarm = true;
 	}