diff options
author | Magnus Damm <damm@opensource.se> | 2011-04-28 13:23:28 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-05-24 22:19:17 -0400 |
commit | c3dada1894de46139c21352a1000c0fd02d308d5 (patch) | |
tree | 5486666006f9e377ad0585a4b4b2a0bf656646be | |
parent | cac6f98dfca51ec2dc906064ba0bf8be4f820ba0 (diff) |
ARM: mach-shmobile: Suspend-to-RAM support
This patch adds a simple Suspend-to-RAM implementation
for SH-Mobile ARM. The struct shmobile_suspend_ops are
kept global to allow cpu-specific code to override
the callbacks if needed.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/arm/mach-shmobile/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/suspend.c | 47 |
3 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index e2507f66f9d5..a3cad5360a71 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile | |||
@@ -30,6 +30,9 @@ obj-$(CONFIG_ARCH_SH7377) += entry-intc.o | |||
30 | obj-$(CONFIG_ARCH_SH7372) += entry-intc.o | 30 | obj-$(CONFIG_ARCH_SH7372) += entry-intc.o |
31 | obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o | 31 | obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o |
32 | 32 | ||
33 | # PM objects | ||
34 | obj-$(CONFIG_SUSPEND) += suspend.o | ||
35 | |||
33 | # Board objects | 36 | # Board objects |
34 | obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o | 37 | obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o |
35 | obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o | 38 | obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o |
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index 013ac0ee8256..39b78bb80e09 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -8,6 +8,7 @@ struct clk; | |||
8 | extern int clk_init(void); | 8 | extern int clk_init(void); |
9 | extern void shmobile_handle_irq_intc(struct pt_regs *); | 9 | extern void shmobile_handle_irq_intc(struct pt_regs *); |
10 | extern void shmobile_handle_irq_gic(struct pt_regs *); | 10 | extern void shmobile_handle_irq_gic(struct pt_regs *); |
11 | extern struct platform_suspend_ops shmobile_suspend_ops; | ||
11 | 12 | ||
12 | extern void sh7367_init_irq(void); | 13 | extern void sh7367_init_irq(void); |
13 | extern void sh7367_add_early_devices(void); | 14 | extern void sh7367_add_early_devices(void); |
diff --git a/arch/arm/mach-shmobile/suspend.c b/arch/arm/mach-shmobile/suspend.c new file mode 100644 index 000000000000..c1febe13f709 --- /dev/null +++ b/arch/arm/mach-shmobile/suspend.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Suspend-to-RAM support code for SH-Mobile ARM | ||
3 | * | ||
4 | * Copyright (C) 2011 Magnus Damm | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/pm.h> | ||
12 | #include <linux/suspend.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <asm/system.h> | ||
16 | #include <asm/io.h> | ||
17 | |||
18 | static int shmobile_suspend_default_enter(suspend_state_t suspend_state) | ||
19 | { | ||
20 | cpu_do_idle(); | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | static int shmobile_suspend_begin(suspend_state_t state) | ||
25 | { | ||
26 | disable_hlt(); | ||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static void shmobile_suspend_end(void) | ||
31 | { | ||
32 | enable_hlt(); | ||
33 | } | ||
34 | |||
35 | struct platform_suspend_ops shmobile_suspend_ops = { | ||
36 | .begin = shmobile_suspend_begin, | ||
37 | .end = shmobile_suspend_end, | ||
38 | .enter = shmobile_suspend_default_enter, | ||
39 | .valid = suspend_valid_only_mem, | ||
40 | }; | ||
41 | |||
42 | static int __init shmobile_suspend_init(void) | ||
43 | { | ||
44 | suspend_set_ops(&shmobile_suspend_ops); | ||
45 | return 0; | ||
46 | } | ||
47 | late_initcall(shmobile_suspend_init); | ||