serial: PL011: clear pending interrupts
[pandora-kernel.git] / drivers / tty / serial / amba-pl011.c
index 8e00926..dddc3f2 100644 (file)
@@ -1380,6 +1380,10 @@ static int pl011_startup(struct uart_port *port)
 
        uap->port.uartclk = clk_get_rate(uap->clk);
 
+       /* Clear pending error and receive interrupts */
+       writew(UART011_OEIS | UART011_BEIS | UART011_PEIS | UART011_FEIS |
+              UART011_RTIS | UART011_RXIS, uap->port.membase + UART011_ICR);
+
        /*
         * Allocate the IRQ
         */
@@ -1414,10 +1418,6 @@ static int pl011_startup(struct uart_port *port)
        cr = UART01x_CR_UARTEN | UART011_CR_RXE | UART011_CR_TXE;
        writew(cr, uap->port.membase + UART011_CR);
 
-       /* Clear pending error interrupts */
-       writew(UART011_OEIS | UART011_BEIS | UART011_PEIS | UART011_FEIS,
-              uap->port.membase + UART011_ICR);
-
        /*
         * initialise the old status of the modem signals
         */
@@ -1432,6 +1432,9 @@ static int pl011_startup(struct uart_port *port)
         * as well.
         */
        spin_lock_irq(&uap->port.lock);
+       /* Clear out any spuriously appearing RX interrupts */
+        writew(UART011_RTIS | UART011_RXIS,
+               uap->port.membase + UART011_ICR);
        uap->im = UART011_RTIM;
        if (!pl011_dma_rx_running(uap))
                uap->im |= UART011_RXIM;
@@ -1916,6 +1919,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
                goto unmap;
        }
 
+       /* Ensure interrupts from this UART are masked and cleared */
+       writew(0, uap->port.membase + UART011_IMSC);
+       writew(0xffff, uap->port.membase + UART011_ICR);
+
        uap->vendor = vendor;
        uap->lcrh_rx = vendor->lcrh_rx;
        uap->lcrh_tx = vendor->lcrh_tx;