aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sa1100.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/sa1100.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/sa1100.c')
-rw-r--r--drivers/serial/sa1100.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 2c00b8625852..c2d9068b491d 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -689,6 +689,14 @@ void __init sa1100_register_uart(int idx, int port)
689 689
690 690
691#ifdef CONFIG_SERIAL_SA1100_CONSOLE 691#ifdef CONFIG_SERIAL_SA1100_CONSOLE
692static void sa1100_console_putchar(struct uart_port *port, int ch)
693{
694 struct sa1100_port *sport = (struct sa1100_port *)port;
695
696 while (!(UART_GET_UTSR1(sport) & UTSR1_TNF))
697 barrier();
698 UART_PUT_CHAR(sport, ch);
699}
692 700
693/* 701/*
694 * Interrupts are disabled on entering 702 * Interrupts are disabled on entering
@@ -697,7 +705,7 @@ static void
697sa1100_console_write(struct console *co, const char *s, unsigned int count) 705sa1100_console_write(struct console *co, const char *s, unsigned int count)
698{ 706{
699 struct sa1100_port *sport = &sa1100_ports[co->index]; 707 struct sa1100_port *sport = &sa1100_ports[co->index];
700 unsigned int old_utcr3, status, i; 708 unsigned int old_utcr3, status;
701 709
702 /* 710 /*
703 * First, save UTCR3 and then disable interrupts 711 * First, save UTCR3 and then disable interrupts
@@ -706,21 +714,7 @@ sa1100_console_write(struct console *co, const char *s, unsigned int count)
706 UART_PUT_UTCR3(sport, (old_utcr3 & ~(UTCR3_RIE | UTCR3_TIE)) | 714 UART_PUT_UTCR3(sport, (old_utcr3 & ~(UTCR3_RIE | UTCR3_TIE)) |
707 UTCR3_TXE); 715 UTCR3_TXE);
708 716
709 /* 717 uart_console_write(&sport->port, s, count, sa1100_console_putchar);
710 * Now, do each character
711 */
712 for (i = 0; i < count; i++) {
713 do {
714 status = UART_GET_UTSR1(sport);
715 } while (!(status & UTSR1_TNF));
716 UART_PUT_CHAR(sport, s[i]);
717 if (s[i] == '\n') {
718 do {
719 status = UART_GET_UTSR1(sport);
720 } while (!(status & UTSR1_TNF));
721 UART_PUT_CHAR(sport, '\r');
722 }
723 }
724 718
725 /* 719 /*
726 * Finally, wait for transmitter to become empty 720 * Finally, wait for transmitter to become empty