sniper: OMAP3 reboot mode support
authorPaul Kocialkowski <contact@paulk.fr>
Mon, 20 Jul 2015 13:17:12 +0000 (15:17 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 13 Aug 2015 00:47:37 +0000 (20:47 -0400)
This adds support for the omap3 reboot mode mechanism and exports the reboot
mode via an environment variable, that is used in the boot command to make it
possible to boot from the recovery partition.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Tom Rini <trini@konsulko.com>
board/lge/sniper/sniper.c
include/configs/sniper.h

index d5318c4f32823ec37e7b0d298257f9592ed03ae9..44d422da1b97c624e16117ed9e981ded29189399 100644 (file)
@@ -9,6 +9,7 @@
 #include <config.h>
 #include <common.h>
 #include <dm.h>
+#include <linux/ctype.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mem.h>
@@ -67,6 +68,23 @@ int board_init(void)
        return 0;
 }
 
+int misc_init_r(void)
+{
+       char reboot_mode[2] = { 0 };
+
+       /* Reboot mode */
+
+       reboot_mode[0] = omap_reboot_mode();
+       if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
+               if (!getenv("reboot-mode"))
+                       setenv("reboot-mode", (char *)reboot_mode);
+
+               omap_reboot_mode_clear();
+       }
+
+       return 0;
+}
+
 void set_muxconf_regs(void)
 {
        MUX_SNIPER();
index bf788baaeeb7b9b6e2b7f102cb6333ed8185e52d..2ac9291c4401e0ae5dfe7138751b2dd4e917a74c 100644 (file)
@@ -35,6 +35,7 @@
  */
 
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_MISC_INIT_R
 
 /*
  * Clocks
 
 #define CONFIG_BOOTCOMMAND \
        "setenv boot_mmc_part ${kernel_mmc_part}; " \
+       "if test reboot-${reboot-mode} = reboot-r; then " \
+       "echo recovery; setenv boot_mmc_part ${recovery_mmc_part}; fi; " \
        "part start mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_start; " \
        "part size mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_size; " \
        "mmc dev ${boot_mmc_dev}; " \