diff mbox

[U-Boot,21/27] kc1: OMAP4 reboot mode support

Message ID 1456597155-10711-22-git-send-email-contact@paulk.fr
State Accepted
Commit 7c0a4b795589511a4880ca268d03a140551e5b4e
Delegated to: Tom Rini
Headers show

Commit Message

Paul Kocialkowski Feb. 27, 2016, 6:19 p.m. UTC
This adds support for the omap4 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 or fastboot.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 board/amazon/kc1/kc1.c | 18 ++++++++++++++++++
 board/amazon/kc1/kc1.h |  2 ++
 include/configs/kc1.h  |  4 ++++
 3 files changed, 24 insertions(+)

Comments

Tom Rini March 17, 2016, 1:59 a.m. UTC | #1
On Sat, Feb 27, 2016 at 07:19:09PM +0100, Paul Kocialkowski wrote:

> This adds support for the omap4 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 or fastboot.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

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

Patch

diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index 29d9c64..d526695 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -85,6 +85,19 @@  int board_init(void)
 
 int misc_init_r(void)
 {
+	char reboot_mode[2] = { 0 };
+
+	/* Reboot mode */
+
+	omap_reboot_mode(reboot_mode, sizeof(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();
+	}
+
 	/* Serial number */
 
 	omap_die_id_serial();
@@ -123,6 +136,11 @@  void get_board_serial(struct tag_serialnr *serialnr)
 	omap_die_id_get_board_serial(serialnr);
 }
 
+int fb_set_reboot_flag(void)
+{
+	return omap_reboot_mode_store("b");
+}
+
 #ifndef CONFIG_SPL_BUILD
 int board_mmc_init(bd_t *bis)
 {
diff --git a/board/amazon/kc1/kc1.h b/board/amazon/kc1/kc1.h
index 67d008f..14737d7 100644
--- a/board/amazon/kc1/kc1.h
+++ b/board/amazon/kc1/kc1.h
@@ -11,6 +11,7 @@ 
 
 #include <asm/arch/mux_omap4.h>
 
+#define KC1_GPIO_USB_ID		52
 #define KC1_GPIO_MBID1		173
 #define KC1_GPIO_MBID0		174
 #define KC1_GPIO_MBID3		177
@@ -28,6 +29,7 @@  const struct pad_conf_entry core_padconf_array[] = {
 	{ GPMC_AD7,		(IEN  | PTU | M1) }, /* sdmmc2_dat7 */
 	{ GPMC_NOE,		(IEN  | PTU | M1) }, /* sdmmc2_clk */
 	{ GPMC_NWE,		(IEN  | PTU | M1) }, /* sdmmc2_cmd */
+	{ GPMC_NCS2,		(IEN  | PTD | M3) }, /* gpio_52 */
 	/* CAM */
 	{ CAM_SHUTTER,		(IDIS | DIS | M7) }, /* safe_mode */
 	{ CAM_STROBE,		(IDIS | DIS | M7) }, /* safe_mode */
diff --git a/include/configs/kc1.h b/include/configs/kc1.h
index 185e8de..04cb320 100644
--- a/include/configs/kc1.h
+++ b/include/configs/kc1.h
@@ -249,6 +249,10 @@ 
 
 #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; " \
+	"if test reboot-${reboot-mode} = reboot-b; then " \
+	"echo fastboot; fastboot 0; 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}; " \