From: 黄涛 Date: Thu, 13 Jan 2011 08:50:50 +0000 (+0800) Subject: serial: rk29: rk29_console_setup add clear rx fifo X-Git-Tag: firefly_0821_release~10812 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c158e9a5b00edc6abfbfeab31236e382ae59bbc0;p=firefly-linux-kernel-4.4.55.git serial: rk29: rk29_console_setup add clear rx fifo --- diff --git a/drivers/serial/rk29_serial.c b/drivers/serial/rk29_serial.c index bd1fe6b515c7..8d896509cc7a 100755 --- a/drivers/serial/rk29_serial.c +++ b/drivers/serial/rk29_serial.c @@ -40,7 +40,7 @@ #if 0 #define DBG printk #else -#define DBG +#define DBG(...) #endif /* * We wrap our port structure around the generic uart_port. @@ -630,6 +630,10 @@ static int __init rk29_console_setup(struct console *co, char *options) printk(KERN_INFO "rk29_serial: console setup on port %d\n", port->line); + /* clear rx fifo, else will blocked on set_termios (always busy) */ + while ((rk29_uart_read(port, UART_USR) & UART_RECEIVE_FIFO_NOT_EMPTY) == UART_RECEIVE_FIFO_NOT_EMPTY) + rk29_uart_read(port, UART_RBR); + return uart_set_options(port, co, baud, parity, bits, flow); }