[openwrt/openwrt] ar71xx: restore support for boot console with arbitrary baud rates

LEDE Commits lede-commits at lists.infradead.org
Sun Aug 2 12:11:19 EDT 2020


adrian pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/c90db26e051e4f0e7cd32333b3bd8c94a13d599a

commit c90db26e051e4f0e7cd32333b3bd8c94a13d599a
Author: Sungbo Eo <mans0n at gorani.run>
AuthorDate: Sun Jan 12 21:35:00 2020 +0900

    ar71xx: restore support for boot console with arbitrary baud rates
    
    Commit 1bfbf2de6df9 ("ar71xx: serial: core: add support for boot console
    with arbitrary baud rates") added support for arbitrary baud rates which
    enabled 250000 baud rate for Yun. But the patch was not ported to kernel
    4.9, and since then the kernel set its baud rate to 9600. This commit ports
    the patch to kernel 4.14, thereby restoring the serial console of Yun.
    
    Cc: Hauke Mehrtens <hauke at hauke-m.de>
    Signed-off-by: Sungbo Eo <mans0n at gorani.run>
---
 ...-add-support-for-boot-console-with-arbitr.patch | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/target/linux/ar71xx/patches-4.14/821-serial-core-add-support-for-boot-console-with-arbitr.patch b/target/linux/ar71xx/patches-4.14/821-serial-core-add-support-for-boot-console-with-arbitr.patch
new file mode 100644
index 0000000000..23b6d73959
--- /dev/null
+++ b/target/linux/ar71xx/patches-4.14/821-serial-core-add-support-for-boot-console-with-arbitr.patch
@@ -0,0 +1,54 @@
+From 4d3c17975c7814884a721fe693b3adf5c426d759 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke at hauke-m.de>
+Date: Tue, 10 Nov 2015 22:18:39 +0100
+Subject: [RFC] serial: core: add support for boot console with arbitrary
+ baud rates
+
+The Arduino Yun uses a baud rate of 250000 by default. The serial is
+going over the Atmel ATmega and is used to connect to this chip.
+Without this patch Linux wants to switch the console to 9600 Baud.
+
+With this patch Linux will use the configured baud rate and not a
+default one specified in uart_register_driver().
+
+Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
+[rebased to 4.14, slightly reworded commit message]
+Signed-off-by: Sungbo Eo <mans0n at gorani.run>
+---
+ drivers/tty/serial/serial_core.c | 6 +++++-
+ include/linux/console.h          | 1 +
+ 2 files changed, 6 insertions(+), 1 deletions(-)
+
+--- a/drivers/tty/serial/serial_core.c
++++ b/drivers/tty/serial/serial_core.c
+@@ -232,6 +232,8 @@ static int uart_port_startup(struct tty_
+ 	if (retval == 0) {
+ 		if (uart_console(uport) && uport->cons->cflag) {
+ 			tty->termios.c_cflag = uport->cons->cflag;
++			tty->termios.c_ospeed = uport->cons->baud;
++			tty->termios.c_ispeed = uport->cons->baud;
+ 			uport->cons->cflag = 0;
+ 		}
+ 		/*
+@@ -2072,8 +2074,10 @@ uart_set_options(struct uart_port *port,
+ 	 * Allow the setting of the UART parameters with a NULL console
+ 	 * too:
+ 	 */
+-	if (co)
++	if (co) {
+ 		co->cflag = termios.c_cflag;
++		co->baud = baud;
++	}
+ 
+ 	return 0;
+ }
+--- a/include/linux/console.h
++++ b/include/linux/console.h
+@@ -145,6 +145,7 @@ struct console {
+ 	short	flags;
+ 	short	index;
+ 	int	cflag;
++	int	baud;
+ 	void	*data;
+ 	struct	 console *next;
+ };



More information about the lede-commits mailing list