diff options
author | Jonghwan Choi <jhbird.choi@samsung.com> | 2011-08-24 08:52:45 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-09-16 03:39:05 -0400 |
commit | acd35616c7a30130d3b43ae1c1bb0b7fd121ffb9 (patch) | |
tree | 3ddf2cdd1d64395a8496c6ea9c7dc67a9b701281 /arch/arm/mach-exynos4/clock.c | |
parent | 2bc02c0daae146283ce1b20da6864a27c848812e (diff) |
ARM: EXYNOS4: Add support PM for EXYNOS4212
This patch moves regarding clock stuff of PM into clock
file to support PM on EXYNOS4210 and EXYNOS4212 with one
single kernel image. Because some clock registers are
different on each SoCs.
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
[kgene.kim@samsung.com: use CONFIG_PM_SLEEP instead of CONFIG_PM]
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-exynos4/clock.c')
-rw-r--r-- | arch/arm/mach-exynos4/clock.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c index eb99467d6762..f26aea3e1bbf 100644 --- a/arch/arm/mach-exynos4/clock.c +++ b/arch/arm/mach-exynos4/clock.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/syscore_ops.h> | ||
16 | 17 | ||
17 | #include <plat/cpu-freq.h> | 18 | #include <plat/cpu-freq.h> |
18 | #include <plat/clock.h> | 19 | #include <plat/clock.h> |
@@ -21,12 +22,77 @@ | |||
21 | #include <plat/s5p-clock.h> | 22 | #include <plat/s5p-clock.h> |
22 | #include <plat/clock-clksrc.h> | 23 | #include <plat/clock-clksrc.h> |
23 | #include <plat/exynos4.h> | 24 | #include <plat/exynos4.h> |
25 | #include <plat/pm.h> | ||
24 | 26 | ||
25 | #include <mach/map.h> | 27 | #include <mach/map.h> |
26 | #include <mach/regs-clock.h> | 28 | #include <mach/regs-clock.h> |
27 | #include <mach/sysmmu.h> | 29 | #include <mach/sysmmu.h> |
28 | #include <mach/exynos4-clock.h> | 30 | #include <mach/exynos4-clock.h> |
29 | 31 | ||
32 | static struct sleep_save exynos4_clock_save[] = { | ||
33 | SAVE_ITEM(S5P_CLKDIV_LEFTBUS), | ||
34 | SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS), | ||
35 | SAVE_ITEM(S5P_CLKDIV_RIGHTBUS), | ||
36 | SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS), | ||
37 | SAVE_ITEM(S5P_CLKSRC_TOP0), | ||
38 | SAVE_ITEM(S5P_CLKSRC_TOP1), | ||
39 | SAVE_ITEM(S5P_CLKSRC_CAM), | ||
40 | SAVE_ITEM(S5P_CLKSRC_TV), | ||
41 | SAVE_ITEM(S5P_CLKSRC_MFC), | ||
42 | SAVE_ITEM(S5P_CLKSRC_G3D), | ||
43 | SAVE_ITEM(S5P_CLKSRC_LCD0), | ||
44 | SAVE_ITEM(S5P_CLKSRC_MAUDIO), | ||
45 | SAVE_ITEM(S5P_CLKSRC_FSYS), | ||
46 | SAVE_ITEM(S5P_CLKSRC_PERIL0), | ||
47 | SAVE_ITEM(S5P_CLKSRC_PERIL1), | ||
48 | SAVE_ITEM(S5P_CLKDIV_CAM), | ||
49 | SAVE_ITEM(S5P_CLKDIV_TV), | ||
50 | SAVE_ITEM(S5P_CLKDIV_MFC), | ||
51 | SAVE_ITEM(S5P_CLKDIV_G3D), | ||
52 | SAVE_ITEM(S5P_CLKDIV_LCD0), | ||
53 | SAVE_ITEM(S5P_CLKDIV_MAUDIO), | ||
54 | SAVE_ITEM(S5P_CLKDIV_FSYS0), | ||
55 | SAVE_ITEM(S5P_CLKDIV_FSYS1), | ||
56 | SAVE_ITEM(S5P_CLKDIV_FSYS2), | ||
57 | SAVE_ITEM(S5P_CLKDIV_FSYS3), | ||
58 | SAVE_ITEM(S5P_CLKDIV_PERIL0), | ||
59 | SAVE_ITEM(S5P_CLKDIV_PERIL1), | ||
60 | SAVE_ITEM(S5P_CLKDIV_PERIL2), | ||
61 | SAVE_ITEM(S5P_CLKDIV_PERIL3), | ||
62 | SAVE_ITEM(S5P_CLKDIV_PERIL4), | ||
63 | SAVE_ITEM(S5P_CLKDIV_PERIL5), | ||
64 | SAVE_ITEM(S5P_CLKDIV_TOP), | ||
65 | SAVE_ITEM(S5P_CLKSRC_MASK_TOP), | ||
66 | SAVE_ITEM(S5P_CLKSRC_MASK_CAM), | ||
67 | SAVE_ITEM(S5P_CLKSRC_MASK_TV), | ||
68 | SAVE_ITEM(S5P_CLKSRC_MASK_LCD0), | ||
69 | SAVE_ITEM(S5P_CLKSRC_MASK_MAUDIO), | ||
70 | SAVE_ITEM(S5P_CLKSRC_MASK_FSYS), | ||
71 | SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0), | ||
72 | SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1), | ||
73 | SAVE_ITEM(S5P_CLKDIV2_RATIO), | ||
74 | SAVE_ITEM(S5P_CLKGATE_SCLKCAM), | ||
75 | SAVE_ITEM(S5P_CLKGATE_IP_CAM), | ||
76 | SAVE_ITEM(S5P_CLKGATE_IP_TV), | ||
77 | SAVE_ITEM(S5P_CLKGATE_IP_MFC), | ||
78 | SAVE_ITEM(S5P_CLKGATE_IP_G3D), | ||
79 | SAVE_ITEM(S5P_CLKGATE_IP_LCD0), | ||
80 | SAVE_ITEM(S5P_CLKGATE_IP_FSYS), | ||
81 | SAVE_ITEM(S5P_CLKGATE_IP_GPS), | ||
82 | SAVE_ITEM(S5P_CLKGATE_IP_PERIL), | ||
83 | SAVE_ITEM(S5P_CLKGATE_BLOCK), | ||
84 | SAVE_ITEM(S5P_CLKSRC_MASK_DMC), | ||
85 | SAVE_ITEM(S5P_CLKSRC_DMC), | ||
86 | SAVE_ITEM(S5P_CLKDIV_DMC0), | ||
87 | SAVE_ITEM(S5P_CLKDIV_DMC1), | ||
88 | SAVE_ITEM(S5P_CLKGATE_IP_DMC), | ||
89 | SAVE_ITEM(S5P_CLKSRC_CPU), | ||
90 | SAVE_ITEM(S5P_CLKDIV_CPU), | ||
91 | SAVE_ITEM(S5P_CLKDIV_CPU + 0x4), | ||
92 | SAVE_ITEM(S5P_CLKGATE_SCLKCPU), | ||
93 | SAVE_ITEM(S5P_CLKGATE_IP_CPU), | ||
94 | }; | ||
95 | |||
30 | struct clk clk_sclk_hdmi27m = { | 96 | struct clk clk_sclk_hdmi27m = { |
31 | .name = "sclk_hdmi27m", | 97 | .name = "sclk_hdmi27m", |
32 | .rate = 27000000, | 98 | .rate = 27000000, |
@@ -1180,6 +1246,28 @@ static struct clk *clks[] __initdata = { | |||
1180 | /* Nothing here yet */ | 1246 | /* Nothing here yet */ |
1181 | }; | 1247 | }; |
1182 | 1248 | ||
1249 | #ifdef CONFIG_PM_SLEEP | ||
1250 | static int exynos4_clock_suspend(void) | ||
1251 | { | ||
1252 | s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); | ||
1253 | return 0; | ||
1254 | } | ||
1255 | |||
1256 | static void exynos4_clock_resume(void) | ||
1257 | { | ||
1258 | s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); | ||
1259 | } | ||
1260 | |||
1261 | #else | ||
1262 | #define exynos4_clock_suspend NULL | ||
1263 | #define exynos4_clock_resume NULL | ||
1264 | #endif | ||
1265 | |||
1266 | struct syscore_ops exynos4_clock_syscore_ops = { | ||
1267 | .suspend = exynos4_clock_suspend, | ||
1268 | .resume = exynos4_clock_resume, | ||
1269 | }; | ||
1270 | |||
1183 | void __init exynos4_register_clocks(void) | 1271 | void __init exynos4_register_clocks(void) |
1184 | { | 1272 | { |
1185 | int ptr; | 1273 | int ptr; |
@@ -1195,5 +1283,6 @@ void __init exynos4_register_clocks(void) | |||
1195 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 1283 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
1196 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | 1284 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
1197 | 1285 | ||
1286 | register_syscore_ops(&exynos4_clock_syscore_ops); | ||
1198 | s3c_pwmclk_init(); | 1287 | s3c_pwmclk_init(); |
1199 | } | 1288 | } |