aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250.c
diff options
context:
space:
mode:
authorYinghai Lu <Yinghai.Lu@Sun.COM>2007-07-16 02:37:59 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:35 -0400
commit18a8bd949d6adb311ea816125ff65050df1f3f6e (patch)
tree4365db908430747a5c08cacdb4354577b7bfead7 /drivers/serial/8250.c
parentb1c931e39327ef121797927d4b3198d370e75b9b (diff)
serial: convert early_uart to earlycon for 8250
Beacuse SERIAL_PORT_DFNS is removed from include/asm-i386/serial.h and include/asm-x86_64/serial.h. the serial8250_ports need to be probed late in serial initializing stage. the console_init=>serial8250_console_init=> register_console=>serial8250_console_setup will return -ENDEV, and console ttyS0 can not be enabled at that time. need to wait till uart_add_one_port in drivers/serial/serial_core.c to call register_console to get console ttyS0. that is too late. Make early_uart to use early_param, so uart console can be used earlier. Make it to be bootconsole with CON_BOOT flag, so can use console handover feature. and it will switch to corresponding normal serial console automatically. new command line will be: console=uart8250,io,0x3f8,9600n8 console=uart8250,mmio,0xff5e0000,115200n8 or earlycon=uart8250,io,0x3f8,9600n8 earlycon=uart8250,mmio,0xff5e0000,115200n8 it will print in very early stage: Early serial console at I/O port 0x3f8 (options '9600n8') console [uart0] enabled later for console it will print: console handover: boot [uart0] -> real [ttyS0] Signed-off-by: <yinghai.lu@sun.com> Cc: Andi Kleen <ak@suse.de> Cc: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Gerd Hoffmann <kraxel@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r--drivers/serial/8250.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index c84dab083a85..0b3ec38ae614 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2514,12 +2514,18 @@ static int __init serial8250_console_setup(struct console *co, char *options)
2514 return uart_set_options(port, co, baud, parity, bits, flow); 2514 return uart_set_options(port, co, baud, parity, bits, flow);
2515} 2515}
2516 2516
2517static int __init serial8250_console_early_setup(void)
2518{
2519 return serial8250_find_port_for_earlycon();
2520}
2521
2517static struct uart_driver serial8250_reg; 2522static struct uart_driver serial8250_reg;
2518static struct console serial8250_console = { 2523static struct console serial8250_console = {
2519 .name = "ttyS", 2524 .name = "ttyS",
2520 .write = serial8250_console_write, 2525 .write = serial8250_console_write,
2521 .device = uart_console_device, 2526 .device = uart_console_device,
2522 .setup = serial8250_console_setup, 2527 .setup = serial8250_console_setup,
2528 .early_setup = serial8250_console_early_setup,
2523 .flags = CON_PRINTBUFFER, 2529 .flags = CON_PRINTBUFFER,
2524 .index = -1, 2530 .index = -1,
2525 .data = &serial8250_reg, 2531 .data = &serial8250_reg,
@@ -2533,7 +2539,7 @@ static int __init serial8250_console_init(void)
2533} 2539}
2534console_initcall(serial8250_console_init); 2540console_initcall(serial8250_console_init);
2535 2541
2536static int __init find_port(struct uart_port *p) 2542int serial8250_find_port(struct uart_port *p)
2537{ 2543{
2538 int line; 2544 int line;
2539 struct uart_port *port; 2545 struct uart_port *port;
@@ -2546,26 +2552,6 @@ static int __init find_port(struct uart_port *p)
2546 return -ENODEV; 2552 return -ENODEV;
2547} 2553}
2548 2554
2549int __init serial8250_start_console(struct uart_port *port, char *options)
2550{
2551 int line;
2552
2553 line = find_port(port);
2554 if (line < 0)
2555 return -ENODEV;
2556
2557 add_preferred_console("ttyS", line, options);
2558 printk("Adding console on ttyS%d at %s 0x%lx (options '%s')\n",
2559 line, port->iotype == UPIO_MEM ? "MMIO" : "I/O port",
2560 port->iotype == UPIO_MEM ? (unsigned long) port->mapbase :
2561 (unsigned long) port->iobase, options);
2562 if (!(serial8250_console.flags & CON_ENABLED)) {
2563 serial8250_console.flags &= ~CON_PRINTBUFFER;
2564 register_console(&serial8250_console);
2565 }
2566 return line;
2567}
2568
2569#define SERIAL8250_CONSOLE &serial8250_console 2555#define SERIAL8250_CONSOLE &serial8250_console
2570#else 2556#else
2571#define SERIAL8250_CONSOLE NULL 2557#define SERIAL8250_CONSOLE NULL