diff options
author | Eric Miao <eric.y.miao@gmail.com> | 2010-11-23 04:00:03 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-12-16 01:31:20 -0500 |
commit | f113fe4e844be15394edcbc32b0ec196cdd0a0ff (patch) | |
tree | dceebef68696118b028354e1b6ec94f45bc8ed94 /arch/arm/mach-pxa | |
parent | 2a125dd56b3a853701063fe8a678ad7603e385fd (diff) |
ARM: pxa: introduce pxa2xx_clock_sysclass for clock suspend/resume
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/clock-pxa2xx.c | 26 | ||||
-rw-r--r-- | arch/arm/mach-pxa/clock.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa25x.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa27x.c | 7 |
4 files changed, 35 insertions, 8 deletions
diff --git a/arch/arm/mach-pxa/clock-pxa2xx.c b/arch/arm/mach-pxa/clock-pxa2xx.c index 416b3f06efb7..66eb531ae29b 100644 --- a/arch/arm/mach-pxa/clock-pxa2xx.c +++ b/arch/arm/mach-pxa/clock-pxa2xx.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/sysdev.h> | ||
12 | 13 | ||
13 | #include <mach/pxa2xx-regs.h> | 14 | #include <mach/pxa2xx-regs.h> |
14 | 15 | ||
@@ -28,3 +29,28 @@ const struct clkops clk_pxa2xx_cken_ops = { | |||
28 | .enable = clk_pxa2xx_cken_enable, | 29 | .enable = clk_pxa2xx_cken_enable, |
29 | .disable = clk_pxa2xx_cken_disable, | 30 | .disable = clk_pxa2xx_cken_disable, |
30 | }; | 31 | }; |
32 | |||
33 | #ifdef CONFIG_PM | ||
34 | static uint32_t saved_cken; | ||
35 | |||
36 | static int pxa2xx_clock_suspend(struct sys_device *d, pm_message_t state) | ||
37 | { | ||
38 | saved_cken = CKEN; | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | static int pxa2xx_clock_resume(struct sys_device *d) | ||
43 | { | ||
44 | CKEN = saved_cken; | ||
45 | return 0; | ||
46 | } | ||
47 | #else | ||
48 | #define pxa2xx_clock_suspend NULL | ||
49 | #define pxa2xx_clock_resume NULL | ||
50 | #endif | ||
51 | |||
52 | struct sysdev_class pxa2xx_clock_sysclass = { | ||
53 | .name = "pxa2xx-clock", | ||
54 | .suspend = pxa2xx_clock_suspend, | ||
55 | .resume = pxa2xx_clock_resume, | ||
56 | }; | ||
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h index 04348781ad79..8ffc1d0b78e0 100644 --- a/arch/arm/mach-pxa/clock.h +++ b/arch/arm/mach-pxa/clock.h | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/sysdev.h> | ||
1 | #include <asm/clkdev.h> | 2 | #include <asm/clkdev.h> |
2 | 3 | ||
3 | struct clkops { | 4 | struct clkops { |
@@ -53,6 +54,8 @@ extern const struct clkops clk_pxa2xx_cken_ops; | |||
53 | void clk_pxa2xx_cken_enable(struct clk *clk); | 54 | void clk_pxa2xx_cken_enable(struct clk *clk); |
54 | void clk_pxa2xx_cken_disable(struct clk *clk); | 55 | void clk_pxa2xx_cken_disable(struct clk *clk); |
55 | 56 | ||
57 | extern struct sysdev_class pxa2xx_clock_sysclass; | ||
58 | |||
56 | #ifdef CONFIG_PXA3xx | 59 | #ifdef CONFIG_PXA3xx |
57 | #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \ | 60 | #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \ |
58 | struct clk clk_##_name = { \ | 61 | struct clk clk_##_name = { \ |
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index 65051bb6d62c..3f5241c84894 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c | |||
@@ -222,20 +222,17 @@ static struct clk_lookup pxa25x_hwuart_clkreg = | |||
222 | */ | 222 | */ |
223 | enum { | 223 | enum { |
224 | SLEEP_SAVE_PSTR, | 224 | SLEEP_SAVE_PSTR, |
225 | SLEEP_SAVE_CKEN, | ||
226 | SLEEP_SAVE_COUNT | 225 | SLEEP_SAVE_COUNT |
227 | }; | 226 | }; |
228 | 227 | ||
229 | 228 | ||
230 | static void pxa25x_cpu_pm_save(unsigned long *sleep_save) | 229 | static void pxa25x_cpu_pm_save(unsigned long *sleep_save) |
231 | { | 230 | { |
232 | SAVE(CKEN); | ||
233 | SAVE(PSTR); | 231 | SAVE(PSTR); |
234 | } | 232 | } |
235 | 233 | ||
236 | static void pxa25x_cpu_pm_restore(unsigned long *sleep_save) | 234 | static void pxa25x_cpu_pm_restore(unsigned long *sleep_save) |
237 | { | 235 | { |
238 | RESTORE(CKEN); | ||
239 | RESTORE(PSTR); | 236 | RESTORE(PSTR); |
240 | } | 237 | } |
241 | 238 | ||
@@ -358,7 +355,9 @@ static struct sys_device pxa25x_sysdev[] = { | |||
358 | .cls = &pxa2xx_mfp_sysclass, | 355 | .cls = &pxa2xx_mfp_sysclass, |
359 | }, { | 356 | }, { |
360 | .cls = &pxa_gpio_sysclass, | 357 | .cls = &pxa_gpio_sysclass, |
361 | }, | 358 | }, { |
359 | .cls = &pxa2xx_clock_sysclass, | ||
360 | } | ||
362 | }; | 361 | }; |
363 | 362 | ||
364 | static int __init pxa25x_init(void) | 363 | static int __init pxa25x_init(void) |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 6d2254b92adc..b2130b7a7b52 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -258,7 +258,6 @@ int __init pxa27x_set_pwrmode(unsigned int mode) | |||
258 | */ | 258 | */ |
259 | enum { | 259 | enum { |
260 | SLEEP_SAVE_PSTR, | 260 | SLEEP_SAVE_PSTR, |
261 | SLEEP_SAVE_CKEN, | ||
262 | SLEEP_SAVE_MDREFR, | 261 | SLEEP_SAVE_MDREFR, |
263 | SLEEP_SAVE_PCFR, | 262 | SLEEP_SAVE_PCFR, |
264 | SLEEP_SAVE_COUNT | 263 | SLEEP_SAVE_COUNT |
@@ -269,7 +268,6 @@ void pxa27x_cpu_pm_save(unsigned long *sleep_save) | |||
269 | sleep_save[SLEEP_SAVE_MDREFR] = __raw_readl(MDREFR); | 268 | sleep_save[SLEEP_SAVE_MDREFR] = __raw_readl(MDREFR); |
270 | SAVE(PCFR); | 269 | SAVE(PCFR); |
271 | 270 | ||
272 | SAVE(CKEN); | ||
273 | SAVE(PSTR); | 271 | SAVE(PSTR); |
274 | } | 272 | } |
275 | 273 | ||
@@ -280,7 +278,6 @@ void pxa27x_cpu_pm_restore(unsigned long *sleep_save) | |||
280 | 278 | ||
281 | PSSR = PSSR_RDH | PSSR_PH; | 279 | PSSR = PSSR_RDH | PSSR_PH; |
282 | 280 | ||
283 | RESTORE(CKEN); | ||
284 | RESTORE(PSTR); | 281 | RESTORE(PSTR); |
285 | } | 282 | } |
286 | 283 | ||
@@ -438,7 +435,9 @@ static struct sys_device pxa27x_sysdev[] = { | |||
438 | .cls = &pxa2xx_mfp_sysclass, | 435 | .cls = &pxa2xx_mfp_sysclass, |
439 | }, { | 436 | }, { |
440 | .cls = &pxa_gpio_sysclass, | 437 | .cls = &pxa_gpio_sysclass, |
441 | }, | 438 | }, { |
439 | .cls = &pxa2xx_clock_sysclass, | ||
440 | } | ||
442 | }; | 441 | }; |
443 | 442 | ||
444 | static int __init pxa27x_init(void) | 443 | static int __init pxa27x_init(void) |