From: Jaehoon Chung Date: Mon, 25 Jul 2016 12:04:15 +0000 (+0900) Subject: samsung: misc: support to check reboot mode with inform register X-Git-Tag: accepted/tizen/unified/20201110.125028~306 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6c6adf56464540666320cf9a4d4ddfb695e97274;p=platform%2Fkernel%2Fu-boot.git 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 --- diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index d9646d9..991004a 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include /* @@ -936,6 +937,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 398822d..c2a67ec 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);