Merge "[msm7x30]: Turn off MDP before jumping to HLOS."
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 2e51ea9..5fdf7ab 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -646,18 +646,19 @@
 		goto fastboot;
 	#endif
 
+	reboot_mode = check_reboot_mode();
+	if (reboot_mode == RECOVERY_MODE) {
+		boot_into_recovery = 1;
+	} else if(reboot_mode == FASTBOOT_MODE) {
+		goto fastboot;
+	}
+
 	if (target_is_emmc_boot())
 	{
 		boot_linux_from_mmc();
 	}
 	else
 	{
-		reboot_mode = check_reboot_mode();
-		if (reboot_mode == RECOVERY_MODE) {
-			boot_into_recovery = 1;
-		} else if(reboot_mode == FASTBOOT_MODE) {
-			goto fastboot;
-		}
 		recovery_init();
 		boot_linux_from_flash();
 	}
diff --git a/target/msm8660_surf/init.c b/target/msm8660_surf/init.c
index e407974..9a64641 100755
--- a/target/msm8660_surf/init.c
+++ b/target/msm8660_surf/init.c
@@ -117,7 +117,14 @@
 
 unsigned check_reboot_mode(void)
 {
-    return 0;
+	unsigned restart_reason = 0;
+	void *restart_reason_addr = 0x401FFFFC;
+
+	/* Read reboot reason and scrub it */
+	restart_reason = readl(restart_reason_addr);
+	writel(0x00, restart_reason_addr);
+
+	return restart_reason;
 }
 
 void target_battery_charging_enable(unsigned enable, unsigned disconnect)