summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/imx.c
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2011-07-20 14:46:37 +0800
committerJason Liu <r64343@freescale.com>2012-01-09 20:21:32 +0800
commit23625884239af1ef5d4933eb63a88b2cdd5a9ebd (patch)
tree4e99ea78d8c96378798415de4410ee49fb8e0ce0 /drivers/tty/serial/imx.c
parent5f4317a276feec2f46a4112ae2bacdf04f640416 (diff)
ENGR00139274-4 [UART]Enable suspend/resume feature
1. Enable wake up of uart; Signed-off-by: Anson Huang <b20788@freescale.com>
Diffstat (limited to 'drivers/tty/serial/imx.c')
-rw-r--r--drivers/tty/serial/imx.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 850b6d811418..fd517262a8d0 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -501,8 +501,7 @@ static irqreturn_t imx_int(int irq, void *dev_id)
if (sts & USR1_RTSD)
imx_rtsint(irq, dev_id);
-
-#ifdef CONFIG_ARCH_MX6
+#ifdef CONFIG_PM
if (sts & USR1_AWAKE)
writel(USR1_AWAKE, sport->port.membase + USR1);
#endif
@@ -602,6 +601,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);
@@ -732,6 +732,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:
@@ -1212,14 +1216,20 @@ 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 == 0) {
+ /* 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);
-#ifdef CONFIG_ARCH_MX6
- /* enable awake for MX6*/
- val = readl(sport->port.membase + UCR3);
- val |= UCR3_AWAKEN;
- writel(val, sport->port.membase + UCR3);
-#endif
+
return 0;
}
@@ -1231,11 +1241,16 @@ static int serial_imx_resume(struct platform_device *dev)
if (sport)
uart_resume_port(&imx_reg, &sport->port);
-#ifdef CONFIG_ARCH_MX6
- val = readl(sport->port.membase + UCR3);
- val &= ~UCR3_AWAKEN;
- writel(val, sport->port.membase + UCR3);
+ if (device_may_wakeup(&dev->dev)) {
+#ifdef CONFIG_PM
+ if (sport->port.line == 0) {
+ val = readl(sport->port.membase + UCR3);
+ val &= ~UCR3_AWAKEN;
+ writel(val, sport->port.membase + UCR3);
+ }
#endif
+ disable_irq_wake(sport->rxirq);
+ }
return 0;
}
@@ -1311,6 +1326,9 @@ 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)