Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / unicore32 / kernel / early_printk.c
blob3922255f1fa8a1e915e1c53bbe8ed991338a64ae
1 /*
2 * linux/arch/unicore32/kernel/early_printk.c
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #include <linux/console.h>
13 #include <linux/init.h>
14 #include <linux/string.h>
15 #include <mach/ocd.h>
17 /* On-Chip-Debugger functions */
19 static void early_ocd_write(struct console *con, const char *s, unsigned n)
21 while (*s && n-- > 0) {
22 if (*s == '\n')
23 ocd_putc((int)'\r');
24 ocd_putc((int)*s);
25 s++;
29 static struct console early_ocd_console = {
30 .name = "earlyocd",
31 .write = early_ocd_write,
32 .flags = CON_PRINTBUFFER,
33 .index = -1,
36 /* Direct interface for emergencies */
37 static struct console *early_console = &early_ocd_console;
39 static int __initdata keep_early;
41 static int __init setup_early_printk(char *buf)
43 if (!buf)
44 return 0;
46 if (strstr(buf, "keep"))
47 keep_early = 1;
49 if (!strncmp(buf, "ocd", 3))
50 early_console = &early_ocd_console;
52 if (keep_early)
53 early_console->flags &= ~CON_BOOT;
54 else
55 early_console->flags |= CON_BOOT;
56 register_console(early_console);
57 return 0;
59 early_param("earlyprintk", setup_early_printk);