msm: restart: initialize reboot code at early initcall time
It is possible for the kernel to panic on boot. Previously, in such a
case the kernel wouldn't enter download mode, which makes the issue that
much harder to debug. So, initialize the download mode magic early on.
The pmic interrupt part has to stay at late_initcall because it depends
on code that runs in setup_machine, which is an arch_initcall.
Change-Id: I4b6cee30cbb2b8cbcb288203e6f2cc8c17ed3a70
Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
diff --git a/arch/arm/mach-msm/restart.c b/arch/arm/mach-msm/restart.c
index 5382102..e45e2c4 100644
--- a/arch/arm/mach-msm/restart.c
+++ b/arch/arm/mach-msm/restart.c
@@ -232,21 +232,10 @@
printk(KERN_ERR "Restarting has failed\n");
}
-static int __init msm_restart_init(void)
+static int __init msm_pmic_restart_init(void)
{
int rc;
-#ifdef CONFIG_MSM_DLOAD_MODE
- atomic_notifier_chain_register(&panic_notifier_list, &panic_blk);
- dload_mode_addr = MSM_IMEM_BASE + DLOAD_MODE_ADDR;
-
- /* Reset detection is switched on below.*/
- set_dload_mode(download_mode);
-#endif
- msm_tmr0_base = msm_timer_get_timer0_base();
- restart_reason = MSM_IMEM_BASE + RESTART_REASON_ADDR;
- pm_power_off = msm_power_off;
-
if (pmic_reset_irq != 0) {
rc = request_any_context_irq(pmic_reset_irq,
resout_irq_handler, IRQF_TRIGGER_HIGH,
@@ -260,4 +249,19 @@
return 0;
}
-late_initcall(msm_restart_init);
+late_initcall(msm_pmic_restart_init);
+
+static int __init msm_restart_init(void)
+{
+#ifdef CONFIG_MSM_DLOAD_MODE
+ atomic_notifier_chain_register(&panic_notifier_list, &panic_blk);
+ dload_mode_addr = MSM_IMEM_BASE + DLOAD_MODE_ADDR;
+ set_dload_mode(download_mode);
+#endif
+ msm_tmr0_base = msm_timer_get_timer0_base();
+ restart_reason = MSM_IMEM_BASE + RESTART_REASON_ADDR;
+ pm_power_off = msm_power_off;
+
+ return 0;
+}
+early_initcall(msm_restart_init);