diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2008-02-24 17:24:26 -0500 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-04-19 20:40:07 -0400 |
commit | 7e59128f31e0c57d52e86d57730d4c9281494dda (patch) | |
tree | da5aa2af13d8990b5333ad8807335cd3e374fdda /include/asm-avr32/arch-at32ap | |
parent | 02f99d1ca70d190ce12d040971819be22ea710c8 (diff) |
avr32: Move sleep code into mach-at32ap
Create a new file, pm-at32ap700x.S, in mach-at32ap and move the CPU
idle sleep code there. Make it possible to disable the sleep code.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'include/asm-avr32/arch-at32ap')
-rw-r--r-- | include/asm-avr32/arch-at32ap/pm.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/asm-avr32/arch-at32ap/pm.h b/include/asm-avr32/arch-at32ap/pm.h new file mode 100644 index 000000000000..356e43064903 --- /dev/null +++ b/include/asm-avr32/arch-at32ap/pm.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * AVR32 AP Power Management. | ||
3 | * | ||
4 | * Copyright (C) 2008 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __ASM_AVR32_ARCH_PM_H | ||
11 | #define __ASM_AVR32_ARCH_PM_H | ||
12 | |||
13 | /* Possible arguments to the "sleep" instruction */ | ||
14 | #define CPU_SLEEP_IDLE 0 | ||
15 | #define CPU_SLEEP_FROZEN 1 | ||
16 | #define CPU_SLEEP_STANDBY 2 | ||
17 | #define CPU_SLEEP_STOP 3 | ||
18 | #define CPU_SLEEP_STATIC 5 | ||
19 | |||
20 | #ifndef __ASSEMBLY__ | ||
21 | extern void cpu_enter_idle(void); | ||
22 | |||
23 | extern bool disable_idle_sleep; | ||
24 | |||
25 | static inline void cpu_disable_idle_sleep(void) | ||
26 | { | ||
27 | disable_idle_sleep = true; | ||
28 | } | ||
29 | |||
30 | static inline void cpu_enable_idle_sleep(void) | ||
31 | { | ||
32 | disable_idle_sleep = false; | ||
33 | } | ||
34 | |||
35 | static inline void cpu_idle_sleep(void) | ||
36 | { | ||
37 | /* | ||
38 | * If we're using the COUNT and COMPARE registers for | ||
39 | * timekeeping, we can't use the IDLE state. | ||
40 | */ | ||
41 | if (disable_idle_sleep) | ||
42 | cpu_relax(); | ||
43 | else | ||
44 | cpu_enter_idle(); | ||
45 | } | ||
46 | #endif | ||
47 | |||
48 | #endif /* __ASM_AVR32_ARCH_PM_H */ | ||