From 81372dce11e57a5cdf490f9b37e83ec3527252c2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Tue, 29 Jan 2013 09:49:43 +0800 Subject: [PATCH] rk3188: boot mode: add print name and watchdog reboot mode --- arch/arm/mach-rk30/common.c | 39 +++++++++++++++++++++++++-- arch/arm/plat-rk/include/plat/board.h | 1 + 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rk30/common.c b/arch/arm/mach-rk30/common.c index 3f7100ace5f3..2fc4115f3c7e 100755 --- a/arch/arm/mach-rk30/common.c +++ b/arch/arm/mach-rk30/common.c @@ -115,6 +115,41 @@ static void __init rk30_l2_cache_init(void) } static int boot_mode; + +static const char *boot_flag_name(u32 flag) +{ + flag -= SYS_KERNRL_REBOOT_FLAG; + switch (flag) { + case BOOT_NORMAL: return "NORMAL"; + case BOOT_LOADER: return "LOADER"; + case BOOT_MASKROM: return "MASKROM"; + case BOOT_RECOVER: return "RECOVER"; + case BOOT_NORECOVER: return "NORECOVER"; + case BOOT_SECONDOS: return "SECONDOS"; + case BOOT_WIPEDATA: return "WIPEDATA"; + case BOOT_WIPEALL: return "WIPEALL"; + case BOOT_CHECKIMG: return "CHECKIMG"; + case BOOT_FASTBOOT: return "FASTBOOT"; + default: return ""; + } +} + +static const char *boot_mode_name(u32 mode) +{ + switch (mode) { + case BOOT_MODE_NORMAL: return "NORMAL"; + case BOOT_MODE_FACTORY2: return "FACTORY2"; + case BOOT_MODE_RECOVERY: return "RECOVERY"; + case BOOT_MODE_CHARGE: return "CHARGE"; + case BOOT_MODE_POWER_TEST: return "POWER_TEST"; + case BOOT_MODE_OFFMODE_CHARGING: return "OFFMODE_CHARGING"; + case BOOT_MODE_REBOOT: return "REBOOT"; + case BOOT_MODE_PANIC: return "PANIC"; + case BOOT_MODE_WATCHDOG: return "WATCHDOG"; + default: return ""; + } +} + static void __init rk30_boot_mode_init(void) { u32 boot_flag = readl_relaxed(RK30_PMU_BASE + PMU_SYS_REG0); @@ -123,8 +158,8 @@ static void __init rk30_boot_mode_init(void) if (boot_flag == (SYS_KERNRL_REBOOT_FLAG | BOOT_RECOVER)) { boot_mode = BOOT_MODE_RECOVERY; } - if (boot_mode || boot_flag) - printk("Boot mode: %d flag: 0x%08x\n", boot_mode, boot_flag); + if (boot_mode || ((boot_flag & 0xff) && ((boot_flag & 0xffffff00) == SYS_KERNRL_REBOOT_FLAG))) + printk("Boot mode: %s (%d) flag: %s (0x%08x)\n", boot_mode_name(boot_mode), boot_mode, boot_flag_name(boot_flag), boot_flag); } int board_boot_mode(void) diff --git a/arch/arm/plat-rk/include/plat/board.h b/arch/arm/plat-rk/include/plat/board.h index e747411220ed..a18bbea9af54 100755 --- a/arch/arm/plat-rk/include/plat/board.h +++ b/arch/arm/plat-rk/include/plat/board.h @@ -438,6 +438,7 @@ struct rk_hdmi_platform_data { #define BOOT_MODE_OFFMODE_CHARGING 5 #define BOOT_MODE_REBOOT 6 #define BOOT_MODE_PANIC 7 +#define BOOT_MODE_WATCHDOG 8 int board_boot_mode(void); /* for USB detection */ -- 2.34.1