aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/amba-pl010.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-pl010.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-pl010.c')
-rw-r--r--drivers/serial/amba-pl010.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 321a3b3a5728..e04d5e82d9ae 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -591,12 +591,18 @@ static struct uart_amba_port amba_ports[UART_NR] = {
591 591
592#ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE 592#ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
593 593
594static void pl010_console_putchar(struct uart_port *port, int ch)
595{
596 while (!UART_TX_READY(UART_GET_FR(port)))
597 barrier();
598 UART_PUT_CHAR(port, ch);
599}
600
594static void 601static void
595pl010_console_write(struct console *co, const char *s, unsigned int count) 602pl010_console_write(struct console *co, const char *s, unsigned int count)
596{ 603{
597 struct uart_port *port = &amba_ports[co->index].port; 604 struct uart_port *port = &amba_ports[co->index].port;
598 unsigned int status, old_cr; 605 unsigned int status, old_cr;
599 int i;
600 606
601 /* 607 /*
602 * First save the CR then disable the interrupts 608 * First save the CR then disable the interrupts
@@ -604,21 +610,7 @@ pl010_console_write(struct console *co, const char *s, unsigned int count)
604 old_cr = UART_GET_CR(port); 610 old_cr = UART_GET_CR(port);
605 UART_PUT_CR(port, UART01x_CR_UARTEN); 611 UART_PUT_CR(port, UART01x_CR_UARTEN);
606 612
607 /* 613 uart_console_write(port, s, count, pl010_console_putchar);
608 * Now, do each character
609 */
610 for (i = 0; i < count; i++) {
611 do {
612 status = UART_GET_FR(port);
613 } while (!UART_TX_READY(status));
614 UART_PUT_CHAR(port, s[i]);
615 if (s[i] == '\n') {
616 do {
617 status = UART_GET_FR(port);
618 } while (!UART_TX_READY(status));
619 UART_PUT_CHAR(port, '\r');
620 }
621 }
622 614
623 /* 615 /*
624 * Finally, wait for transmitter to become empty 616 * Finally, wait for transmitter to become empty