aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorFabio Estevam <festevam@gmail.com>2011-12-12 22:23:48 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-04 19:30:33 -0500
commitdb1a9b55004c83ded54c1f869f81a8a59c6dde87 (patch)
tree760d3165b96af9069b64f861f538855f0d00dd99 /drivers/tty
parent59087384e41e33ed070575aa4a834a7ff7d67e77 (diff)
tty: serial: imx: Allow UART to be a source for wakeup
Allow UART to be a source for wakeup from low power mode. Tested on a MX27PDK by doing: echo enabled > /sys/devices/platform/imx21-uart.0/tty/ttymxc0/power/wakeup echo mem > /sys/power/state and then pressing a key in the console will wakeup the sytem. Suggested-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Tested-by: Richard Zhao <richard.zhao@freescale.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/imx.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 962cafa175f7..ed6e1448e7eb 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -566,6 +566,9 @@ static irqreturn_t imx_int(int irq, void *dev_id)
566 if (sts & USR1_RTSD) 566 if (sts & USR1_RTSD)
567 imx_rtsint(irq, dev_id); 567 imx_rtsint(irq, dev_id);
568 568
569 if (sts & USR1_AWAKE)
570 writel(USR1_AWAKE, sport->port.membase + USR1);
571
569 return IRQ_HANDLED; 572 return IRQ_HANDLED;
570} 573}
571 574
@@ -1269,6 +1272,12 @@ static struct uart_driver imx_reg = {
1269static int serial_imx_suspend(struct platform_device *dev, pm_message_t state) 1272static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
1270{ 1273{
1271 struct imx_port *sport = platform_get_drvdata(dev); 1274 struct imx_port *sport = platform_get_drvdata(dev);
1275 unsigned int val;
1276
1277 /* enable wakeup from i.MX UART */
1278 val = readl(sport->port.membase + UCR3);
1279 val |= UCR3_AWAKEN;
1280 writel(val, sport->port.membase + UCR3);
1272 1281
1273 if (sport) 1282 if (sport)
1274 uart_suspend_port(&imx_reg, &sport->port); 1283 uart_suspend_port(&imx_reg, &sport->port);
@@ -1279,6 +1288,12 @@ static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
1279static int serial_imx_resume(struct platform_device *dev) 1288static int serial_imx_resume(struct platform_device *dev)
1280{ 1289{
1281 struct imx_port *sport = platform_get_drvdata(dev); 1290 struct imx_port *sport = platform_get_drvdata(dev);
1291 unsigned int val;
1292
1293 /* disable wakeup from i.MX UART */
1294 val = readl(sport->port.membase + UCR3);
1295 val &= ~UCR3_AWAKEN;
1296 writel(val, sport->port.membase + UCR3);
1282 1297
1283 if (sport) 1298 if (sport)
1284 uart_resume_port(&imx_reg, &sport->port); 1299 uart_resume_port(&imx_reg, &sport->port);