]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/arm/mach-s3c2412/pm.c
[ARM] 4727/1: S3C2412: Remove unused GPESLPCON
[mirror_ubuntu-zesty-kernel.git] / arch / arm / mach-s3c2412 / pm.c
CommitLineData
a21765a7 1/* linux/arch/arm/mach-s3c2412/pm.c
4b053e7a
BD
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
a21765a7
BD
31#include <asm/plat-s3c24xx/cpu.h>
32#include <asm/plat-s3c24xx/pm.h>
4b053e7a 33
a21765a7 34#include <asm/plat-s3c24xx/s3c2412.h>
4b053e7a
BD
35
36static 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
62static void s3c2412_pm_prepare(void)
63{
64}
65
66static 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
74static 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),
4b053e7a
BD
91 SAVE_ITEM(S3C2412_GPFSLPCON),
92 SAVE_ITEM(S3C2412_GPGSLPCON),
93 SAVE_ITEM(S3C2412_GPHSLPCON),
94 SAVE_ITEM(S3C2413_GPJSLPCON),
95};
96
97static int s3c2412_pm_suspend(struct sys_device *dev, pm_message_t state)
98{
99 s3c2410_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
100 return 0;
101}
102
103static int s3c2412_pm_resume(struct sys_device *dev)
104{
105 unsigned long tmp;
106
107 tmp = __raw_readl(S3C2412_PWRCFG);
108 tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
109 tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE;
110 __raw_writel(tmp, S3C2412_PWRCFG);
111
112 s3c2410_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
113 return 0;
114}
115
116static struct sysdev_driver s3c2412_pm_driver = {
117 .add = s3c2412_pm_add,
118 .suspend = s3c2412_pm_suspend,
119 .resume = s3c2412_pm_resume,
120};
121
122static __init int s3c2412_pm_init(void)
123{
124 return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver);
125}
126
127arch_initcall(s3c2412_pm_init);