8978d33e6e5418efd9bea31a090b8fa25698d3eb
[openwrt/openwrt.git] / target / linux / imx6 / patches-4.4 / 113-serial-imx-make-sure-unhandled-irqs-are-disabled.patch
1 From a58c6360b9eb3a2374b0b069ba9ce7baec0f26df Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
3 Date: Thu, 24 Mar 2016 14:24:22 +0100
4 Subject: [PATCH 3/3] serial: imx: make sure unhandled irqs are disabled
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Make sure that events that are not handled in the irq function don't
10 trigger an interrupt.
11
12 When the serial port is operated in DTE mode, the events for DCD and RI
13 events are enabled after a system reset by default.
14
15 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
16 Signed-off-by: Petr Štetiar <ynezz@true.cz>
17 ---
18 drivers/tty/serial/imx.c | 23 ++++++++++++++++++++++-
19 1 file changed, 22 insertions(+), 1 deletion(-)
20
21 diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
22 index 5ced61e..fcd48fd 100644
23 --- a/drivers/tty/serial/imx.c
24 +++ b/drivers/tty/serial/imx.c
25 @@ -1221,11 +1221,32 @@ static int imx_startup(struct uart_port *port)
26 temp |= (UCR2_RXEN | UCR2_TXEN);
27 if (!sport->have_rtscts)
28 temp |= UCR2_IRTS;
29 + /*
30 + * make sure the edge sensitive RTS-irq is disabled,
31 + * we're using RTSD instead.
32 + */
33 + if (!is_imx1_uart(sport))
34 + temp &= ~UCR2_RTSEN;
35 writel(temp, sport->port.membase + UCR2);
36
37 if (!is_imx1_uart(sport)) {
38 temp = readl(sport->port.membase + UCR3);
39 - temp |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP;
40 +
41 + /*
42 + * The effect of RI and DCD differs depending on the UFCR_DCEDTE
43 + * bit. In DCE mode they control the outputs, in DTE mode they
44 + * enable the respective irqs. At least the DCD irq cannot be
45 + * cleared on i.MX25 at least, so it's not usable and must be
46 + * disabled. I don't have test hardware to check if RI has the
47 + * same problem but I consider this likely so it's disabled for
48 + * now, too.
49 + */
50 + temp |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP |
51 + UCR3_RI | UCR3_DCD;
52 +
53 + if (sport->dte_mode)
54 + temp &= ~(UCR3_RI | UCR3_DCD);
55 +
56 writel(temp, sport->port.membase + UCR3);
57 }
58
59 --
60 1.9.1
61