diff options
author | Ben Dooks <ben-linux@fluff.org> | 2006-09-22 10:42:18 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-09-27 04:35:04 -0400 |
commit | 4b053e7a320882fbdbc6613cec60a929553b4215 (patch) | |
tree | c6c8d41fe2df1ec65ae4c5d31390109477274dfd /arch/arm | |
parent | da56c949261d462452a68cf05bfc645445bee830 (diff) |
[ARM] 3858/1: S3C2412: power management code
Add S3C2412 power management code, and move the
core register saving in from s3c2412.c
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-s3c2410/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/s3c2412-pm.c | 128 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/s3c2412.c | 40 |
4 files changed, 137 insertions, 40 deletions
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig index 458b36b2353b..e50a73f93d3d 100644 --- a/arch/arm/mach-s3c2410/Kconfig +++ b/arch/arm/mach-s3c2410/Kconfig | |||
@@ -176,6 +176,13 @@ config CPU_S3C2412_ONLY | |||
176 | !CPU_S3C2440 && !CPU_S3C2442 && CPU_S3C2412 | 176 | !CPU_S3C2440 && !CPU_S3C2442 && CPU_S3C2412 |
177 | default y if CPU_S3C2412 | 177 | default y if CPU_S3C2412 |
178 | 178 | ||
179 | config S3C2412_PM | ||
180 | bool | ||
181 | default y if PM | ||
182 | depends on CPU_S3C2412 | ||
183 | help | ||
184 | Internal config node to apply S3C2412 power management | ||
185 | |||
179 | config CPU_S3C2412 | 186 | config CPU_S3C2412 |
180 | bool | 187 | bool |
181 | depends on ARCH_S3C2410 | 188 | depends on ARCH_S3C2410 |
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile index 94aef371a529..d66013365b6b 100644 --- a/arch/arm/mach-s3c2410/Makefile +++ b/arch/arm/mach-s3c2410/Makefile | |||
@@ -38,6 +38,8 @@ obj-$(CONFIG_CPU_S3C2412) += s3c2412-irq.o | |||
38 | obj-$(CONFIG_CPU_S3C2412) += s3c2412-clock.o | 38 | obj-$(CONFIG_CPU_S3C2412) += s3c2412-clock.o |
39 | obj-dma-$(CONFIG_CPU_S3C2412) += s3c2412-dma.o | 39 | obj-dma-$(CONFIG_CPU_S3C2412) += s3c2412-dma.o |
40 | 40 | ||
41 | obj-$(CONFIG_S3C2412_PM) += s3c2412-pm.o | ||
42 | |||
41 | # | 43 | # |
42 | # S3C244X support | 44 | # S3C244X support |
43 | 45 | ||
diff --git a/arch/arm/mach-s3c2410/s3c2412-pm.c b/arch/arm/mach-s3c2410/s3c2412-pm.c new file mode 100644 index 000000000000..19b63322d259 --- /dev/null +++ b/arch/arm/mach-s3c2410/s3c2412-pm.c | |||
@@ -0,0 +1,128 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/s3c2412-pm.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://armlinux.simtec.co.uk/. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/sysdev.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | |||
22 | #include <asm/hardware.h> | ||
23 | #include <asm/io.h> | ||
24 | #include <asm/irq.h> | ||
25 | |||
26 | #include <asm/arch/regs-power.h> | ||
27 | #include <asm/arch/regs-gpioj.h> | ||
28 | #include <asm/arch/regs-gpio.h> | ||
29 | #include <asm/arch/regs-dsc.h> | ||
30 | |||
31 | #include "cpu.h" | ||
32 | #include "pm.h" | ||
33 | |||
34 | #include "s3c2412.h" | ||
35 | |||
36 | static void s3c2412_cpu_suspend(void) | ||
37 | { | ||
38 | unsigned long tmp; | ||
39 | |||
40 | /* set our standby method to sleep */ | ||
41 | |||
42 | tmp = __raw_readl(S3C2412_PWRCFG); | ||
43 | tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP; | ||
44 | __raw_writel(tmp, S3C2412_PWRCFG); | ||
45 | |||
46 | /* issue the standby signal into the pm unit. Note, we | ||
47 | * issue a write-buffer drain just in case */ | ||
48 | |||
49 | tmp = 0; | ||
50 | |||
51 | asm("b 1f\n\t" | ||
52 | ".align 5\n\t" | ||
53 | "1:\n\t" | ||
54 | "mcr p15, 0, %0, c7, c10, 4\n\t" | ||
55 | "mcr p15, 0, %0, c7, c0, 4" :: "r" (tmp)); | ||
56 | |||
57 | /* we should never get past here */ | ||
58 | |||
59 | panic("sleep resumed to originator?"); | ||
60 | } | ||
61 | |||
62 | static void s3c2412_pm_prepare(void) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | static int s3c2412_pm_add(struct sys_device *sysdev) | ||
67 | { | ||
68 | pm_cpu_prep = s3c2412_pm_prepare; | ||
69 | pm_cpu_sleep = s3c2412_cpu_suspend; | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static struct sleep_save s3c2412_sleep[] = { | ||
75 | SAVE_ITEM(S3C2412_DSC0), | ||
76 | SAVE_ITEM(S3C2412_DSC1), | ||
77 | SAVE_ITEM(S3C2413_GPJDAT), | ||
78 | SAVE_ITEM(S3C2413_GPJCON), | ||
79 | SAVE_ITEM(S3C2413_GPJUP), | ||
80 | |||
81 | /* save the PWRCFG to get back to original sleep method */ | ||
82 | |||
83 | SAVE_ITEM(S3C2412_PWRCFG), | ||
84 | |||
85 | /* save the sleep configuration anyway, just in case these | ||
86 | * get damaged during wakeup */ | ||
87 | |||
88 | SAVE_ITEM(S3C2412_GPBSLPCON), | ||
89 | SAVE_ITEM(S3C2412_GPCSLPCON), | ||
90 | SAVE_ITEM(S3C2412_GPDSLPCON), | ||
91 | SAVE_ITEM(S3C2412_GPESLPCON), | ||
92 | SAVE_ITEM(S3C2412_GPFSLPCON), | ||
93 | SAVE_ITEM(S3C2412_GPGSLPCON), | ||
94 | SAVE_ITEM(S3C2412_GPHSLPCON), | ||
95 | SAVE_ITEM(S3C2413_GPJSLPCON), | ||
96 | }; | ||
97 | |||
98 | static int s3c2412_pm_suspend(struct sys_device *dev, pm_message_t state) | ||
99 | { | ||
100 | s3c2410_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static int s3c2412_pm_resume(struct sys_device *dev) | ||
105 | { | ||
106 | unsigned long tmp; | ||
107 | |||
108 | tmp = __raw_readl(S3C2412_PWRCFG); | ||
109 | tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK; | ||
110 | tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE; | ||
111 | __raw_writel(tmp, S3C2412_PWRCFG); | ||
112 | |||
113 | s3c2410_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static struct sysdev_driver s3c2412_pm_driver = { | ||
118 | .add = s3c2412_pm_add, | ||
119 | .suspend = s3c2412_pm_suspend, | ||
120 | .resume = s3c2412_pm_resume, | ||
121 | }; | ||
122 | |||
123 | static __init int s3c2412_pm_init(void) | ||
124 | { | ||
125 | return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver); | ||
126 | } | ||
127 | |||
128 | arch_initcall(s3c2412_pm_init); | ||
diff --git a/arch/arm/mach-s3c2410/s3c2412.c b/arch/arm/mach-s3c2410/s3c2412.c index ea25078cf4f8..e76431c41461 100644 --- a/arch/arm/mach-s3c2410/s3c2412.c +++ b/arch/arm/mach-s3c2410/s3c2412.c | |||
@@ -158,48 +158,8 @@ void __init s3c2412_init_clocks(int xtal) | |||
158 | * as a driver which may support both 2410 and 2440 may try and use it. | 158 | * as a driver which may support both 2410 and 2440 may try and use it. |
159 | */ | 159 | */ |
160 | 160 | ||
161 | #ifdef CONFIG_PM | ||
162 | static struct sleep_save s3c2412_sleep[] = { | ||
163 | SAVE_ITEM(S3C2412_DSC0), | ||
164 | SAVE_ITEM(S3C2412_DSC1), | ||
165 | SAVE_ITEM(S3C2413_GPJDAT), | ||
166 | SAVE_ITEM(S3C2413_GPJCON), | ||
167 | SAVE_ITEM(S3C2413_GPJUP), | ||
168 | |||
169 | /* save the sleep configuration anyway, just in case these | ||
170 | * get damaged during wakeup */ | ||
171 | |||
172 | SAVE_ITEM(S3C2412_GPBSLPCON), | ||
173 | SAVE_ITEM(S3C2412_GPCSLPCON), | ||
174 | SAVE_ITEM(S3C2412_GPDSLPCON), | ||
175 | SAVE_ITEM(S3C2412_GPESLPCON), | ||
176 | SAVE_ITEM(S3C2412_GPFSLPCON), | ||
177 | SAVE_ITEM(S3C2412_GPGSLPCON), | ||
178 | SAVE_ITEM(S3C2412_GPHSLPCON), | ||
179 | SAVE_ITEM(S3C2413_GPJSLPCON), | ||
180 | }; | ||
181 | |||
182 | static int s3c2412_suspend(struct sys_device *dev, pm_message_t state) | ||
183 | { | ||
184 | s3c2410_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static int s3c2412_resume(struct sys_device *dev) | ||
189 | { | ||
190 | s3c2410_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep)); | ||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | #else | ||
195 | #define s3c2412_suspend NULL | ||
196 | #define s3c2412_resume NULL | ||
197 | #endif | ||
198 | |||
199 | struct sysdev_class s3c2412_sysclass = { | 161 | struct sysdev_class s3c2412_sysclass = { |
200 | set_kset_name("s3c2412-core"), | 162 | set_kset_name("s3c2412-core"), |
201 | .suspend = s3c2412_suspend, | ||
202 | .resume = s3c2412_resume | ||
203 | }; | 163 | }; |
204 | 164 | ||
205 | static int __init s3c2412_core_init(void) | 165 | static int __init s3c2412_core_init(void) |