[ARM] 3803/2: S3C24XX: PM split S3C2410 out of core pm
[firewire-audio.git] / arch / arm / mach-s3c2410 / s3c2410-pm.c
blob3080d25a12de627aa1835f0ed9105d758b4a6a5c
1 /* linux/arch/arm/mach-s3c2410/s3c2410-pm.c
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * S3C2410 (and compatible) Power Manager (Suspend-To-RAM) support
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.
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.
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
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>
29 #include <asm/hardware.h>
30 #include <asm/io.h>
32 #include <asm/arch/regs-gpio.h>
34 #include "cpu.h"
35 #include "pm.h"
37 #ifdef CONFIG_S3C2410_PM_DEBUG
38 extern void pm_dbg(const char *fmt, ...);
39 #define DBG(fmt...) pm_dbg(fmt)
40 #else
41 #define DBG(fmt...) printk(KERN_DEBUG fmt)
42 #endif
44 static void s3c2410_pm_prepare(void)
46 /* ensure at least GSTATUS3 has the resume address */
48 __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2410_GSTATUS3);
50 DBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
51 DBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
54 int s3c2410_pm_resume(struct sys_device *dev)
56 unsigned long tmp;
58 /* unset the return-from-sleep flag, to ensure reset */
60 tmp = __raw_readl(S3C2410_GSTATUS2);
61 tmp &= S3C2410_GSTATUS2_OFFRESET;
62 __raw_writel(tmp, S3C2410_GSTATUS2);
64 return 0;
67 static int s3c2410_pm_add(struct sys_device *dev)
69 pm_cpu_prep = s3c2410_pm_prepare;
70 pm_cpu_sleep = s3c2410_cpu_suspend;
72 return 0;
75 static struct sysdev_driver s3c2410_pm_driver = {
76 .add = s3c2410_pm_add,
77 .resume = s3c2410_pm_resume,
80 /* register ourselves */
82 static int __init s3c2410_pm_drvinit(void)
84 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_pm_driver);
87 arch_initcall(s3c2410_pm_drvinit);
89 static struct sysdev_driver s3c2440_pm_driver = {
90 .add = s3c2410_pm_add,
91 .resume = s3c2410_pm_resume,
94 static int __init s3c2440_pm_drvinit(void)
96 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_pm_driver);
99 arch_initcall(s3c2440_pm_drvinit);
101 static struct sysdev_driver s3c2442_pm_driver = {
102 .add = s3c2410_pm_add,
103 .resume = s3c2410_pm_resume,
106 static int __init s3c2442_pm_drvinit(void)
108 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_pm_driver);
111 arch_initcall(s3c2442_pm_drvinit);