921-serial-core-add-support-for-boot-console-with-arbitr.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From 4d3c17975c7814884a721fe693b3adf5c426d759 Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <[email protected]>
  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. The Arduino Yun uses a baud rate of 250000 by default. The serial is
  7. going over the Atmel ATmega and is used to connect to this chip.
  8. Without this patch Linux wants to switch the console to 9600 Baud.
  9. With this patch Linux will use the configured baud rate and not a
  10. default one specified in uart_register_driver().
  11. Signed-off-by: Hauke Mehrtens <[email protected]>
  12. [rebased to 4.14, slightly reworded commit message]
  13. Signed-off-by: Sungbo Eo <[email protected]>
  14. ---
  15. drivers/tty/serial/serial_core.c | 6 +++++-
  16. include/linux/console.h | 1 +
  17. 2 files changed, 6 insertions(+), 1 deletions(-)
  18. --- a/drivers/tty/serial/serial_core.c
  19. +++ b/drivers/tty/serial/serial_core.c
  20. @@ -220,6 +220,8 @@ static int uart_port_startup(struct tty_
  21. if (retval == 0) {
  22. if (uart_console(uport) && uport->cons->cflag) {
  23. tty->termios.c_cflag = uport->cons->cflag;
  24. + tty->termios.c_ospeed = uport->cons->baud;
  25. + tty->termios.c_ispeed = uport->cons->baud;
  26. uport->cons->cflag = 0;
  27. }
  28. /*
  29. @@ -2108,8 +2110,10 @@ uart_set_options(struct uart_port *port,
  30. * Allow the setting of the UART parameters with a NULL console
  31. * too:
  32. */
  33. - if (co)
  34. + if (co) {
  35. co->cflag = termios.c_cflag;
  36. + co->baud = baud;
  37. + }
  38. return 0;
  39. }
  40. --- a/include/linux/console.h
  41. +++ b/include/linux/console.h
  42. @@ -153,6 +153,7 @@ struct console {
  43. short flags;
  44. short index;
  45. int cflag;
  46. + int baud;
  47. void *data;
  48. struct console *next;
  49. };