Pull asus into release branch
[pandora-kernel.git] / drivers / serial / sh-sci.c
index f336ba6..46c40bb 100644 (file)
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  */
+#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
 
 #undef DEBUG
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/timer.h>
 #endif
 
 #include <asm/sci.h>
-
-#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-#define SUPPORT_SYSRQ
-#endif
-
 #include "sh-sci.h"
 
 struct sci_port {
@@ -320,6 +317,28 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
 
        sci_out(port, SCFCR, fcr_val);
 }
+#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
+static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
+{
+       unsigned int fcr_val = 0;
+
+       if (cflag & CRTSCTS) {
+               fcr_val |= SCFCR_MCE;
+
+               ctrl_outw(0x0000, PORT_PSCR);
+       } else {
+               unsigned short data;
+
+               data = ctrl_inw(PORT_PSCR);
+               data &= 0x033f;
+               data |= 0x0400;
+               ctrl_outw(data, PORT_PSCR);
+
+               ctrl_outw(ctrl_inw(SCSPTR0) & 0x17, SCSPTR0);
+       }
+
+       sci_out(port, SCFCR, fcr_val);
+}
 #else
 /* For SH7750 */
 static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
@@ -447,8 +466,7 @@ static void sci_transmit_chars(struct uart_port *port)
 /* On SH3, SCIF may read end-of-break as a space->mark char */
 #define STEPFN(c)  ({int __c=(c); (((__c-1)|(__c)) == -1); })
 
-static inline void sci_receive_chars(struct uart_port *port,
-                                    struct pt_regs *regs)
+static inline void sci_receive_chars(struct uart_port *port)
 {
        struct sci_port *sci_port = (struct sci_port *)port;
        struct tty_struct *tty = port->info->tty;
@@ -477,7 +495,7 @@ static inline void sci_receive_chars(struct uart_port *port,
 
                if (port->type == PORT_SCI) {
                        char c = sci_in(port, SCxRDR);
-                       if (uart_handle_sysrq_char(port, c, regs) || sci_port->break_flag)
+                       if (uart_handle_sysrq_char(port, c) || sci_port->break_flag)
                                count = 0;
                        else {
                                tty_insert_flip_char(tty, c, TTY_NORMAL);
@@ -505,7 +523,7 @@ static inline void sci_receive_chars(struct uart_port *port,
                                        }
                                }
 #endif /* CONFIG_CPU_SH3 */
-                               if (uart_handle_sysrq_char(port, c, regs)) {
+                               if (uart_handle_sysrq_char(port, c)) {
                                        count--; i--;
                                        continue;
                                }
@@ -625,6 +643,9 @@ static inline int sci_handle_breaks(struct uart_port *port)
        struct tty_struct *tty = port->info->tty;
        struct sci_port *s = &sci_ports[port->line];
 
+       if (uart_handle_break(port))
+               return 0;
+
        if (!s->break_flag && status & SCxSR_BRK(port)) {
 #if defined(CONFIG_CPU_SH3)
                /* Debounce break */
@@ -653,18 +674,18 @@ static inline int sci_handle_breaks(struct uart_port *port)
        return copied;
 }
 
-static irqreturn_t sci_rx_interrupt(int irq, void *port, struct pt_regs *regs)
+static irqreturn_t sci_rx_interrupt(int irq, void *port)
 {
        /* I think sci_receive_chars has to be called irrespective
         * of whether the I_IXOFF is set, otherwise, how is the interrupt
         * to be disabled?
         */
-       sci_receive_chars(port, regs);
+       sci_receive_chars(port);
 
        return IRQ_HANDLED;
 }
 
-static irqreturn_t sci_tx_interrupt(int irq, void *ptr, struct pt_regs *regs)
+static irqreturn_t sci_tx_interrupt(int irq, void *ptr)
 {
        struct uart_port *port = ptr;
 
@@ -675,7 +696,7 @@ static irqreturn_t sci_tx_interrupt(int irq, void *ptr, struct pt_regs *regs)
        return IRQ_HANDLED;
 }
 
-static irqreturn_t sci_er_interrupt(int irq, void *ptr, struct pt_regs *regs)
+static irqreturn_t sci_er_interrupt(int irq, void *ptr)
 {
        struct uart_port *port = ptr;
 
@@ -697,18 +718,18 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr, struct pt_regs *regs)
                        pr_debug("scif: overrun error\n");
                }
 #endif
-               sci_rx_interrupt(irq, ptr, regs);
+               sci_rx_interrupt(irq, ptr);
        }
 
        sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port));
 
        /* Kick the transmission */
-       sci_tx_interrupt(irq, ptr, regs);
+       sci_tx_interrupt(irq, ptr);
 
        return IRQ_HANDLED;
 }
 
-static irqreturn_t sci_br_interrupt(int irq, void *ptr, struct pt_regs *regs)
+static irqreturn_t sci_br_interrupt(int irq, void *ptr)
 {
        struct uart_port *port = ptr;
 
@@ -725,7 +746,7 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr, struct pt_regs *regs)
        return IRQ_HANDLED;
 }
 
-static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr, struct pt_regs *regs)
+static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
 {
         unsigned short ssr_status, scr_status;
         struct uart_port *port = ptr;
@@ -735,16 +756,16 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr, struct pt_regs *regs)
 
        /* Tx Interrupt */
         if ((ssr_status & 0x0020) && (scr_status & 0x0080))
-                sci_tx_interrupt(irq, ptr, regs);
+                sci_tx_interrupt(irq, ptr);
        /* Rx Interrupt */
         if ((ssr_status & 0x0002) && (scr_status & 0x0040))
-                sci_rx_interrupt(irq, ptr, regs);
+                sci_rx_interrupt(irq, ptr);
        /* Error Interrupt */
         if ((ssr_status & 0x0080) && (scr_status & 0x0400))
-                sci_er_interrupt(irq, ptr, regs);
+                sci_er_interrupt(irq, ptr);
        /* Break Interrupt */
         if ((ssr_status & 0x0010) && (scr_status & 0x0200))
-                sci_br_interrupt(irq, ptr, regs);
+                sci_br_interrupt(irq, ptr);
 
        return IRQ_HANDLED;
 }
@@ -777,7 +798,7 @@ static int sci_notifier(struct notifier_block *self,
                         *
                         * Clean this up later..
                         */
-                       clk = clk_get("module_clk");
+                       clk = clk_get(NULL, "module_clk");
                        port->uartclk = clk_get_rate(clk) * 16;
                        clk_put(clk);
                }
@@ -796,7 +817,7 @@ static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 };
 static int sci_request_irq(struct sci_port *port)
 {
        int i;
-       irqreturn_t (*handlers[4])(int irq, void *ptr, struct pt_regs *regs) = {
+       irqreturn_t (*handlers[4])(int irq, void *ptr) = {
                sci_er_interrupt, sci_rx_interrupt, sci_tx_interrupt,
                sci_br_interrupt,
        };
@@ -810,7 +831,7 @@ static int sci_request_irq(struct sci_port *port)
                }
 
                if (request_irq(port->irqs[0], sci_mpxed_interrupt,
-                               SA_INTERRUPT, "sci", port)) {
+                               IRQF_DISABLED, "sci", port)) {
                        printk(KERN_ERR "sci: Cannot allocate irq.\n");
                        return -ENODEV;
                }
@@ -819,7 +840,7 @@ static int sci_request_irq(struct sci_port *port)
                        if (!port->irqs[i])
                                continue;
                        if (request_irq(port->irqs[i], handlers[i],
-                                       SA_INTERRUPT, desc[i], port)) {
+                                       IRQF_DISABLED, desc[i], port)) {
                                printk(KERN_ERR "sci: Cannot allocate irq.\n");
                                return -ENODEV;
                        }
@@ -945,8 +966,8 @@ static void sci_shutdown(struct uart_port *port)
                s->disable(port);
 }
 
-static void sci_set_termios(struct uart_port *port, struct termios *termios,
-                           struct termios *old)
+static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+                           struct ktermios *old)
 {
        struct sci_port *s = &sci_ports[port->line];
        unsigned int status, baud, smr_val;
@@ -962,7 +983,7 @@ static void sci_set_termios(struct uart_port *port, struct termios *termios,
                default:
                {
 #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
-                       struct clk *clk = clk_get("module_clk");
+                       struct clk *clk = clk_get(NULL, "module_clk");
                        t = SCBRR_VALUE(baud, clk_get_rate(clk));
                        clk_put(clk);
 #else
@@ -1130,7 +1151,7 @@ static void __init sci_init_ports(void)
                 * XXX: We should use a proper SCI/SCIF clock
                 */
                {
-                       struct clk *clk = clk_get("module_clk");
+                       struct clk *clk = clk_get(NULL, "module_clk");
                        sci_ports[i].port.uartclk = clk_get_rate(clk) * 16;
                        clk_put(clk);
                }