* [PATCH][SERIAL] Drop probe_baud() and default to "9600n8"
@ 2008-10-07 11:06 Paul Bolle
2008-10-07 11:15 ` Alan Cox
0 siblings, 1 reply; 2+ messages in thread
From: Paul Bolle @ 2008-10-07 11:06 UTC (permalink / raw)
To: linux-kernel
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",
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][SERIAL] Drop probe_baud() and default to "9600n8"
2008-10-07 11:06 [PATCH][SERIAL] Drop probe_baud() and default to "9600n8" Paul Bolle
@ 2008-10-07 11:15 ` Alan Cox
0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2008-10-07 11:15 UTC (permalink / raw)
To: Paul Bolle; +Cc: linux-kernel
On Tue, 07 Oct 2008 13:06:26 +0200
Paul Bolle <pebolle@tiscali.nl> wrote:
> 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.
That depends a lot on the system.
> 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
Depends on what the firmware has done. When the firmware has set the port
up as is common in embedded then it is a very useful option to continue
with the rates currently in use.
> probe_baud() and simply use "9600n8" as (safe) defaults for
> baud/parity/bits.
I don't plan to apply this change. If you can figure out a reliable way
to decide a port is uninitialised and default to 9600 in that case then
that would be interesting.
Alan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-07 11:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-07 11:06 [PATCH][SERIAL] Drop probe_baud() and default to "9600n8" Paul Bolle
2008-10-07 11:15 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®