uclient: update to Git HEAD (2024-04-18)
[openwrt/openwrt.git] / target / linux / ath79 / patches-5.4 / 921-serial-core-add-support-for-boot-console-with-arbitr.patch
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
5 baud rates
6
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 9600 Baud.
10
11 With this patch Linux will use the configured baud rate and not a
12 default one specified in uart_register_driver().
13
14 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
15 [rebased to 4.14, slightly reworded commit message]
16 Signed-off-by: Sungbo Eo <mans0n@gorani.run>
17 ---
18 drivers/tty/serial/serial_core.c | 6 +++++-
19 include/linux/console.h | 1 +
20 2 files changed, 6 insertions(+), 1 deletions(-)
21
22 --- a/drivers/tty/serial/serial_core.c
23 +++ b/drivers/tty/serial/serial_core.c
24 @@ -220,6 +220,8 @@ static int uart_port_startup(struct tty_
25 if (retval == 0) {
26 if (uart_console(uport) && uport->cons->cflag) {
27 tty->termios.c_cflag = uport->cons->cflag;
28 + tty->termios.c_ospeed = uport->cons->baud;
29 + tty->termios.c_ispeed = uport->cons->baud;
30 uport->cons->cflag = 0;
31 }
32 /*
33 @@ -2108,8 +2110,10 @@ uart_set_options(struct uart_port *port,
34 * Allow the setting of the UART parameters with a NULL console
35 * too:
36 */
37 - if (co)
38 + if (co) {
39 co->cflag = termios.c_cflag;
40 + co->baud = baud;
41 + }
42
43 return 0;
44 }
45 --- a/include/linux/console.h
46 +++ b/include/linux/console.h
47 @@ -153,6 +153,7 @@ struct console {
48 short flags;
49 short index;
50 int cflag;
51 + int baud;
52 void *data;
53 struct console *next;
54 };