1 From 4d3c17975c7814884a721fe693b3adf5c426d759 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Tue, 10 Nov 2015 22:18:39 +0100
4 Subject: [RFC] serial: core: add support for boot console with arbitrary
7 The Arduino Yun uses a baud rate of 250000 by default. The serial is
8 going over the Atmel ATmega and is used to connect to this chip.
9 Without this patch Linux wants to switch the console to 230400 Baud.
11 With this patch Linux will use the configured baud rate and not some
12 standard one which is near by.
14 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
16 drivers/tty/serial/serial_core.c | 13 ++++++++++---
17 include/linux/console.h | 1 +
18 2 files changed, 11 insertions(+), 3 deletions(-)
20 --- a/drivers/tty/serial/serial_core.c
21 +++ b/drivers/tty/serial/serial_core.c
22 @@ -164,6 +164,8 @@ static int uart_port_startup(struct tty_
24 if (uart_console(uport) && uport->cons->cflag) {
25 tty->termios.c_cflag = uport->cons->cflag;
26 + tty->termios.c_ospeed = uport->cons->baud;
27 + tty->termios.c_ispeed = uport->cons->baud;
28 uport->cons->cflag = 0;
31 @@ -1909,7 +1911,7 @@ static const struct baud_rates baud_rate
40 @@ -1948,10 +1950,13 @@ uart_set_options(struct uart_port *port,
41 * Construct a cflag setting.
43 for (i = 0; baud_rates[i].rate; i++)
44 - if (baud_rates[i].rate <= baud)
45 + if (baud_rates[i].rate == baud)
48 termios.c_cflag |= baud_rates[i].cflag;
49 + if (!baud_rates[i].rate) {
50 + termios.c_ospeed = baud;
54 termios.c_cflag |= CS7;
55 @@ -1981,8 +1986,10 @@ uart_set_options(struct uart_port *port,
56 * Allow the setting of the UART parameters with a NULL console
61 co->cflag = termios.c_cflag;
67 --- a/include/linux/console.h
68 +++ b/include/linux/console.h
69 @@ -128,6 +128,7 @@ struct console {