linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / serial / amba-pl011.c
index a8d7124..034a029 100644 (file)
@@ -31,6 +31,7 @@
  * required, these have to be supplied via some other means (eg, GPIO)
  * and hooked into this driver.
  */
+#include <linux/config.h>
 
 #if defined(CONFIG_SERIAL_AMBA_PL011_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 #define SUPPORT_SYSRQ
@@ -586,12 +587,14 @@ static struct uart_amba_port *amba_ports[UART_NR];
 
 #ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE
 
-static void pl011_console_putchar(struct uart_port *port, int ch)
+static inline void
+pl011_console_write_char(struct uart_amba_port *uap, char ch)
 {
-       struct uart_amba_port *uap = (struct uart_amba_port *)port;
+       unsigned int status;
 
-       while (readw(uap->port.membase + UART01x_FR) & UART01x_FR_TXFF)
-               barrier();
+       do {
+               status = readw(uap->port.membase + UART01x_FR);
+       } while (status & UART01x_FR_TXFF);
        writew(ch, uap->port.membase + UART01x_DR);
 }
 
@@ -600,6 +603,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
 {
        struct uart_amba_port *uap = amba_ports[co->index];
        unsigned int status, old_cr, new_cr;
+       int i;
 
        clk_enable(uap->clk);
 
@@ -611,7 +615,14 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
        new_cr |= UART01x_CR_UARTEN | UART011_CR_TXE;
        writew(new_cr, uap->port.membase + UART011_CR);
 
-       uart_console_write(&uap->port, s, count, pl011_console_putchar);
+       /*
+        *      Now, do each character
+        */
+       for (i = 0; i < count; i++) {
+               pl011_console_write_char(uap, s[i]);
+               if (s[i] == '\n')
+                       pl011_console_write_char(uap, '\r');
+       }
 
        /*
         *      Finally, wait for transmitter to become empty