Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / arch / arm / mach-s3c24xx / pm-s3c2416.c
CommitLineData
6436b6a7
AK
1/* linux/arch/arm/mach-s3c2416/pm.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM 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 version 2 as
10 * published by the Free Software Foundation.
11*/
12
4a858cfc 13#include <linux/device.h>
bb072c3c 14#include <linux/syscore_ops.h>
6436b6a7
AK
15#include <linux/io.h>
16
17#include <asm/cacheflush.h>
18
6436b6a7
AK
19#include <mach/regs-s3c2443-clock.h>
20
21#include <plat/cpu.h>
22#include <plat/pm.h>
23
14cce0e7
KK
24#include "s3c2412-power.h"
25
6436b6a7
AK
26extern void s3c2412_sleep_enter(void);
27
29cb3cd2 28static int s3c2416_cpu_suspend(unsigned long arg)
6436b6a7 29{
6436b6a7
AK
30 /* enable wakeup sources regardless of battery state */
31 __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG);
32
33 /* set the mode as sleep, 2BED represents "Go to BED" */
34 __raw_writel(0x2BED, S3C2443_PWRMODE);
35
36 s3c2412_sleep_enter();
29cb3cd2 37
d3fcacf5
AK
38 pr_info("Failed to suspend the system\n");
39 return 1; /* Aborting suspend */
6436b6a7
AK
40}
41
42static void s3c2416_pm_prepare(void)
43{
44 /*
45 * write the magic value u-boot uses to check for resume into
46 * the INFORM0 register, and ensure INFORM1 is set to the
47 * correct address to resume from.
48 */
49 __raw_writel(0x2BED, S3C2412_INFORM0);
50 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1);
51}
52
04511a6f 53static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif)
6436b6a7
AK
54{
55 pm_cpu_prep = s3c2416_pm_prepare;
56 pm_cpu_sleep = s3c2416_cpu_suspend;
57
58 return 0;
59}
60
4a858cfc
KS
61static struct subsys_interface s3c2416_pm_interface = {
62 .name = "s3c2416_pm",
63 .subsys = &s3c2416_subsys,
64 .add_dev = s3c2416_pm_add,
bb072c3c
RW
65};
66
67static __init int s3c2416_pm_init(void)
6436b6a7 68{
4a858cfc 69 return subsys_interface_register(&s3c2416_pm_interface);
6436b6a7
AK
70}
71
bb072c3c
RW
72arch_initcall(s3c2416_pm_init);
73
74
75static void s3c2416_pm_resume(void)
6436b6a7
AK
76{
77 /* unset the return-from-sleep amd inform flags */
78 __raw_writel(0x0, S3C2443_PWRMODE);
79 __raw_writel(0x0, S3C2412_INFORM0);
80 __raw_writel(0x0, S3C2412_INFORM1);
6436b6a7
AK
81}
82
bb072c3c 83struct syscore_ops s3c2416_pm_syscore_ops = {
6436b6a7
AK
84 .resume = s3c2416_pm_resume,
85};
This page took 0.154449 seconds and 5 git commands to generate.