serial: rk29: rk29_console_setup add clear rx fifo
author黄涛 <huangtao@rock-chips.com>
Thu, 13 Jan 2011 08:50:50 +0000 (16:50 +0800)
committer黄涛 <huangtao@rock-chips.com>
Thu, 13 Jan 2011 08:51:11 +0000 (16:51 +0800)
drivers/serial/rk29_serial.c

index bd1fe6b515c76796b8cdaf8bbc21ee9e575c76df..8d896509cc7a373218315a2f65c945eef7e94269 100755 (executable)
@@ -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);    
 }