aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@freescale.com>2013-07-08 03:05:31 -0400
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:00:36 -0400
commite9e1b6319e45d2dd853861f0c704296db21dba76 (patch)
tree699d882b0e02c11e36e310511ac54fe2adac00e6
parentec55a390d1c3b9d3580f666a0ddc1c0b81a4cd35 (diff)
serial: fsl_lpuart: restore UARTCR2 after watermark setup is done
Function lpuart_setup_watermark() clears some bits in register UARTCR2 before writing FIFO configuration registers as required by hardware. But it should restore UARTCR2 after that. Otherwise, we end up changing UARTCR2 register when setting up watermark, and that is not really desirable. At least, when low-level debug and earlyprint is enabled, serial console is broken due to it. Fix the problem by restoring UARTCR2 register at the end of function lpuart_setup_watermark(). Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
-rw-r--r--drivers/tty/serial/fsl_lpuart.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 263cfaabe9e2..7bc17f21062a 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -342,8 +342,10 @@ static void lpuart_break_ctl(struct uart_port *port, int break_state)
342static void lpuart_setup_watermark(struct lpuart_port *sport) 342static void lpuart_setup_watermark(struct lpuart_port *sport)
343{ 343{
344 unsigned char val, cr2; 344 unsigned char val, cr2;
345 unsigned char cr2_saved;
345 346
346 cr2 = readb(sport->port.membase + UARTCR2); 347 cr2 = readb(sport->port.membase + UARTCR2);
348 cr2_saved = cr2;
347 cr2 &= ~(UARTCR2_TIE | UARTCR2_TCIE | UARTCR2_TE | 349 cr2 &= ~(UARTCR2_TIE | UARTCR2_TCIE | UARTCR2_TE |
348 UARTCR2_RIE | UARTCR2_RE); 350 UARTCR2_RIE | UARTCR2_RE);
349 writeb(cr2, sport->port.membase + UARTCR2); 351 writeb(cr2, sport->port.membase + UARTCR2);
@@ -366,6 +368,9 @@ static void lpuart_setup_watermark(struct lpuart_port *sport)
366 368
367 writeb(2, sport->port.membase + UARTTWFIFO); 369 writeb(2, sport->port.membase + UARTTWFIFO);
368 writeb(1, sport->port.membase + UARTRWFIFO); 370 writeb(1, sport->port.membase + UARTRWFIFO);
371
372 /* Restore cr2 */
373 writeb(cr2_saved, sport->port.membase + UARTCR2);
369} 374}
370 375
371static int lpuart_startup(struct uart_port *port) 376static int lpuart_startup(struct uart_port *port)