aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2014-02-13 18:16:00 -0500
committerKukjin Kim <kgene.kim@samsung.com>2014-02-13 18:16:00 -0500
commitc3b6c1d7015a5a19d87725fe22b58aeea9a88f3c (patch)
tree97992401f059f73262cf568dbe9dced8180f07ef
parentb7b647be157c9503aec9ce3c7d7e86205a6c39dc (diff)
clk: samsung: exynos5250: Move suspend/resume handling to SoC driver
Since there are multiple differences in how suspend/resume of particular Exynos SoCs must be handled, SoC driver is better place for suspend/resume handlers and so this patch moves them. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Thomas Abraham <thomas.ab@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--drivers/clk/samsung/clk-exynos5250.c49
-rw-r--r--drivers/clk/samsung/clk.c5
-rw-r--r--drivers/clk/samsung/clk.h4
3 files changed, 49 insertions, 9 deletions
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c
index ff4beebe1f0b..b3cccf044607 100644
--- a/drivers/clk/samsung/clk-exynos5250.c
+++ b/drivers/clk/samsung/clk-exynos5250.c
@@ -16,6 +16,7 @@
16#include <linux/clk-provider.h> 16#include <linux/clk-provider.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_address.h> 18#include <linux/of_address.h>
19#include <linux/syscore_ops.h>
19 20
20#include "clk.h" 21#include "clk.h"
21 22
@@ -85,6 +86,11 @@ enum exynos5250_plls {
85 nr_plls /* number of PLLs */ 86 nr_plls /* number of PLLs */
86}; 87};
87 88
89static void __iomem *reg_base;
90
91#ifdef CONFIG_PM_SLEEP
92static struct samsung_clk_reg_dump *exynos5250_save;
93
88/* 94/*
89 * list of controller registers to be saved and restored during a 95 * list of controller registers to be saved and restored during a
90 * suspend/resume cycle. 96 * suspend/resume cycle.
@@ -137,6 +143,41 @@ static unsigned long exynos5250_clk_regs[] __initdata = {
137 GATE_IP_ACP, 143 GATE_IP_ACP,
138}; 144};
139 145
146static int exynos5250_clk_suspend(void)
147{
148 samsung_clk_save(reg_base, exynos5250_save,
149 ARRAY_SIZE(exynos5250_clk_regs));
150
151 return 0;
152}
153
154static void exynos5250_clk_resume(void)
155{
156 samsung_clk_restore(reg_base, exynos5250_save,
157 ARRAY_SIZE(exynos5250_clk_regs));
158}
159
160static struct syscore_ops exynos5250_clk_syscore_ops = {
161 .suspend = exynos5250_clk_suspend,
162 .resume = exynos5250_clk_resume,
163};
164
165static void exynos5250_clk_sleep_init(void)
166{
167 exynos5250_save = samsung_clk_alloc_reg_dump(exynos5250_clk_regs,
168 ARRAY_SIZE(exynos5250_clk_regs));
169 if (!exynos5250_save) {
170 pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
171 __func__);
172 return;
173 }
174
175 register_syscore_ops(&exynos5250_clk_syscore_ops);
176}
177#else
178static void exynos5250_clk_sleep_init(void) {}
179#endif
180
140/* list of all parent clock list */ 181/* list of all parent clock list */
141PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; 182PNAME(mout_apll_p) = { "fin_pll", "fout_apll", };
142PNAME(mout_cpu_p) = { "mout_apll", "mout_mpll", }; 183PNAME(mout_cpu_p) = { "mout_apll", "mout_mpll", };
@@ -645,8 +686,6 @@ static struct of_device_id ext_clk_match[] __initdata = {
645/* register exynox5250 clocks */ 686/* register exynox5250 clocks */
646static void __init exynos5250_clk_init(struct device_node *np) 687static void __init exynos5250_clk_init(struct device_node *np)
647{ 688{
648 void __iomem *reg_base;
649
650 if (np) { 689 if (np) {
651 reg_base = of_iomap(np, 0); 690 reg_base = of_iomap(np, 0);
652 if (!reg_base) 691 if (!reg_base)
@@ -655,9 +694,7 @@ static void __init exynos5250_clk_init(struct device_node *np)
655 panic("%s: unable to determine soc\n", __func__); 694 panic("%s: unable to determine soc\n", __func__);
656 } 695 }
657 696
658 samsung_clk_init(np, reg_base, CLK_NR_CLKS, 697 samsung_clk_init(np, reg_base, CLK_NR_CLKS, NULL, 0, NULL, 0);
659 exynos5250_clk_regs, ARRAY_SIZE(exynos5250_clk_regs),
660 NULL, 0);
661 samsung_clk_of_register_fixed_ext(exynos5250_fixed_rate_ext_clks, 698 samsung_clk_of_register_fixed_ext(exynos5250_fixed_rate_ext_clks,
662 ARRAY_SIZE(exynos5250_fixed_rate_ext_clks), 699 ARRAY_SIZE(exynos5250_fixed_rate_ext_clks),
663 ext_clk_match); 700 ext_clk_match);
@@ -685,6 +722,8 @@ static void __init exynos5250_clk_init(struct device_node *np)
685 samsung_clk_register_gate(exynos5250_gate_clks, 722 samsung_clk_register_gate(exynos5250_gate_clks,
686 ARRAY_SIZE(exynos5250_gate_clks)); 723 ARRAY_SIZE(exynos5250_gate_clks));
687 724
725 exynos5250_clk_sleep_init();
726
688 pr_info("Exynos5250: clock setup completed, armclk=%ld\n", 727 pr_info("Exynos5250: clock setup completed, armclk=%ld\n",
689 _get_rate("div_arm2")); 728 _get_rate("div_arm2"));
690} 729}
diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index c0a716b94a66..ec761e344fd0 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -38,8 +38,9 @@ void samsung_clk_restore(void __iomem *base,
38 writel(rd->value, base + rd->offset); 38 writel(rd->value, base + rd->offset);
39} 39}
40 40
41struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(unsigned long *rdump, 41struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
42 unsigned long nr_rdump) 42 const unsigned long *rdump,
43 unsigned long nr_rdump)
43{ 44{
44 struct samsung_clk_reg_dump *rd; 45 struct samsung_clk_reg_dump *rd;
45 unsigned int i; 46 unsigned int i;
diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h
index ec8d46ba8178..93cb8a0deb7b 100644
--- a/drivers/clk/samsung/clk.h
+++ b/drivers/clk/samsung/clk.h
@@ -347,7 +347,7 @@ extern void samsung_clk_restore(void __iomem *base,
347 const struct samsung_clk_reg_dump *rd, 347 const struct samsung_clk_reg_dump *rd,
348 unsigned int num_regs); 348 unsigned int num_regs);
349extern struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump( 349extern struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
350 unsigned long *rdump, 350 const unsigned long *rdump,
351 unsigned long nr_rdump); 351 unsigned long nr_rdump);
352 352
353#endif /* __SAMSUNG_CLK_H */ 353#endif /* __SAMSUNG_CLK_H */