lkml.org 
[lkml]   [2008]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH][SERIAL] Drop probe_baud() and default to "9600n8"
From
Date
The early console kernel parameters (i.e. "console=uart[...]" and
"earlycon=uart[...]" allow to omit the baud/parity/bits option. If that
option is not provided probe_baud() is used to determine the baud rate
to be used by that early console.

I noticed that probe_baud() produced useless and/or unpredictable
results on the few machines I tested the early console parameters (e.g.
1355 or 1200 and 115200 alternating). My guess is that this is because
probe_baud() tries to calculate the baud rate from information retrieved
while that UART is not yet properly initialized. Anyhow, a safe
alternative would be to not probe for a baud rate but simply use
"9600n8" as defaults for baud/parity/bits. See patch below.


Paul Bolle
---
From: Paul Bolle <pebolle@tiscali.nl>

If no baud/parity/bits triplet is provided on the commandline for an
early serial console, parse_options() will call probe_baud() to
determine the baud rate used by that early console. probe_baud() seems
to generate useless and/or unpredictable results. Solution is to drop
probe_baud() and simply use "9600n8" as (safe) defaults for
baud/parity/bits.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c
index f279745..b810430 100644
--- a/drivers/serial/8250_early.c
+++ b/drivers/serial/8250_early.c
@@ -99,21 +99,6 @@ static void __init early_serial8250_write(struct console *console,
serial_out(port, UART_IER, ier);
}

-static unsigned int __init probe_baud(struct uart_port *port)
-{
- unsigned char lcr, dll, dlm;
- unsigned int quot;
-
- lcr = serial_in(port, UART_LCR);
- serial_out(port, UART_LCR, lcr | UART_LCR_DLAB);
- dll = serial_in(port, UART_DLL);
- dlm = serial_in(port, UART_DLM);
- serial_out(port, UART_LCR, lcr);
-
- quot = (dlm << 8) | dll;
- return (port->uartclk / 16) / quot;
-}
-
static void __init init_port(struct early_serial8250_device *device)
{
struct uart_port *port = &device->port;
@@ -176,9 +161,8 @@ static int __init parse_options(struct early_serial8250_device *device,
length = min(strcspn(options, " "), sizeof(device->options));
strncpy(device->options, options, length);
} else {
- device->baud = probe_baud(port);
- snprintf(device->options, sizeof(device->options), "%u",
- device->baud);
+ device->baud = 9600;
+ strcpy(device->options, "9600n8");
}

printk(KERN_INFO "Early serial console at %s 0x%llx (options '%s')\n",



\
 
 \ /
  Last update: 2008-10-07 13:09    [W:0.044 / U:20.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site