summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2011-09-20 11:56:10 +0200
committerJonas ABERG <jonas.aberg@stericsson.com>2011-09-29 08:51:54 +0200
commit41fe35a99a95442f7221b925895cdcd362fb1962 (patch)
treee1152b355bbbfd2dc67d3d4561abfb09d18b8371
parent2deda24045d4253ee36f656bb037896133021404 (diff)
ARM: ux500: suspend: Add wake on uart
Change-Id: Ia9ae6894333ee8d696a2b946b565496e1c26554f Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32077
-rwxr-xr-xarch/arm/configs/u8500_defconfig2
-rw-r--r--arch/arm/mach-ux500/pm/Kconfig19
-rw-r--r--arch/arm/mach-ux500/pm/Makefile1
-rw-r--r--arch/arm/mach-ux500/pm/suspend.c6
-rw-r--r--arch/arm/mach-ux500/pm/suspend_dbg.c27
-rw-r--r--arch/arm/mach-ux500/pm/suspend_dbg.h21
6 files changed, 76 insertions, 0 deletions
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 0dfc7040436..b463152b4a4 100755
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -38,6 +38,8 @@ CONFIG_DBX500_PRCMU_QOS_POWER=y
CONFIG_DBX500_PRCMU_DEBUG=y
# CONFIG_UX500_DEBUG_NO_LAUTERBACH is not set
CONFIG_UX500_SUSPEND=y
+CONFIG_UX500_SUSPEND_DBG=y
+CONFIG_UX500_SUSPEND_DBG_WAKE_ON_UART=y
CONFIG_UX500_CONTEXT=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT_DETAILS=y
diff --git a/arch/arm/mach-ux500/pm/Kconfig b/arch/arm/mach-ux500/pm/Kconfig
index 0a449421eca..cc71c775f7c 100644
--- a/arch/arm/mach-ux500/pm/Kconfig
+++ b/arch/arm/mach-ux500/pm/Kconfig
@@ -25,3 +25,22 @@ config UX500_SUSPEND
select UX500_CONTEXT
help
Add support for suspend.
+
+config UX500_SUSPEND_DBG
+ bool "Suspend debug"
+ depends on UX500_SUSPEND
+ help
+ Add debug support for suspend.
+
+config UX500_SUSPEND_DBG_WAKE_ON_UART
+ bool "Suspend wakes on console UART"
+ depends on UX500_SUSPEND_DBG
+ help
+ Wake up on uart interrupts. Makes it possible for the console to wake up system.
+
+config UX500_CONSOLE_UART_GPIO_PIN
+ int "The pin number of the console UART GPIO pin"
+ default 29
+ depends on UX500_SUSPEND_DBG_WAKE_ON_UART
+ help
+ GPIO pin number of the GPIO pin connected to the console UART RX line.
diff --git a/arch/arm/mach-ux500/pm/Makefile b/arch/arm/mach-ux500/pm/Makefile
index 68112b371a4..ee182ea4b4f 100644
--- a/arch/arm/mach-ux500/pm/Makefile
+++ b/arch/arm/mach-ux500/pm/Makefile
@@ -6,4 +6,5 @@ obj-y := pm.o runtime.o no_suspend.o
obj-$(CONFIG_DBX500_PRCMU_QOS_POWER) += prcmu-qos-power.o
obj-$(CONFIG_UX500_CONTEXT) += context.o context_arm.o context-db8500.o context-db5500.o
obj-$(CONFIG_UX500_SUSPEND) += suspend.o
+obj-$(CONFIG_UX500_SUSPEND_DBG) += suspend_dbg.o
obj-$(CONFIG_UX500_PM_PERFORMANCE) += performance.o
diff --git a/arch/arm/mach-ux500/pm/suspend.c b/arch/arm/mach-ux500/pm/suspend.c
index 8da91c3fbf0..96ee874d420 100644
--- a/arch/arm/mach-ux500/pm/suspend.c
+++ b/arch/arm/mach-ux500/pm/suspend.c
@@ -16,12 +16,16 @@
#include <mach/context.h>
#include <mach/pm.h>
+#include "suspend_dbg.h"
+
static int suspend(bool do_deepsleep)
{
int ret = 0;
nmk_gpio_clocks_enable();
+ ux500_suspend_dbg_add_wake_on_uart();
+
nmk_gpio_wakeups_suspend();
/* configure the prcm for a sleep wakeup */
@@ -88,6 +92,8 @@ exit:
nmk_gpio_wakeups_resume();
+ ux500_suspend_dbg_remove_wake_on_uart();
+
nmk_gpio_clocks_disable();
return ret;
diff --git a/arch/arm/mach-ux500/pm/suspend_dbg.c b/arch/arm/mach-ux500/pm/suspend_dbg.c
new file mode 100644
index 00000000000..601b1282230
--- /dev/null
+++ b/arch/arm/mach-ux500/pm/suspend_dbg.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2010-2011
+ *
+ * License Terms: GNU General Public License v2
+ *
+ * Author: Rickard Andersson <rickard.andersson@stericsson.com>,
+ * Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+#include <linux/gpio.h>
+
+#ifdef CONFIG_UX500_SUSPEND_DBG_WAKE_ON_UART
+void ux500_suspend_dbg_add_wake_on_uart(void)
+{
+ irq_set_irq_wake(GPIO_TO_IRQ(CONFIG_UX500_CONSOLE_UART_GPIO_PIN), 1);
+ irq_set_irq_type(GPIO_TO_IRQ(CONFIG_UX500_CONSOLE_UART_GPIO_PIN),
+ IRQ_TYPE_EDGE_BOTH);
+}
+
+void ux500_suspend_dbg_remove_wake_on_uart(void)
+{
+ irq_set_irq_wake(GPIO_TO_IRQ(CONFIG_UX500_CONSOLE_UART_GPIO_PIN), 0);
+}
+#endif
diff --git a/arch/arm/mach-ux500/pm/suspend_dbg.h b/arch/arm/mach-ux500/pm/suspend_dbg.h
new file mode 100644
index 00000000000..36132391774
--- /dev/null
+++ b/arch/arm/mach-ux500/pm/suspend_dbg.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2010-2011
+ *
+ * License Terms: GNU General Public License v2
+ *
+ * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
+ *
+ */
+
+#ifndef UX500_SUSPEND_DBG_H
+#define UX500_SUSPEND_DBG_H
+
+#ifdef CONFIG_UX500_SUSPEND_DBG_WAKE_ON_UART
+void ux500_suspend_dbg_add_wake_on_uart(void);
+void ux500_suspend_dbg_remove_wake_on_uart(void);
+#else
+static inline void ux500_suspend_dbg_add_wake_on_uart(void) { }
+static inline void ux500_suspend_dbg_remove_wake_on_uart(void) { }
+#endif
+
+#endif