diff options
author | Abhilash Kesavan <a.kesavan@samsung.com> | 2010-10-20 06:43:35 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2010-10-20 06:43:35 -0400 |
commit | 6436b6a7a64f946c5a5f3d8a8c0e6404e2bda8d5 (patch) | |
tree | 10d2ada270a00cdee0082b1048f9f8b331950c4a /arch/arm/mach-s3c2416 | |
parent | e0e451ea092915fa683e5fe7a9e52df33726a5ac (diff) |
ARM: S3C2416: Add Power Management support for SMDK2416
Adds suspend-to-ram support for SMDK2416 based on existing 2412 PM code
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s3c2416')
-rw-r--r-- | arch/arm/mach-s3c2416/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/irq.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/pm.c | 84 |
4 files changed, 93 insertions, 1 deletions
diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig index 657e4fe17f39..87b9c9f003bd 100644 --- a/arch/arm/mach-s3c2416/Kconfig +++ b/arch/arm/mach-s3c2416/Kconfig | |||
@@ -25,6 +25,11 @@ config S3C2416_DMA | |||
25 | help | 25 | help |
26 | Internal config node for S3C2416 DMA support | 26 | Internal config node for S3C2416 DMA support |
27 | 27 | ||
28 | config S3C2416_PM | ||
29 | bool | ||
30 | help | ||
31 | Internal config node to apply S3C2416 power management | ||
32 | |||
28 | menu "S3C2416 Machines" | 33 | menu "S3C2416 Machines" |
29 | 34 | ||
30 | config MACH_SMDK2416 | 35 | config MACH_SMDK2416 |
@@ -33,6 +38,7 @@ config MACH_SMDK2416 | |||
33 | select S3C_DEV_FB | 38 | select S3C_DEV_FB |
34 | select S3C_DEV_HSMMC | 39 | select S3C_DEV_HSMMC |
35 | select S3C_DEV_HSMMC1 | 40 | select S3C_DEV_HSMMC1 |
41 | select S3C2416_PM if PM | ||
36 | help | 42 | help |
37 | Say Y here if you are using an SMDK2416 | 43 | Say Y here if you are using an SMDK2416 |
38 | 44 | ||
diff --git a/arch/arm/mach-s3c2416/Makefile b/arch/arm/mach-s3c2416/Makefile index 6c12c7bf40ad..ef038d62ffdb 100644 --- a/arch/arm/mach-s3c2416/Makefile +++ b/arch/arm/mach-s3c2416/Makefile | |||
@@ -11,7 +11,7 @@ obj- := | |||
11 | 11 | ||
12 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock.o | 12 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock.o |
13 | obj-$(CONFIG_CPU_S3C2416) += irq.o | 13 | obj-$(CONFIG_CPU_S3C2416) += irq.o |
14 | 14 | obj-$(CONFIG_S3C2416_PM) += pm.o | |
15 | #obj-$(CONFIG_S3C2416_DMA) += dma.o | 15 | #obj-$(CONFIG_S3C2416_DMA) += dma.o |
16 | 16 | ||
17 | # Machine support | 17 | # Machine support |
diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c index 89f521d59d06..084d121f368c 100644 --- a/arch/arm/mach-s3c2416/irq.c +++ b/arch/arm/mach-s3c2416/irq.c | |||
@@ -243,6 +243,8 @@ static int __init s3c2416_irq_add(struct sys_device *sysdev) | |||
243 | 243 | ||
244 | static struct sysdev_driver s3c2416_irq_driver = { | 244 | static struct sysdev_driver s3c2416_irq_driver = { |
245 | .add = s3c2416_irq_add, | 245 | .add = s3c2416_irq_add, |
246 | .suspend = s3c24xx_irq_suspend, | ||
247 | .resume = s3c24xx_irq_resume, | ||
246 | }; | 248 | }; |
247 | 249 | ||
248 | static int __init s3c2416_irq_init(void) | 250 | static int __init s3c2416_irq_init(void) |
diff --git a/arch/arm/mach-s3c2416/pm.c b/arch/arm/mach-s3c2416/pm.c new file mode 100644 index 000000000000..4a04205b04d5 --- /dev/null +++ b/arch/arm/mach-s3c2416/pm.c | |||
@@ -0,0 +1,84 @@ | |||
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 | |||
13 | #include <linux/sysdev.h> | ||
14 | #include <linux/io.h> | ||
15 | |||
16 | #include <asm/cacheflush.h> | ||
17 | |||
18 | #include <mach/regs-power.h> | ||
19 | #include <mach/regs-s3c2443-clock.h> | ||
20 | |||
21 | #include <plat/cpu.h> | ||
22 | #include <plat/pm.h> | ||
23 | |||
24 | extern void s3c2412_sleep_enter(void); | ||
25 | |||
26 | static void s3c2416_cpu_suspend(void) | ||
27 | { | ||
28 | flush_cache_all(); | ||
29 | |||
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(); | ||
37 | } | ||
38 | |||
39 | static void s3c2416_pm_prepare(void) | ||
40 | { | ||
41 | /* | ||
42 | * write the magic value u-boot uses to check for resume into | ||
43 | * the INFORM0 register, and ensure INFORM1 is set to the | ||
44 | * correct address to resume from. | ||
45 | */ | ||
46 | __raw_writel(0x2BED, S3C2412_INFORM0); | ||
47 | __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); | ||
48 | } | ||
49 | |||
50 | static int s3c2416_pm_add(struct sys_device *sysdev) | ||
51 | { | ||
52 | pm_cpu_prep = s3c2416_pm_prepare; | ||
53 | pm_cpu_sleep = s3c2416_cpu_suspend; | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static int s3c2416_pm_suspend(struct sys_device *dev, pm_message_t state) | ||
59 | { | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int s3c2416_pm_resume(struct sys_device *dev) | ||
64 | { | ||
65 | /* unset the return-from-sleep amd inform flags */ | ||
66 | __raw_writel(0x0, S3C2443_PWRMODE); | ||
67 | __raw_writel(0x0, S3C2412_INFORM0); | ||
68 | __raw_writel(0x0, S3C2412_INFORM1); | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static struct sysdev_driver s3c2416_pm_driver = { | ||
74 | .add = s3c2416_pm_add, | ||
75 | .suspend = s3c2416_pm_suspend, | ||
76 | .resume = s3c2416_pm_resume, | ||
77 | }; | ||
78 | |||
79 | static __init int s3c2416_pm_init(void) | ||
80 | { | ||
81 | return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver); | ||
82 | } | ||
83 | |||
84 | arch_initcall(s3c2416_pm_init); | ||