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 2113feb75c39..6547fe0cef96 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) | |||
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | #ifdef CONFIG_SERIAL_AT91_CONSOLE | 713 | #ifdef CONFIG_SERIAL_AT91_CONSOLE |
| 714 | static void at91_console_putchar(struct uart_port *port, int ch) | ||
| 715 | { | ||
| 716 | while (!(UART_GET_CSR(port) & AT91_US_TXRDY)) | ||
| 717 | barrier(); | ||
| 718 | UART_PUT_CHAR(port, ch); | ||
| 719 | } | ||
| 714 | 720 | ||
| 715 | /* | 721 | /* |
| 716 | * Interrupts are disabled on entering | 722 | * Interrupts are disabled on entering |
| @@ -718,7 +724,7 @@ void __init at91_register_uart(int idx, int port) | |||
| 718 | static void at91_console_write(struct console *co, const char *s, u_int count) | 724 | static void at91_console_write(struct console *co, const char *s, u_int count) |
| 719 | { | 725 | { |
| 720 | struct uart_port *port = at91_ports + co->index; | 726 | struct uart_port *port = at91_ports + co->index; |
| 721 | unsigned int status, i, imr; | 727 | unsigned int status, imr; |
| 722 | 728 | ||
| 723 | /* | 729 | /* |
| 724 | * First, save IMR and then disable interrupts | 730 | * 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) | |||
| 726 | imr = UART_GET_IMR(port); /* get interrupt mask */ | 732 | imr = UART_GET_IMR(port); /* get interrupt mask */ |
| 727 | UART_PUT_IDR(port, AT91_US_RXRDY | AT91_US_TXRDY); | 733 | UART_PUT_IDR(port, AT91_US_RXRDY | AT91_US_TXRDY); |
| 728 | 734 | ||
| 729 | /* | 735 | uart_console_write(port, s, count, at91_console_putchar); |
| 730 | * Now, do each character | ||
| 731 | */ | ||
| 732 | for (i = 0; i < count; i++) { | ||
| 733 | do { | ||
| 734 | status = UART_GET_CSR(port); | ||
| 735 | } while (!(status & AT91_US_TXRDY)); | ||
| 736 | UART_PUT_CHAR(port, s[i]); | ||
| 737 | if (s[i] == '\n') { | ||
| 738 | do { | ||
| 739 | status = UART_GET_CSR(port); | ||
| 740 | } while (!(status & AT91_US_TXRDY)); | ||
| 741 | UART_PUT_CHAR(port, '\r'); | ||
| 742 | } | ||
| 743 | } | ||
| 744 | 736 | ||
| 745 | /* | 737 | /* |
| 746 | * Finally, wait for transmitter to become empty | 738 | * Finally, wait for transmitter to become empty |
