aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Swetland <swetland@google.com>2010-12-29 13:16:15 -0800
committerArve Hjønnevåg <arve@android.com>2011-11-17 17:52:46 -0800
commite3f8c870161e5c478d8b677ccd7f63b63c5ee715 (patch)
tree297d028f4c969c56473af6f80f4232f9e2124cb1
parent0c2eec903dcb964c0ac317579e910e13a2f5155e (diff)
downloadkernel_samsung_crespo-e3f8c870161e5c478d8b677ccd7f63b63c5ee715.zip
kernel_samsung_crespo-e3f8c870161e5c478d8b677ccd7f63b63c5ee715.tar.gz
kernel_samsung_crespo-e3f8c870161e5c478d8b677ccd7f63b63c5ee715.tar.bz2
ARM: herring: improve reboot reason reporting
Set the reason register (INFORM6) to 0xee at boot so we can use that reason code to detect a watchdog-reboot. On a normal reboot, the installed notifier will set INFORM6 to a small integer reboot reason. On an abnormal reboot (after a panic, etc), we'll hit herring_pm_restart with INFORM6 containing 0xee. In that case we'll rewrite it to 0xbb. INFORM6 = 0, 1, 2, ... normal controlled reboot INFORM6 = 0xbb abnormal reboot (panic, etc) INFORM6 = 0xee watchdog reboot Change-Id: I1042edbffda31f8b796d7ade26c6239e08a5454b Signed-off-by: Brian Swetland <swetland@google.com>
-rwxr-xr-xarch/arm/mach-s5pv210/mach-herring.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/arch/arm/mach-s5pv210/mach-herring.c b/arch/arm/mach-s5pv210/mach-herring.c
index 9207af2..429cb35 100755
--- a/arch/arm/mach-s5pv210/mach-herring.c
+++ b/arch/arm/mach-s5pv210/mach-herring.c
@@ -107,7 +107,6 @@ EXPORT_SYMBOL(sec_set_param_value);
void (*sec_get_param_value)(int idx, void *value);
EXPORT_SYMBOL(sec_get_param_value);
-#define KERNEL_REBOOT_MASK 0xFFFFFFFF
#define REBOOT_MODE_FAST_BOOT 7
#define PREALLOC_WLAN_SEC_NUM 4
@@ -132,7 +131,6 @@ static int herring_notifier_call(struct notifier_block *this,
unsigned long code, void *_cmd)
{
int mode = REBOOT_MODE_NONE;
- unsigned int temp;
if ((code == SYS_RESTART) && _cmd) {
if (!strcmp((char *)_cmd, "recovery"))
@@ -142,10 +140,7 @@ static int herring_notifier_call(struct notifier_block *this,
else
mode = REBOOT_MODE_NONE;
}
- temp = __raw_readl(S5P_INFORM6);
- temp |= KERNEL_REBOOT_MASK;
- temp &= mode;
- __raw_writel(temp, S5P_INFORM6);
+ __raw_writel(mode, S5P_INFORM6);
return NOTIFY_DONE;
}
@@ -4384,6 +4379,16 @@ static void flush_console(void)
static void herring_pm_restart(char mode, const char *cmd)
{
flush_console();
+
+ /* On a normal reboot, INFORM6 will contain a small integer
+ * reason code from the notifier hook. On a panic, it will
+ * contain the 0xee we set at boot. Write 0xbb to differentiate
+ * a watchdog-timeout-and-reboot (0xee) from a controlled reboot
+ * (0xbb)
+ */
+ if (__raw_readl(S5P_INFORM6) == 0xee)
+ __raw_writel(0xbb, S5P_INFORM6);
+
arm_machine_restart(mode, cmd);
}
@@ -4545,6 +4550,12 @@ static void __init herring_machine_init(void)
uart_switch_init();
herring_init_wifi_mem();
+
+ /* write something into the INFORM6 register that we can use to
+ * differentiate an unclear reboot from a clean reboot (which
+ * writes a small integer code to INFORM6).
+ */
+ __raw_writel(0xee, S5P_INFORM6);
}
#ifdef CONFIG_USB_SUPPORT