Permalink
Browse files

ARM: herring: force console flush on restart

Based on code we used on msm and tegra.

Signed-off-by: Brian Swetland <swetland@google.com>
  • Loading branch information...
1 parent 32b63bf commit 814333bb8d48652b7937ed6c21e6ea203e25b816 @swetland swetland committed with tinyalsa Dec 7, 2010
Showing with 36 additions and 0 deletions.
  1. +36 −0 arch/arm/mach-s5pv210/mach-herring.c
@@ -31,11 +31,13 @@
#include <linux/input.h>
#include <linux/irq.h>
#include <linux/skbuff.h>
+#include <linux/console.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
+#include <asm/system.h>
#include <mach/map.h>
#include <mach/regs-clock.h>
@@ -4218,8 +4220,42 @@ static void __init sound_init(void)
gpio_request(GPIO_MICBIAS_EN, "micbias_enable");
}
+static bool console_flushed;
+
+static void 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("flush_console: console was locked! busting!\n");
+ else
+ pr_emerg("flush_console: console was locked!\n");
+ release_console_sem();
+}
+
+static void herring_pm_restart(char mode, const char *cmd)
+{
+ flush_console();
+ arm_machine_restart(mode, cmd);
+}
+
static void __init herring_machine_init(void)
{
+ arm_pm_restart = herring_pm_restart;
+
setup_ram_console_mem();
s3c_usb_set_serial();
platform_add_devices(herring_devices, ARRAY_SIZE(herring_devices));

0 comments on commit 814333b

Please sign in to comment.