summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2010-11-11 15:28:46 -0800
committerDima Zavin <dima@android.com>2010-11-11 17:40:47 -0800
commitdf05ccfa78ff88a15bdf0b7b615292b9149f199a (patch)
treeb8374a9e5f029e8f730da84b79f551436d621fde
parent240db6a5cb4b846c255e0ae999f406610ab0156c (diff)
ARM: tegra: flush console before reboot
If the console_sem was held while the system was rebooted, the messages in the temporary logbuffer would not have propogated to all the console drivers. This force releases the console sem if it failed to be acquired. Change-Id: I6eba9d744ef41209d26328a17c7ae19c32d6e8cb Signed-off-by: Dima Zavin <dima@android.com>
-rw-r--r--arch/arm/mach-tegra/common.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 2fdb99b6fdc5..12ce86b7ab9c 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -17,6 +17,7 @@
*
*/
+#include <linux/console.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/clk.h>
@@ -25,6 +26,7 @@
#include <linux/memblock.h>
#include <asm/hardware/cache-l2x0.h>
+#include <asm/system.h>
#include <mach/iomap.h>
#include <mach/dma.h>
@@ -98,8 +100,41 @@ static void __init tegra_init_power(void)
tegra_powergate_power_off(TEGRA_POWERGATE_3D);
}
+static bool console_flushed;
+
+static void tegra_pm_flush_console(void)
+{
+ if (console_flushed)
+ return;
+ console_flushed = true;
+
+ printk("\n");
+ pr_emerg("Restarting %s\n", linux_banner);
+ if (!try_acquire_console_sem()) {
+ release_console_sem();
+ return;
+ }
+
+ mdelay(50);
+
+ local_irq_disable();
+ if (try_acquire_console_sem())
+ pr_emerg("tegra_restart: Console was locked! Busting\n");
+ else
+ pr_emerg("tegra_restart: Console was locked!\n");
+ release_console_sem();
+}
+
+static void tegra_pm_restart(char mode, const char *cmd)
+{
+ tegra_pm_flush_console();
+ arm_machine_restart(mode, cmd);
+}
+
void __init tegra_common_init(void)
{
+ arm_pm_restart = tegra_pm_restart;
+
tegra_init_fuse();
tegra_init_clock();
tegra_clk_init_from_table(common_clk_init_table);