113-serial-imx-make-sure-unhandled-irqs-are-disabled.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. Make sure that events that are not handled in the irq function don't
  9. trigger an interrupt.
  10. When the serial port is operated in DTE mode, the events for DCD and RI
  11. events are enabled after a system reset by default.
  12. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  13. Signed-off-by: Petr Štetiar <ynezz@true.cz>
  14. ---
  15. drivers/tty/serial/imx.c | 23 ++++++++++++++++++++++-
  16. 1 file changed, 22 insertions(+), 1 deletion(-)
  17. --- a/drivers/tty/serial/imx.c
  18. +++ b/drivers/tty/serial/imx.c
  19. @@ -1184,11 +1184,32 @@ static int imx_startup(struct uart_port
  20. temp |= (UCR2_RXEN | UCR2_TXEN);
  21. if (!sport->have_rtscts)
  22. temp |= UCR2_IRTS;
  23. + /*
  24. + * make sure the edge sensitive RTS-irq is disabled,
  25. + * we're using RTSD instead.
  26. + */
  27. + if (!is_imx1_uart(sport))
  28. + temp &= ~UCR2_RTSEN;
  29. writel(temp, sport->port.membase + UCR2);
  30. if (!is_imx1_uart(sport)) {
  31. temp = readl(sport->port.membase + UCR3);
  32. - temp |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP;
  33. +
  34. + /*
  35. + * The effect of RI and DCD differs depending on the UFCR_DCEDTE
  36. + * bit. In DCE mode they control the outputs, in DTE mode they
  37. + * enable the respective irqs. At least the DCD irq cannot be
  38. + * cleared on i.MX25 at least, so it's not usable and must be
  39. + * disabled. I don't have test hardware to check if RI has the
  40. + * same problem but I consider this likely so it's disabled for
  41. + * now, too.
  42. + */
  43. + temp |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP |
  44. + UCR3_RI | UCR3_DCD;
  45. +
  46. + if (sport->dte_mode)
  47. + temp &= ~(UCR3_RI | UCR3_DCD);
  48. +
  49. writel(temp, sport->port.membase + UCR3);
  50. }