]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/serial/8250.c
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / drivers / serial / 8250.c
index 96a585e1cee8226a449d3e0174c98bf9a1b6ff77..9b913db147a591fcadab8ba6a7e7be85e8c8ef1c 100644 (file)
@@ -93,7 +93,6 @@ static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS;
 #define CONFIG_HUB6 1
 
 #include <asm/serial.h>
-
 /*
  * SERIAL_PORT_DFNS tells us about built-in ports that have no
  * standard enumeration mechanism.   Platforms that can find all
@@ -1505,7 +1504,11 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id)
 
        DEBUG_INTR("end.\n");
 
+#ifdef CONFIG_ARCH_OMAP15XX
+       return IRQ_HANDLED;     /* FIXME: iir status not ready on 1510 */
+#else
        return IRQ_RETVAL(handled);
+#endif
 }
 
 /*
@@ -1868,6 +1871,7 @@ static int serial8250_startup(struct uart_port *port)
        }
 
        if (is_real_interrupt(up->port.irq)) {
+               unsigned char iir1;
                /*
                 * Test for UARTs that do not reassert THRE when the
                 * transmitter is idle and the interrupt has already
@@ -1881,7 +1885,7 @@ static int serial8250_startup(struct uart_port *port)
                wait_for_xmitr(up, UART_LSR_THRE);
                serial_out_sync(up, UART_IER, UART_IER_THRI);
                udelay(1); /* allow THRE to set */
-               serial_in(up, UART_IIR);
+               iir1 = serial_in(up, UART_IIR);
                serial_out(up, UART_IER, 0);
                serial_out_sync(up, UART_IER, UART_IER_THRI);
                udelay(1); /* allow a working UART time to re-assert THRE */
@@ -1894,7 +1898,7 @@ static int serial8250_startup(struct uart_port *port)
                 * If the interrupt is not reasserted, setup a timer to
                 * kick the UART on a regular basis.
                 */
-               if (iir & UART_IIR_NO_INT) {
+               if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {
                        pr_debug("ttyS%d - using backup timer\n", port->line);
                        up->timer.function = serial8250_backup_timeout;
                        up->timer.data = (unsigned long)up;
@@ -2224,11 +2228,26 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
                        /* emulated UARTs (Lucent Venus 167x) need two steps */
                        serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
                }
+
+               /* Note that we need to set ECB to access write water mark
+                * bits. First allow FCR tx fifo write, then set fcr with
+                * possible TX fifo settings. */
+               if (uart_config[up->port.type].flags & UART_CAP_EFR) {
+                       serial_outp(up, UART_LCR, 0xbf);        /* Access EFR */
+                       serial_outp(up, UART_EFR, UART_EFR_ECB);
+                       serial_outp(up, UART_LCR, 0x0);         /* Access FCR */
+                       serial_outp(up, UART_FCR, fcr);
+                       serial_outp(up, UART_LCR, 0xbf);        /* Access EFR */
+                       serial_outp(up, UART_EFR, 0);
+                       serial_outp(up, UART_LCR, cval);        /* Access FCR */
+        } else
                serial_outp(up, UART_FCR, fcr);         /* set fcr */
        }
        serial8250_set_mctrl(&up->port, up->port.mctrl);
        spin_unlock_irqrestore(&up->port.lock, flags);
-       tty_termios_encode_baud_rate(termios, baud, baud);
+       /* Don't rewrite B0 */
+       if (tty_termios_baud_rate(termios))
+               tty_termios_encode_baud_rate(termios, baud, baud);
 }
 
 static void
@@ -2251,6 +2270,11 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
        unsigned int size = 8 << up->port.regshift;
        int ret = 0;
 
+#ifdef CONFIG_ARCH_OMAP
+       if (is_omap_port((unsigned int)up->port.membase))
+               size = 0x16 << up->port.regshift;
+#endif
+
        switch (up->port.iotype) {
        case UPIO_AU:
                size = 0x100000;
@@ -2268,7 +2292,8 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
                }
 
                if (up->port.flags & UPF_IOREMAP) {
-                       up->port.membase = ioremap(up->port.mapbase, size);
+                       up->port.membase = ioremap_nocache(up->port.mapbase,
+                                                                       size);
                        if (!up->port.membase) {
                                release_mem_region(up->port.mapbase, size);
                                ret = -ENOMEM;
@@ -2620,6 +2645,9 @@ static struct console serial8250_console = {
 
 static int __init serial8250_console_init(void)
 {
+       if (nr_uarts > UART_NR)
+               nr_uarts = UART_NR;
+
        serial8250_isa_init_ports();
        register_console(&serial8250_console);
        return 0;