[TCP]: Avoid clearing sacktag hint in trivial situations
[safe/jmp/linux-2.6] / drivers / serial / sh-sci.c
index 94deebd..053fca4 100644 (file)
@@ -12,6 +12,7 @@
  *   Modified to support multiple serial ports. Stuart Menefy (May 2000).
  *   Modified to support SecureEdge. David McCullough (2002)
  *   Modified to support SH7300 SCIF. Takashi Kusuda (Jun 2003).
+ *   Removed SH7300 support (Jul 2007).
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -77,6 +78,11 @@ struct sci_port {
        /* Break timer */
        struct timer_list       break_timer;
        int                     break_flag;
+
+#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
+       /* Port clock */
+       struct clk              *clk;
+#endif
 };
 
 #ifdef CONFIG_SH_KGDB
@@ -284,11 +290,16 @@ static void sci_init_pins_irda(struct uart_port *port, unsigned int cflag)
 #endif
 
 #if defined(SCIF_ONLY) || defined(SCI_AND_SCIF)
-#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710)
-/* SH7300 doesn't use RTS/CTS */
-static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
+#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+static void sci_init_pins_scif(struct uart_port* port, unsigned int cflag)
 {
-       sci_out(port, SCFCR, 0);
+       unsigned int fcr_val = 0;
+
+       set_sh771x_scif_pfc(port);
+       if (cflag & CRTSCTS) {
+               fcr_val |= SCFCR_MCE;
+       }
+       sci_out(port, SCFCR, fcr_val);
 }
 #elif defined(CONFIG_CPU_SH3)
 /* For SH7705, SH7706, SH7707, SH7709, SH7709A, SH7729 */
@@ -351,7 +362,9 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
        } else {
 #ifdef CONFIG_CPU_SUBTYPE_SH7343
                /* Nothing */
-#elif defined(CONFIG_CPU_SUBTYPE_SH7780) || defined(CONFIG_CPU_SUBTYPE_SH7785)
+#elif defined(CONFIG_CPU_SUBTYPE_SH7780) || \
+      defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+      defined(CONFIG_CPU_SUBTYPE_SHX3)
                ctrl_outw(0x0080, SCSPTR0); /* Set RTS = 1 */
 #else
                ctrl_outw(0x0080, SCSPTR2); /* Set RTS = 1 */
@@ -738,12 +751,6 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr)
 
        /* Handle BREAKs */
        sci_handle_breaks(port);
-
-#ifdef CONFIG_SH_KGDB
-       /* Break into the debugger if a break is detected */
-       breakpoint();
-#endif
-
        sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port));
 
        return IRQ_HANDLED;
@@ -950,6 +957,10 @@ static int sci_startup(struct uart_port *port)
        if (s->enable)
                s->enable(port);
 
+#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
+       s->clk = clk_get(NULL, "module_clk");
+#endif
+
        sci_request_irq(s);
        sci_start_tx(port);
        sci_start_rx(port, 1);
@@ -967,6 +978,11 @@ static void sci_shutdown(struct uart_port *port)
 
        if (s->disable)
                s->disable(port);
+
+#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
+       clk_put(s->clk);
+       s->clk = NULL;
+#endif
 }
 
 static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
@@ -985,9 +1001,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
                default:
                {
 #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
-                       struct clk *clk = clk_get(NULL, "module_clk");
-                       t = SCBRR_VALUE(baud, clk_get_rate(clk));
-                       clk_put(clk);
+                       t = SCBRR_VALUE(baud, clk_get_rate(s->clk));
 #else
                        t = SCBRR_VALUE(baud);
 #endif
@@ -1220,6 +1234,11 @@ static int __init serial_console_setup(struct console *co, char *options)
 
        port->type = serial_console_port->type;
 
+#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
+       if (!serial_console_port->clk)
+               serial_console_port->clk = clk_get(NULL, "module_clk");
+#endif
+
        if (port->flags & UPF_IOREMAP)
                sci_config_port(port, 0);