summaryrefslogtreecommitdiffstats
path: root/patches/linux-3.12-rc4/0019-ARM-efm32-add-trivial-suspend-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/linux-3.12-rc4/0019-ARM-efm32-add-trivial-suspend-support.patch')
-rw-r--r--patches/linux-3.12-rc4/0019-ARM-efm32-add-trivial-suspend-support.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/patches/linux-3.12-rc4/0019-ARM-efm32-add-trivial-suspend-support.patch b/patches/linux-3.12-rc4/0019-ARM-efm32-add-trivial-suspend-support.patch
new file mode 100644
index 0000000..89f91da
--- /dev/null
+++ b/patches/linux-3.12-rc4/0019-ARM-efm32-add-trivial-suspend-support.patch
@@ -0,0 +1,101 @@
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Wed, 1 Feb 2012 10:00:21 +0100
+Subject: [PATCH] ARM: efm32: add trivial suspend support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+---
+ arch/arm/mach-efm32/Makefile | 2 ++
+ arch/arm/mach-efm32/cmu.h | 15 +++++++++++++
+ arch/arm/mach-efm32/pm.c | 50 ++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 67 insertions(+)
+ create mode 100644 arch/arm/mach-efm32/cmu.h
+ create mode 100644 arch/arm/mach-efm32/pm.c
+
+diff --git a/arch/arm/mach-efm32/Makefile b/arch/arm/mach-efm32/Makefile
+index 081f45a..b295a74 100644
+--- a/arch/arm/mach-efm32/Makefile
++++ b/arch/arm/mach-efm32/Makefile
+@@ -1 +1,3 @@
+ obj-y += common.o dtmachine.o
++
++obj-$(CONFIG_PM) += pm.o
+diff --git a/arch/arm/mach-efm32/cmu.h b/arch/arm/mach-efm32/cmu.h
+new file mode 100644
+index 0000000..a7e5741
+--- /dev/null
++++ b/arch/arm/mach-efm32/cmu.h
+@@ -0,0 +1,15 @@
++/*
++ * Register definition for efm32's CMU component
++ */
++
++#define CMU_OSCENCMD 0x20
++#define CMU_OSCENCMD_HFXOEN 0x00000004
++
++#define CMU_CMD 0x24
++#define CMU_CMD_HFCLKSEL_HFXO 0x00000002
++
++#define CMU_STATUS 0x2c
++#define CMU_STATUS_HFRCOSEL 0x00000400
++#define CMU_STATUS_HFXOSEL 0x00000800
++
++#define CMU_HFPERCLKEN0 0x44
+diff --git a/arch/arm/mach-efm32/pm.c b/arch/arm/mach-efm32/pm.c
+new file mode 100644
+index 0000000..282205e
+--- /dev/null
++++ b/arch/arm/mach-efm32/pm.c
+@@ -0,0 +1,50 @@
++#include <linux/init.h>
++#include <linux/suspend.h>
++
++#include <asm/io.h>
++#include <asm/v7m.h>
++
++#include "cmu.h"
++
++#define CMU_BASE IOMEM(0x400c8000)
++
++#define scb_writel(val, addroff) writel(val, BASEADDR_V7M_SCB + addroff)
++
++static int efm32_suspend_enter(suspend_state_t state)
++{
++ u32 cmu_status = readl(CMU_BASE + CMU_STATUS);
++
++ /*
++ * setting SLEEPDEEP makes the efm32 enter EM2 or EM3 (iff both
++ * LFACLK and LFBCLK are off).
++ */
++ scb_writel(V7M_SCB_SCR_SLEEPDEEP, V7M_SCB_SCR);
++
++ cpu_do_idle();
++
++ scb_writel(0, V7M_SCB_SCR);
++
++ /*
++ * deep sleep disables the HF oscilator, reenable it if it was on
++ * before.
++ */
++ if (cmu_status & CMU_STATUS_HFXOSEL) {
++ writel(CMU_OSCENCMD_HFXOEN, CMU_BASE + CMU_OSCENCMD);
++ writel(CMU_CMD_HFCLKSEL_HFXO, CMU_BASE + CMU_CMD);
++ }
++
++ return 0;
++}
++
++static const struct platform_suspend_ops efm32_suspend_ops = {
++ .valid = suspend_valid_only_mem,
++ .enter = efm32_suspend_enter,
++};
++
++static int __init efm32_pm_init(void)
++{
++ suspend_set_ops(&efm32_suspend_ops);
++
++ return 0;
++}
++arch_initcall(efm32_pm_init);