aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2410/s3c2410-pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-s3c2410/s3c2410-pm.c')
-rw-r--r--arch/arm/mach-s3c2410/s3c2410-pm.c120
1 files changed, 120 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c2410/s3c2410-pm.c b/arch/arm/mach-s3c2410/s3c2410-pm.c
new file mode 100644
index 000000000000..e51d76669512
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2410-pm.c
@@ -0,0 +1,120 @@
1/* linux/arch/arm/mach-s3c2410/s3c2410-pm.c
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 (and compatible) Power Manager (Suspend-To-RAM) support
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <linux/init.h>
24#include <linux/suspend.h>
25#include <linux/errno.h>
26#include <linux/time.h>
27#include <linux/sysdev.h>
28
29#include <asm/hardware.h>
30#include <asm/io.h>
31
32#include <asm/mach-types.h>
33
34#include <asm/arch/regs-gpio.h>
35
36#include "cpu.h"
37#include "pm.h"
38
39#ifdef CONFIG_S3C2410_PM_DEBUG
40extern void pm_dbg(const char *fmt, ...);
41#define DBG(fmt...) pm_dbg(fmt)
42#else
43#define DBG(fmt...) printk(KERN_DEBUG fmt)
44#endif
45
46static void s3c2410_pm_prepare(void)
47{
48 /* ensure at least GSTATUS3 has the resume address */
49
50 __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2410_GSTATUS3);
51
52 DBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
53 DBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
54
55 if ( machine_is_aml_m5900() )
56 s3c2410_gpio_setpin(S3C2410_GPF2, 1);
57
58}
59
60int s3c2410_pm_resume(struct sys_device *dev)
61{
62 unsigned long tmp;
63
64 /* unset the return-from-sleep flag, to ensure reset */
65
66 tmp = __raw_readl(S3C2410_GSTATUS2);
67 tmp &= S3C2410_GSTATUS2_OFFRESET;
68 __raw_writel(tmp, S3C2410_GSTATUS2);
69
70 if ( machine_is_aml_m5900() )
71 s3c2410_gpio_setpin(S3C2410_GPF2, 0);
72
73 return 0;
74}
75
76static int s3c2410_pm_add(struct sys_device *dev)
77{
78 pm_cpu_prep = s3c2410_pm_prepare;
79 pm_cpu_sleep = s3c2410_cpu_suspend;
80
81 return 0;
82}
83
84static struct sysdev_driver s3c2410_pm_driver = {
85 .add = s3c2410_pm_add,
86 .resume = s3c2410_pm_resume,
87};
88
89/* register ourselves */
90
91static int __init s3c2410_pm_drvinit(void)
92{
93 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_pm_driver);
94}
95
96arch_initcall(s3c2410_pm_drvinit);
97
98static struct sysdev_driver s3c2440_pm_driver = {
99 .add = s3c2410_pm_add,
100 .resume = s3c2410_pm_resume,
101};
102
103static int __init s3c2440_pm_drvinit(void)
104{
105 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_pm_driver);
106}
107
108arch_initcall(s3c2440_pm_drvinit);
109
110static struct sysdev_driver s3c2442_pm_driver = {
111 .add = s3c2410_pm_add,
112 .resume = s3c2410_pm_resume,
113};
114
115static int __init s3c2442_pm_drvinit(void)
116{
117 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_pm_driver);
118}
119
120arch_initcall(s3c2442_pm_drvinit);