]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/serial/sh-sci.c
sh: Add support for SH7786 CPU subtype.
[linux-2.6-omap-h63xx.git] / drivers / serial / sh-sci.c
index cf663b718697bc5578015654f2ac985051e0176e..dbf5357a77b30e1678e268a485ae51e98c3eb7ce 100644 (file)
@@ -99,6 +99,8 @@ to_sci_port(struct uart_port *uart)
 }
 
 #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE)
+
+#ifdef CONFIG_CONSOLE_POLL
 static inline void handle_error(struct uart_port *port)
 {
        /* Clear error flags */
@@ -126,6 +128,7 @@ static int sci_poll_get_char(struct uart_port *port)
 
        return c;
 }
+#endif
 
 static void sci_poll_put_char(struct uart_port *port, unsigned char c)
 {
@@ -136,7 +139,7 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c)
        } while (!(status & SCxSR_TDxE(port)));
 
        sci_in(port, SCxSR);            /* Dummy read */
-       sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
+       sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port));
        sci_out(port, SCxTDR, c);
 }
 #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
@@ -260,13 +263,14 @@ static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
 #elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
       defined(CONFIG_CPU_SUBTYPE_SH7780) || \
       defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+      defined(CONFIG_CPU_SUBTYPE_SH7786) || \
       defined(CONFIG_CPU_SUBTYPE_SHX3)
 static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
 {
        if (!(cflag & CRTSCTS))
                __raw_writew(0x0080, SCSPTR0); /* Set RTS = 1 */
 }
-#elif defined(CONFIG_CPU_SH4)
+#elif defined(CONFIG_CPU_SH4) && !defined(CONFIG_CPU_SH4A)
 static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
 {
        if (!(cflag & CRTSCTS))
@@ -281,7 +285,8 @@ static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
     defined(CONFIG_CPU_SUBTYPE_SH7780) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7785)
+    defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7786)
 static inline int scif_txroom(struct uart_port *port)
 {
        return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff);
@@ -1092,6 +1097,7 @@ static void serial_console_write(struct console *co, const char *s,
                                 unsigned count)
 {
        struct uart_port *port = &serial_console_port->port;
+       unsigned short bits;
        int i;
 
        for (i = 0; i < count; i++) {
@@ -1100,6 +1106,11 @@ static void serial_console_write(struct console *co, const char *s,
 
                sci_poll_put_char(port, *s++);
        }
+
+       /* wait until fifo is empty and last bit has been transmitted */
+       bits = SCxSR_TDxE(port) | SCxSR_TEND(port);
+       while ((sci_in(port, SCxSR) & bits) != bits)
+               cpu_relax();
 }
 
 static int __init serial_console_setup(struct console *co, char *options)