aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/amba-pl011.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-03-20 15:00:09 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-03-20 15:00:09 -0500
commitd358788f3f30113e49882187d794832905e42592 (patch)
tree8c796ee4bf719dad4d3947c03cef2f3fd6cb5940 /drivers/serial/amba-pl011.c
parent7705a8792b0fc82fd7d4dd923724606bbfd9fb20 (diff)
[SERIAL] kernel console should send CRLF not LFCR
Glen Turner reported that writing LFCR rather than the more traditional CRLF causes issues with some terminals. Since this aflicts many serial drivers, extract the common code to a library function (uart_console_write) and arrange for each driver to supply a "putchar" function. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/amba-pl011.c')
-rw-r--r--drivers/serial/amba-pl011.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 034a029e356e..3d966cfc9a38 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -587,14 +587,12 @@ static struct uart_amba_port *amba_ports[UART_NR];
587 587
588#ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE 588#ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE
589 589
590static inline void 590static void pl011_console_putchar(struct uart_port *port, int ch)
591pl011_console_write_char(struct uart_amba_port *uap, char ch)
592{ 591{
593 unsigned int status; 592 struct uart_amba_port *uap = (struct uart_amba_port *)port;
594 593
595 do { 594 while (readw(uap->port.membase + UART01x_FR) & UART01x_FR_TXFF)
596 status = readw(uap->port.membase + UART01x_FR); 595 barrier();
597 } while (status & UART01x_FR_TXFF);
598 writew(ch, uap->port.membase + UART01x_DR); 596 writew(ch, uap->port.membase + UART01x_DR);
599} 597}
600 598
@@ -603,7 +601,6 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
603{ 601{
604 struct uart_amba_port *uap = amba_ports[co->index]; 602 struct uart_amba_port *uap = amba_ports[co->index];
605 unsigned int status, old_cr, new_cr; 603 unsigned int status, old_cr, new_cr;
606 int i;
607 604
608 clk_enable(uap->clk); 605 clk_enable(uap->clk);
609 606
@@ -615,14 +612,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
615 new_cr |= UART01x_CR_UARTEN | UART011_CR_TXE; 612 new_cr |= UART01x_CR_UARTEN | UART011_CR_TXE;
616 writew(new_cr, uap->port.membase + UART011_CR); 613 writew(new_cr, uap->port.membase + UART011_CR);
617 614
618 /* 615 uart_console_write(&uap->port, s, count, pl011_console_putchar);
619 * Now, do each character
620 */
621 for (i = 0; i < count; i++) {
622 pl011_console_write_char(uap, s[i]);
623 if (s[i] == '\n')
624 pl011_console_write_char(uap, '\r');
625 }
626 616
627 /* 617 /*
628 * Finally, wait for transmitter to become empty 618 * Finally, wait for transmitter to become empty