aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/meson_uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/meson_uart.c')
-rw-r--r--drivers/tty/serial/meson_uart.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 07c0f98be3ac..daafe60175da 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -1,19 +1,14 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Based on meson_uart.c, by AMLOGIC, INC. 3 * Based on meson_uart.c, by AMLOGIC, INC.
3 * 4 *
4 * Copyright (C) 2014 Carlo Caione <carlo@caione.org> 5 * Copyright (C) 2014 Carlo Caione <carlo@caione.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */ 6 */
16 7
8#if defined(CONFIG_SERIAL_MESON_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
9#define SUPPORT_SYSRQ
10#endif
11
17#include <linux/clk.h> 12#include <linux/clk.h>
18#include <linux/console.h> 13#include <linux/console.h>
19#include <linux/delay.h> 14#include <linux/delay.h>
@@ -183,12 +178,12 @@ static void meson_receive_chars(struct uart_port *port)
183{ 178{
184 struct tty_port *tport = &port->state->port; 179 struct tty_port *tport = &port->state->port;
185 char flag; 180 char flag;
186 u32 status, ch, mode; 181 u32 ostatus, status, ch, mode;
187 182
188 do { 183 do {
189 flag = TTY_NORMAL; 184 flag = TTY_NORMAL;
190 port->icount.rx++; 185 port->icount.rx++;
191 status = readl(port->membase + AML_UART_STATUS); 186 ostatus = status = readl(port->membase + AML_UART_STATUS);
192 187
193 if (status & AML_UART_ERR) { 188 if (status & AML_UART_ERR) {
194 if (status & AML_UART_TX_FIFO_WERR) 189 if (status & AML_UART_TX_FIFO_WERR)
@@ -216,6 +211,16 @@ static void meson_receive_chars(struct uart_port *port)
216 ch = readl(port->membase + AML_UART_RFIFO); 211 ch = readl(port->membase + AML_UART_RFIFO);
217 ch &= 0xff; 212 ch &= 0xff;
218 213
214 if ((ostatus & AML_UART_FRAME_ERR) && (ch == 0)) {
215 port->icount.brk++;
216 flag = TTY_BREAK;
217 if (uart_handle_break(port))
218 continue;
219 }
220
221 if (uart_handle_sysrq_char(port, ch))
222 continue;
223
219 if ((status & port->ignore_status_mask) == 0) 224 if ((status & port->ignore_status_mask) == 0)
220 tty_insert_flip_char(tport, ch, flag); 225 tty_insert_flip_char(tport, ch, flag);
221 226
@@ -362,7 +367,7 @@ static void meson_uart_set_termios(struct uart_port *port,
362 367
363 writel(val, port->membase + AML_UART_CONTROL); 368 writel(val, port->membase + AML_UART_CONTROL);
364 369
365 baud = uart_get_baud_rate(port, termios, old, 9600, 4000000); 370 baud = uart_get_baud_rate(port, termios, old, 50, 4000000);
366 meson_uart_change_speed(port, baud); 371 meson_uart_change_speed(port, baud);
367 372
368 port->read_status_mask = AML_UART_TX_FIFO_WERR; 373 port->read_status_mask = AML_UART_TX_FIFO_WERR;