summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehoon Chung <jh80.chung@samsung.com>2016-07-25 21:04:15 +0900
committerJaehoon Chung <jh80.chung@samsung.com>2016-07-25 22:40:52 -0700
commit237af68923caac29b00144857ed163c3f2ae0b82 (patch)
tree9fe68ca80cb6575541aa51bee0243ae2e40d48de
parentbed13664795cc5c70f4847aa5c12d3c0154dd85f (diff)
downloadu-boot-237af68923caac29b00144857ed163c3f2ae0b82.tar.gz
u-boot-237af68923caac29b00144857ed163c3f2ae0b82.tar.bz2
u-boot-237af68923caac29b00144857ed163c3f2ae0b82.zip
samsung: misc: support to check reboot mode with inform register
To support the reboot mode, add the check_reboot_mode() function. This function is checking which reboot mode is with INFORM register. "inform-num" can get from device-tree with "samsung,reboot-mode" compatible. Change-Id: Ib3e201a6ab17afbc163376b139b1a9977fbf7fb6 Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
-rw-r--r--board/samsung/common/misc.c27
-rw-r--r--include/samsung/misc.h5
2 files changed, 32 insertions, 0 deletions
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 16e51fc9cd..9dec484946 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -17,6 +17,7 @@
#include <memalign.h>
#include <linux/sizes.h>
#include <asm/arch/cpu.h>
+#include <asm/arch/power.h>
#include <asm/gpio.h>
#include <dm.h>
#include <power/pmic.h>
@@ -905,6 +906,32 @@ void keys_init(void)
}
#endif /* CONFIG_LCD_MENU */
+void check_reboot_mode(void) {
+ u32 val;
+ int node, inform_num;
+
+ node = fdt_node_offset_by_compatible(gd->fdt_blob, 0,
+ "samsung,reboot-mode");
+ if (node < 0)
+ return;
+
+ inform_num = fdtdec_get_int(gd->fdt_blob, node, "inform-num", -1);
+ if (inform_num < 0)
+ return;
+
+ /* Get the value from INFORM register */
+ val = get_inform_value(inform_num);
+ if (val < 0)
+ return;
+
+ clear_inform_value(inform_num);
+
+ val &= ~REBOOT_MODE_PREFIX;
+ if (val & REBOOT_DOWNLOAD) {
+ run_command("thordown", 0);
+ }
+}
+
#ifdef CONFIG_CMD_BMP
void draw_logo(void)
{
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
index a58c5e06ac..0a0e99cd4d 100644
--- a/include/samsung/misc.h
+++ b/include/samsung/misc.h
@@ -11,6 +11,11 @@ u32 get_board_rev(void);
void set_board_info(void);
#endif
+/* Check which reboot mode is */
+#define REBOOT_MODE_PREFIX 0x12345670
+#define REBOOT_DOWNLOAD 0x1
+void check_reboot_mode(void);
+
#if defined(CONFIG_LCD_MENU) || defined(CONFIG_INTERACTIVE_CHARGER)
void keys_init(void);
int check_keys(void);