diff options
author | Jason Chen <jason.chen@linaro.org> | 2011-12-13 09:52:34 +0800 |
---|---|---|
committer | Jason Chen <jason.chen@linaro.org> | 2011-12-13 09:52:34 +0800 |
commit | fdba1f5d514abc6ab1d07a168f307739d6762ebf (patch) | |
tree | b85a42654c467be453b64473d463b35d4b420368 | |
parent | dc66f270f07dd1be8b5d64cd0f0fa89a1f03285e (diff) |
IMX uart: add wake up source for debugging
Signed-off-by: Jason Chen <jason.chen@linaro.org>
-rw-r--r-- | drivers/tty/serial/imx.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 163fc9021f5..e1d1af2c7b5 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -565,6 +565,10 @@ static irqreturn_t imx_int(int irq, void *dev_id) if (sts & USR1_RTSD) imx_rtsint(irq, dev_id); +#ifdef CONFIG_PM + if (sts & USR1_AWAKE) + writel(USR1_AWAKE, sport->port.membase + USR1); +#endif return IRQ_HANDLED; } @@ -662,6 +666,7 @@ static int imx_startup(struct uart_port *port) struct imx_port *sport = (struct imx_port *)port; int retval; unsigned long flags, temp; + struct tty_struct *tty; imx_setup_ufcr(sport, 0); @@ -792,6 +797,10 @@ static int imx_startup(struct uart_port *port) pdata->irda_enable(1); } + tty = sport->port.state->port.tty; +#ifdef CONFIG_PM + device_set_wakeup_enable(tty->dev, 1); +#endif return 0; error_out3: @@ -1269,6 +1278,19 @@ static struct uart_driver imx_reg = { static int serial_imx_suspend(struct platform_device *dev, pm_message_t state) { struct imx_port *sport = platform_get_drvdata(dev); + unsigned int val; + + if (device_may_wakeup(&dev->dev)) { + enable_irq_wake(sport->rxirq); +#ifdef CONFIG_PM + if (sport->port.line == 1) { + /* enable awake for MX6 */ + val = readl(sport->port.membase + UCR3); + val |= UCR3_AWAKEN; + writel(val, sport->port.membase + UCR3); + } +#endif + } if (sport) uart_suspend_port(&imx_reg, &sport->port); @@ -1279,10 +1301,22 @@ static int serial_imx_suspend(struct platform_device *dev, pm_message_t state) static int serial_imx_resume(struct platform_device *dev) { struct imx_port *sport = platform_get_drvdata(dev); + unsigned int val; if (sport) uart_resume_port(&imx_reg, &sport->port); + if (device_may_wakeup(&dev->dev)) { +#ifdef CONFIG_PM + if (sport->port.line == 1) { + val = readl(sport->port.membase + UCR3); + val &= ~UCR3_AWAKEN; + writel(val, sport->port.membase + UCR3); + } +#endif + disable_irq_wake(sport->rxirq); + } + return 0; } @@ -1408,6 +1442,10 @@ static int serial_imx_probe(struct platform_device *pdev) goto deinit; platform_set_drvdata(pdev, &sport->port); +#ifdef CONFIG_PM + device_init_wakeup(&pdev->dev, 1); +#endif + return 0; deinit: if (pdata && pdata->exit) |