2 * File: arch/blackfin/kernel/early_printk.c
3 * Based on: arch/x86_64/kernel/early_printk.c
4 * Author: Robin Getz <rgetz@blackfin.uclinux.org
7 * Description: allow a console to be used for early printk
10 * Copyright 2004-2007 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
25 #include <linux/kernel.h>
26 #include <linux/init.h>
27 #include <linux/serial_core.h>
28 #include <linux/console.h>
29 #include <linux/string.h>
30 #include <asm/blackfin.h>
31 #include <asm/irq_handler.h>
32 #include <asm/early_printk.h>
34 #ifdef CONFIG_SERIAL_BFIN
35 extern struct console *bfin_earlyserial_init(unsigned int port,
39 static struct console *early_console;
43 * cflags == UART output modes
45 #define DEFAULT_PORT 0
46 #define DEFAULT_CFLAG CS8|B57600
48 #ifdef CONFIG_SERIAL_CORE
49 /* What should get here is "0,57600" */
50 static struct console * __init earlyserial_init(char *buf)
54 unsigned int serial_port = DEFAULT_PORT;
55 unsigned int cflag = DEFAULT_CFLAG;
57 serial_port = simple_strtoul(buf, &buf, 10);
61 baud = simple_strtoul(buf, &buf, 10);
99 bit = simple_strtoul(buf, &buf, 10);
114 #ifdef CONFIG_SERIAL_BFIN
115 return bfin_earlyserial_init(serial_port, cflag);
123 int __init setup_early_printk(char *buf)
126 /* Crashing in here would be really bad, so check both the var
127 and the pointer before we start using it
135 if (early_console != NULL)
138 #ifdef CONFIG_SERIAL_BFIN
139 /* Check for Blackfin Serial */
140 if (!strncmp(buf, "serial,uart", 11)) {
142 early_console = earlyserial_init(buf);
146 /* TODO: add framebuffer console support */
149 if (likely(early_console)) {
150 early_console->flags |= CON_BOOT;
152 register_console(early_console);
153 printk(KERN_INFO "early printk enabled on %s%d\n",
155 early_console->index);
161 early_param("earlyprintk", setup_early_printk);