]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/serial/amba-pl011.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[linux-2.6-omap-h63xx.git] / drivers / serial / amba-pl011.c
index 7db88ee18f75fb1f138f71921c05d833aa935a51..d84476ee65923d85a4ce5043b162565324c6db79 100644 (file)
@@ -49,7 +49,7 @@
 #include <linux/serial.h>
 
 #include <asm/io.h>
-#include <asm/irq.h>
+#include <asm/sizes.h>
 #include <asm/hardware/amba.h>
 #include <asm/hardware/clock.h>
 #include <asm/hardware/amba_serial.h>
@@ -62,7 +62,8 @@
 
 #define AMBA_ISR_PASS_LIMIT    256
 
-#define UART_DUMMY_RSR_RX      256
+#define UART_DR_ERROR          (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE)
+#define UART_DUMMY_DR_RX       (1 << 16)
 
 /*
  * We wrap our port structure around the generic uart_port.
@@ -74,7 +75,7 @@ struct uart_amba_port {
        unsigned int            old_status;
 };
 
-static void pl011_stop_tx(struct uart_port *port, unsigned int tty_stop)
+static void pl011_stop_tx(struct uart_port *port)
 {
        struct uart_amba_port *uap = (struct uart_amba_port *)port;
 
@@ -82,7 +83,7 @@ static void pl011_stop_tx(struct uart_port *port, unsigned int tty_stop)
        writew(uap->im, uap->port.membase + UART011_IMSC);
 }
 
-static void pl011_start_tx(struct uart_port *port, unsigned int tty_start)
+static void pl011_start_tx(struct uart_port *port)
 {
        struct uart_amba_port *uap = (struct uart_amba_port *)port;
 
@@ -115,7 +116,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
 #endif
 {
        struct tty_struct *tty = uap->port.info->tty;
-       unsigned int status, ch, flag, rsr, max_count = 256;
+       unsigned int status, ch, flag, max_count = 256;
 
        status = readw(uap->port.membase + UART01x_FR);
        while ((status & UART01x_FR_RXFE) == 0 && max_count--) {
@@ -128,7 +129,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
                         */
                }
 
-               ch = readw(uap->port.membase + UART01x_DR);
+               ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX;
                flag = TTY_NORMAL;
                uap->port.icount.rx++;
 
@@ -136,34 +137,33 @@ pl011_rx_chars(struct uart_amba_port *uap)
                 * Note that the error handling code is
                 * out of the main execution path
                 */
-               rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
-               if (unlikely(rsr & UART01x_RSR_ANY)) {
-                       if (rsr & UART01x_RSR_BE) {
-                               rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
+               if (unlikely(ch & UART_DR_ERROR)) {
+                       if (ch & UART011_DR_BE) {
+                               ch &= ~(UART011_DR_FE | UART011_DR_PE);
                                uap->port.icount.brk++;
                                if (uart_handle_break(&uap->port))
                                        goto ignore_char;
-                       } else if (rsr & UART01x_RSR_PE)
+                       } else if (ch & UART011_DR_PE)
                                uap->port.icount.parity++;
-                       else if (rsr & UART01x_RSR_FE)
+                       else if (ch & UART011_DR_FE)
                                uap->port.icount.frame++;
-                       if (rsr & UART01x_RSR_OE)
+                       if (ch & UART011_DR_OE)
                                uap->port.icount.overrun++;
 
-                       rsr &= uap->port.read_status_mask;
+                       ch &= uap->port.read_status_mask;
 
-                       if (rsr & UART01x_RSR_BE)
+                       if (ch & UART011_DR_BE)
                                flag = TTY_BREAK;
-                       else if (rsr & UART01x_RSR_PE)
+                       else if (ch & UART011_DR_PE)
                                flag = TTY_PARITY;
-                       else if (rsr & UART01x_RSR_FE)
+                       else if (ch & UART011_DR_FE)
                                flag = TTY_FRAME;
                }
 
-               if (uart_handle_sysrq_char(&uap->port, ch, regs))
+               if (uart_handle_sysrq_char(&uap->port, ch & 255, regs))
                        goto ignore_char;
 
-               uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
+               uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);
 
        ignore_char:
                status = readw(uap->port.membase + UART01x_FR);
@@ -184,7 +184,7 @@ static void pl011_tx_chars(struct uart_amba_port *uap)
                return;
        }
        if (uart_circ_empty(xmit) || uart_tx_stopped(&uap->port)) {
-               pl011_stop_tx(&uap->port, 0);
+               pl011_stop_tx(&uap->port);
                return;
        }
 
@@ -201,7 +201,7 @@ static void pl011_tx_chars(struct uart_amba_port *uap)
                uart_write_wakeup(&uap->port);
 
        if (uart_circ_empty(xmit))
-               pl011_stop_tx(&uap->port, 0);
+               pl011_stop_tx(&uap->port);
 }
 
 static void pl011_modem_status(struct uart_amba_port *uap)
@@ -475,33 +475,33 @@ pl011_set_termios(struct uart_port *port, struct termios *termios,
         */
        uart_update_timeout(port, termios->c_cflag, baud);
 
-       port->read_status_mask = UART01x_RSR_OE;
+       port->read_status_mask = UART011_DR_OE | 255;
        if (termios->c_iflag & INPCK)
-               port->read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE;
+               port->read_status_mask |= UART011_DR_FE | UART011_DR_PE;
        if (termios->c_iflag & (BRKINT | PARMRK))
-               port->read_status_mask |= UART01x_RSR_BE;
+               port->read_status_mask |= UART011_DR_BE;
 
        /*
         * Characters to ignore
         */
        port->ignore_status_mask = 0;
        if (termios->c_iflag & IGNPAR)
-               port->ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE;
+               port->ignore_status_mask |= UART011_DR_FE | UART011_DR_PE;
        if (termios->c_iflag & IGNBRK) {
-               port->ignore_status_mask |= UART01x_RSR_BE;
+               port->ignore_status_mask |= UART011_DR_BE;
                /*
                 * If we're ignoring parity and break indicators,
                 * ignore overruns too (for real raw support).
                 */
                if (termios->c_iflag & IGNPAR)
-                       port->ignore_status_mask |= UART01x_RSR_OE;
+                       port->ignore_status_mask |= UART011_DR_OE;
        }
 
        /*
         * Ignore all characters if CREAD is not set.
         */
        if ((termios->c_cflag & CREAD) == 0)
-               port->ignore_status_mask |= UART_DUMMY_RSR_RX;
+               port->ignore_status_mask |= UART_DUMMY_DR_RX;
 
        if (UART_ENABLE_MS(port, termios->c_cflag))
                pl011_enable_ms(port);
@@ -701,7 +701,7 @@ static int __init pl011_console_setup(struct console *co, char *options)
        return uart_set_options(&uap->port, co, baud, parity, bits, flow);
 }
 
-extern struct uart_driver amba_reg;
+static struct uart_driver amba_reg;
 static struct console amba_console = {
        .name           = "ttyAMA",
        .write          = pl011_console_write,