aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2015-01-19 15:41:47 +0000
committerDaniel Thompson <daniel.thompson@linaro.org>2015-01-28 15:01:52 +0000
commit96da3dea0359a063e2d374c6d551661cb88f8878 (patch)
tree8c67e9ae9d77df83d4ee01b9bce2896b2646e88f
parent9230175ca2b56bc0ababd2f45efa4392c3a78f08 (diff)
downloadlinux-96da3dea0359a063e2d374c6d551661cb88f8878.tar.gz
serial: imx: Implement poll_nmi_wrap/unwrap
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
-rw-r--r--drivers/tty/serial/imx.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 4c5e9092e2d7..3fce82d6a5cc 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -34,6 +34,7 @@
#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/init.h>
+#include <linux/interrupt.h>
#include <linux/console.h>
#include <linux/sysrq.h>
#include <linux/platform_device.h>
@@ -1515,6 +1516,37 @@ static void imx_poll_put_char(struct uart_port *port, unsigned char c)
status = readl_relaxed(port->membase + USR2);
} while (~status & USR2_TXDC);
}
+
+static int imx_poll_request_nmi(struct uart_port *port, irq_handler_t handler)
+{
+ struct imx_port *sport = (struct imx_port *)port;
+ int ret;
+
+ devm_free_irq(port->dev, port->irq, sport);
+
+ ret = devm_request_irq(port->dev, port->irq, handler, IRQF_NMI,
+ dev_name(port->dev), sport);
+ if (ret != 0)
+ if (0 !=
+ devm_request_irq(port->dev, port->irq,
+ (sport->txirq > 0 ? imx_rxint : imx_int),
+ 0, dev_name(port->dev), sport))
+ pr_err("Failed to restore interrupt handler\n");
+
+ return ret;
+}
+
+static void imx_poll_free_nmi(struct uart_port *port)
+{
+ struct imx_port *sport = (struct imx_port *)port;
+
+ devm_free_irq(port->dev, port->irq, sport);
+
+ if (0 != devm_request_irq(port->dev, port->irq,
+ (sport->txirq > 0 ? imx_rxint : imx_int),
+ 0, dev_name(port->dev), sport))
+ pr_err("Failed to restore interrupt handler\n");
+}
#endif
static struct uart_ops imx_pops = {
@@ -1537,6 +1569,8 @@ static struct uart_ops imx_pops = {
.poll_init = imx_poll_init,
.poll_get_char = imx_poll_get_char,
.poll_put_char = imx_poll_put_char,
+ .poll_request_nmi = imx_poll_request_nmi,
+ .poll_free_nmi = imx_poll_free_nmi,
#endif
};