From 50a051eb6ab12d3317b78618db786745e2efe08b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Tue, 6 Aug 2013 19:16:25 +0800 Subject: [PATCH] rk30: reset better check panic --- arch/arm/mach-rk30/reset.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rk30/reset.c b/arch/arm/mach-rk30/reset.c index f897f7849450..5bfb2c4ff15f 100644 --- a/arch/arm/mach-rk30/reset.c +++ b/arch/arm/mach-rk30/reset.c @@ -8,6 +8,25 @@ #include #include +static bool is_panic = false; + +static int panic_event(struct notifier_block *this, unsigned long event, void *ptr) +{ + is_panic = true; + return NOTIFY_DONE; +} + +static struct notifier_block panic_block = { + .notifier_call = panic_event, +}; + +static int __init arch_reset_init(void) +{ + atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + return 0; +} +core_initcall(arch_reset_init); + static void rk30_arch_reset(char mode, const char *cmd) { u32 boot_flag = 0; @@ -21,7 +40,7 @@ static void rk30_arch_reset(char mode, const char *cmd) else if (!strcmp(cmd, "charge")) boot_mode = BOOT_MODE_CHARGE; } else { - if (system_state != SYSTEM_RESTART) + if (is_panic) boot_mode = BOOT_MODE_PANIC; } writel_relaxed(boot_flag, RK30_PMU_BASE + PMU_SYS_REG0); // for loader -- 2.34.1