]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/unicore32/kernel/early_printk.c
Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-bionic-kernel.git] / arch / unicore32 / kernel / early_printk.c
CommitLineData
28bab059
G
1/*
2 * linux/arch/unicore32/kernel/early_printk.c
3 *
4 * Code specific to PKUnity SoC and UniCore ISA
5 *
6 * Copyright (C) 2001-2010 GUAN Xue-tao
7 *
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.
11 */
12#include <linux/console.h>
13#include <linux/init.h>
14#include <linux/string.h>
15#include <mach/ocd.h>
16
17/* On-Chip-Debugger functions */
18
19static void early_ocd_write(struct console *con, const char *s, unsigned n)
20{
21 while (*s && n-- > 0) {
22 if (*s == '\n')
23 ocd_putc((int)'\r');
24 ocd_putc((int)*s);
25 s++;
26 }
27}
28
29static struct console early_ocd_console = {
30 .name = "earlyocd",
31 .write = early_ocd_write,
32 .flags = CON_PRINTBUFFER,
33 .index = -1,
34};
35
28bab059
G
36static int __init setup_early_printk(char *buf)
37{
d0380e6c 38 if (!buf || early_console)
28bab059
G
39 return 0;
40
d0380e6c 41 early_console = &early_ocd_console;
40e05dd0 42 if (strstr(buf, "keep"))
28bab059
G
43 early_console->flags &= ~CON_BOOT;
44 else
45 early_console->flags |= CON_BOOT;
46 register_console(early_console);
47 return 0;
48}
49early_param("earlyprintk", setup_early_printk);