rk3188: boot mode: add print name and watchdog reboot mode
author黄涛 <huangtao@rock-chips.com>
Tue, 29 Jan 2013 01:49:43 +0000 (09:49 +0800)
committer黄涛 <huangtao@rock-chips.com>
Tue, 29 Jan 2013 01:50:12 +0000 (09:50 +0800)
arch/arm/mach-rk30/common.c
arch/arm/plat-rk/include/plat/board.h

index 3f7100ace5f381455cf87bea96d12711aa0d2093..2fc4115f3c7ecec3572a9103f516f4cf68341c7e 100755 (executable)
@@ -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)
index e747411220edfd21178a381c346232a974f136cf..a18bbea9af5409b73c13e85f5b4f662ec9f49b82 100755 (executable)
@@ -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 */