diff options
Diffstat (limited to 'drivers/serial/at91_serial.c')
-rw-r--r-- | drivers/serial/at91_serial.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/serial/at91_serial.c b/drivers/serial/at91_serial.c index 2113feb..6547fe0 100644 --- a/drivers/serial/at91_serial.c +++ b/drivers/serial/at91_serial.c @@ -711,6 +711,12 @@ void __init at91_register_uart(int idx, int port) } #ifdef CONFIG_SERIAL_AT91_CONSOLE +static void at91_console_putchar(struct uart_port *port, int ch) +{ + while (!(UART_GET_CSR(port) & AT91_US_TXRDY)) + barrier(); + UART_PUT_CHAR(port, ch); +} /* * Interrupts are disabled on entering @@ -718,7 +724,7 @@ void __init at91_register_uart(int idx, int port) static void at91_console_write(struct console *co, const char *s, u_int count) { struct uart_port *port = at91_ports + co->index; - unsigned int status, i, imr; + unsigned int status, imr; /* * First, save IMR and then disable interrupts @@ -726,21 +732,7 @@ static void at91_console_write(struct console *co, const char *s, u_int count) imr = UART_GET_IMR(port); /* get interrupt mask */ UART_PUT_IDR(port, AT91_US_RXRDY | AT91_US_TXRDY); - /* - * Now, do each character - */ - for (i = 0; i < count; i++) { - do { - status = UART_GET_CSR(port); - } while (!(status & AT91_US_TXRDY)); - UART_PUT_CHAR(port, s[i]); - if (s[i] == '\n') { - do { - status = UART_GET_CSR(port); - } while (!(status & AT91_US_TXRDY)); - UART_PUT_CHAR(port, '\r'); - } - } + uart_console_write(port, s, count, at91_console_putchar); /* * Finally, wait for transmitter to become empty |