]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
serial: imx: make sure unhandled irqs are disabled
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 24 Mar 2016 13:24:22 +0000 (14:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Apr 2016 16:26:55 +0000 (09:26 -0700)
Make sure that events that are not handled in the irq function don't
trigger an interrupt.

When the serial port is operated in DTE mode, the events for DCD and RI
events are enabled after a system reset by default.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c

index 46769168fab78cb182403cc5219590c2eff413c4..aa07301df262bc7f4721b3aafb39df8ba1387890 100644 (file)
@@ -1224,11 +1224,32 @@ static int imx_startup(struct uart_port *port)
        temp |= (UCR2_RXEN | UCR2_TXEN);
        if (!sport->have_rtscts)
                temp |= UCR2_IRTS;
+       /*
+        * make sure the edge sensitive RTS-irq is disabled,
+        * we're using RTSD instead.
+        */
+       if (!is_imx1_uart(sport))
+               temp &= ~UCR2_RTSEN;
        writel(temp, sport->port.membase + UCR2);
 
        if (!is_imx1_uart(sport)) {
                temp = readl(sport->port.membase + UCR3);
-               temp |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP;
+
+               /*
+                * The effect of RI and DCD differs depending on the UFCR_DCEDTE
+                * bit. In DCE mode they control the outputs, in DTE mode they
+                * enable the respective irqs. At least the DCD irq cannot be
+                * cleared on i.MX25 at least, so it's not usable and must be
+                * disabled. I don't have test hardware to check if RI has the
+                * same problem but I consider this likely so it's disabled for
+                * now, too.
+                */
+               temp |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP |
+                       UCR3_RI | UCR3_DCD;
+
+               if (sport->dte_mode)
+                       temp &= ~(UCR3_RI | UCR3_DCD);
+
                writel(temp, sport->port.membase + UCR3);
        }