diff mbox

[U-Boot,06/12] sniper: OMAP3 reboot mode support

Message ID 1437398238-27912-7-git-send-email-contact@paulk.fr
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Paul Kocialkowski July 20, 2015, 1:17 p.m. UTC
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>
---
 board/lge/sniper/sniper.c | 18 ++++++++++++++++++
 include/configs/sniper.h  |  3 +++
 2 files changed, 21 insertions(+)

Comments

Tom Rini Aug. 4, 2015, 2:08 a.m. UTC | #1
On Mon, Jul 20, 2015 at 03:17:12PM +0200, Paul Kocialkowski wrote:

> 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>
Tom Rini Aug. 13, 2015, 1:18 p.m. UTC | #2
On Mon, Jul 20, 2015 at 03:17:12PM +0200, Paul Kocialkowski wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c
index d5318c4..44d422d 100644
--- a/board/lge/sniper/sniper.c
+++ b/board/lge/sniper/sniper.c
@@ -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();
diff --git a/include/configs/sniper.h b/include/configs/sniper.h
index ef7a2bf..eb1252d 100644
--- a/include/configs/sniper.h
+++ b/include/configs/sniper.h
@@ -35,6 +35,7 @@ 
  */
 
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_MISC_INIT_R
 
 /*
  * Clocks
@@ -250,6 +251,8 @@ 
 
 #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}; " \