* [PATCH v5] tty: serial: imx: Allow UART to be a source for wakeup
[not found] <1323434541-27689-1-git-send-email-festevam@gmail.com>
@ 2011-12-13 3:23 ` Fabio Estevam
2011-12-14 0:44 ` Richard Zhao
2011-12-26 1:53 ` Shawn Guo
0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2011-12-13 3:23 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: kernel, shawn.guo, alan, linux-serial, Fabio Estevam
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>
---
Changes since v4:
- Let serial core handle device_init_wakeup/device_set_wakeup_enable.
Changes since v3:
- Remove IMXUART_CANWAKE flag. Let userspace write in /sys/ file
in order to enable UART wakeup source.
Changes since v2:
- Remove incorrect enable_irq_wake from serial_imx_resume
Changes since v1:
- Pass the can-wake property via DT correctly
drivers/tty/serial/imx.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 163fc90..0022bbd 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)
if (sts & USR1_RTSD)
imx_rtsint(irq, dev_id);
+ if (sts & USR1_AWAKE)
+ writel(USR1_AWAKE, sport->port.membase + USR1);
+
return IRQ_HANDLED;
}
@@ -1269,6 +1272,12 @@ 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;
+
+ /* enable wakeup from i.MX UART */
+ val = readl(sport->port.membase + UCR3);
+ val |= UCR3_AWAKEN;
+ writel(val, sport->port.membase + UCR3);
if (sport)
uart_suspend_port(&imx_reg, &sport->port);
@@ -1279,7 +1288,13 @@ 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;
+ /* disable wakeup from i.MX UART */
+ val = readl(sport->port.membase + UCR3);
+ val &= ~UCR3_AWAKEN;
+ writel(val, sport->port.membase + UCR3);
+
if (sport)
uart_resume_port(&imx_reg, &sport->port);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v5] tty: serial: imx: Allow UART to be a source for wakeup
2011-12-13 3:23 ` [PATCH v5] tty: serial: imx: Allow UART to be a source for wakeup Fabio Estevam
@ 2011-12-14 0:44 ` Richard Zhao
2011-12-26 1:53 ` Shawn Guo
1 sibling, 0 replies; 3+ messages in thread
From: Richard Zhao @ 2011-12-14 0:44 UTC (permalink / raw)
To: Fabio Estevam
Cc: linux-arm-kernel, Fabio Estevam, linux-serial, shawn.guo, kernel,
alan
On Tue, Dec 13, 2011 at 01:23:48AM -0200, Fabio Estevam wrote:
> 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>
For imx6q sabrelite,
Tested-by: Richard Zhao <richard.zhao@freescale.com>
> ---
> Changes since v4:
> - Let serial core handle device_init_wakeup/device_set_wakeup_enable.
> Changes since v3:
> - Remove IMXUART_CANWAKE flag. Let userspace write in /sys/ file
> in order to enable UART wakeup source.
> Changes since v2:
> - Remove incorrect enable_irq_wake from serial_imx_resume
> Changes since v1:
> - Pass the can-wake property via DT correctly
> drivers/tty/serial/imx.c | 15 +++++++++++++++
> 1 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 163fc90..0022bbd 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)
> if (sts & USR1_RTSD)
> imx_rtsint(irq, dev_id);
>
> + if (sts & USR1_AWAKE)
> + writel(USR1_AWAKE, sport->port.membase + USR1);
> +
> return IRQ_HANDLED;
> }
>
> @@ -1269,6 +1272,12 @@ 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;
> +
> + /* enable wakeup from i.MX UART */
> + val = readl(sport->port.membase + UCR3);
> + val |= UCR3_AWAKEN;
> + writel(val, sport->port.membase + UCR3);
>
> if (sport)
> uart_suspend_port(&imx_reg, &sport->port);
> @@ -1279,7 +1288,13 @@ 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;
>
> + /* disable wakeup from i.MX UART */
> + val = readl(sport->port.membase + UCR3);
> + val &= ~UCR3_AWAKEN;
> + writel(val, sport->port.membase + UCR3);
> +
> if (sport)
> uart_resume_port(&imx_reg, &sport->port);
>
> --
> 1.7.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v5] tty: serial: imx: Allow UART to be a source for wakeup
2011-12-13 3:23 ` [PATCH v5] tty: serial: imx: Allow UART to be a source for wakeup Fabio Estevam
2011-12-14 0:44 ` Richard Zhao
@ 2011-12-26 1:53 ` Shawn Guo
1 sibling, 0 replies; 3+ messages in thread
From: Shawn Guo @ 2011-12-26 1:53 UTC (permalink / raw)
To: Fabio Estevam
Cc: linux-arm-kernel, kernel, alan, linux-serial, Fabio Estevam,
Greg Kroah-Hartman
On Tue, Dec 13, 2011 at 01:23:48AM -0200, Fabio Estevam wrote:
> 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>
> ---
I queued this for 3.3, and will send a pull-request to Greg.
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-26 1:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1323434541-27689-1-git-send-email-festevam@gmail.com>
2011-12-13 3:23 ` [PATCH v5] tty: serial: imx: Allow UART to be a source for wakeup Fabio Estevam
2011-12-14 0:44 ` Richard Zhao
2011-12-26 1:53 ` Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox