1 /* linux/arch/arm/mach-s3c2416/pm.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM 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 version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/device.h>
14 #include <linux/syscore_ops.h>
17 #include <asm/cacheflush.h>
19 #include <mach/regs-s3c2443-clock.h>
24 #include "s3c2412-power.h"
26 #ifdef CONFIG_PM_SLEEP
27 extern void s3c2412_sleep_enter(void);
29 static int s3c2416_cpu_suspend(unsigned long arg
)
31 /* enable wakeup sources regardless of battery state */
32 __raw_writel(S3C2443_PWRCFG_SLEEP
, S3C2443_PWRCFG
);
34 /* set the mode as sleep, 2BED represents "Go to BED" */
35 __raw_writel(0x2BED, S3C2443_PWRMODE
);
37 s3c2412_sleep_enter();
39 pr_info("Failed to suspend the system\n");
40 return 1; /* Aborting suspend */
43 static void s3c2416_pm_prepare(void)
46 * write the magic value u-boot uses to check for resume into
47 * the INFORM0 register, and ensure INFORM1 is set to the
48 * correct address to resume from.
50 __raw_writel(0x2BED, S3C2412_INFORM0
);
51 __raw_writel(virt_to_phys(s3c_cpu_resume
), S3C2412_INFORM1
);
54 static int s3c2416_pm_add(struct device
*dev
, struct subsys_interface
*sif
)
56 pm_cpu_prep
= s3c2416_pm_prepare
;
57 pm_cpu_sleep
= s3c2416_cpu_suspend
;
62 static struct subsys_interface s3c2416_pm_interface
= {
64 .subsys
= &s3c2416_subsys
,
65 .add_dev
= s3c2416_pm_add
,
68 static __init
int s3c2416_pm_init(void)
70 return subsys_interface_register(&s3c2416_pm_interface
);
73 arch_initcall(s3c2416_pm_init
);
76 static void s3c2416_pm_resume(void)
78 /* unset the return-from-sleep amd inform flags */
79 __raw_writel(0x0, S3C2443_PWRMODE
);
80 __raw_writel(0x0, S3C2412_INFORM0
);
81 __raw_writel(0x0, S3C2412_INFORM1
);
84 struct syscore_ops s3c2416_pm_syscore_ops
= {
85 .resume
= s3c2416_pm_resume
,