Magnus Damm | 2ef7f0d | 2009-03-06 09:47:02 +0000 | [diff] [blame] | 1 | #ifndef _ASM_SH_SUSPEND_H |
| 2 | #define _ASM_SH_SUSPEND_H |
| 3 | |
Magnus Damm | 7759491 | 2009-03-13 15:23:04 +0000 | [diff] [blame] | 4 | #ifndef __ASSEMBLY__ |
Magnus Damm | 49f4264 | 2009-10-29 10:51:48 +0000 | [diff] [blame] | 5 | #include <linux/notifier.h> |
Magnus Damm | 2ef7f0d | 2009-03-06 09:47:02 +0000 | [diff] [blame] | 6 | |
| 7 | #include <asm/ptrace.h> |
| 8 | |
| 9 | struct swsusp_arch_regs { |
| 10 | struct pt_regs user_regs; |
| 11 | unsigned long bank1_regs[8]; |
| 12 | }; |
Magnus Damm | 7426394 | 2009-07-03 10:28:00 +0000 | [diff] [blame] | 13 | |
| 14 | void sh_mobile_call_standby(unsigned long mode); |
| 15 | |
| 16 | #ifdef CONFIG_CPU_IDLE |
Daniel Lezcano | 38a94f4 | 2013-04-17 13:32:57 +0000 | [diff] [blame] | 17 | int sh_mobile_setup_cpuidle(void); |
Magnus Damm | 7426394 | 2009-07-03 10:28:00 +0000 | [diff] [blame] | 18 | #else |
Daniel Lezcano | 38a94f4 | 2013-04-17 13:32:57 +0000 | [diff] [blame] | 19 | static inline int sh_mobile_setup_cpuidle(void) { return 0; } |
Magnus Damm | 7426394 | 2009-07-03 10:28:00 +0000 | [diff] [blame] | 20 | #endif |
| 21 | |
Magnus Damm | 49f4264 | 2009-10-29 10:51:48 +0000 | [diff] [blame] | 22 | /* notifier chains for pre/post sleep hooks */ |
| 23 | extern struct atomic_notifier_head sh_mobile_pre_sleep_notifier_list; |
| 24 | extern struct atomic_notifier_head sh_mobile_post_sleep_notifier_list; |
| 25 | |
| 26 | /* priority levels for notifiers */ |
| 27 | #define SH_MOBILE_SLEEP_BOARD 0 |
| 28 | #define SH_MOBILE_SLEEP_CPU 1 |
| 29 | #define SH_MOBILE_PRE(x) (x) |
| 30 | #define SH_MOBILE_POST(x) (-(x)) |
| 31 | |
Magnus Damm | 159f8cd | 2009-10-29 10:52:06 +0000 | [diff] [blame] | 32 | /* board code registration function for self-refresh assembly snippets */ |
| 33 | void sh_mobile_register_self_refresh(unsigned long flags, |
| 34 | void *pre_start, void *pre_end, |
| 35 | void *post_start, void *post_end); |
Magnus Damm | 323ef8d | 2009-10-30 04:24:07 +0000 | [diff] [blame] | 36 | |
| 37 | /* register structure for address/data information */ |
| 38 | struct sh_sleep_regs { |
| 39 | unsigned long stbcr; |
Magnus Damm | bb3e0ee | 2009-10-30 04:24:40 +0000 | [diff] [blame] | 40 | unsigned long bar; |
Magnus Damm | 99675a7 | 2009-10-30 04:24:23 +0000 | [diff] [blame] | 41 | |
| 42 | /* MMU */ |
| 43 | unsigned long pteh; |
| 44 | unsigned long ptel; |
| 45 | unsigned long ttb; |
| 46 | unsigned long tea; |
| 47 | unsigned long mmucr; |
| 48 | unsigned long ptea; |
| 49 | unsigned long pascr; |
| 50 | unsigned long irmcr; |
| 51 | |
| 52 | /* Cache */ |
| 53 | unsigned long ccr; |
| 54 | unsigned long ramcr; |
Magnus Damm | 323ef8d | 2009-10-30 04:24:07 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | /* data area for low-level sleep code */ |
| 58 | struct sh_sleep_data { |
| 59 | /* current sleep mode (SUSP_SH_...) */ |
| 60 | unsigned long mode; |
| 61 | |
| 62 | /* addresses of board specific self-refresh snippets */ |
| 63 | unsigned long sf_pre; |
| 64 | unsigned long sf_post; |
| 65 | |
Magnus Damm | bb3e0ee | 2009-10-30 04:24:40 +0000 | [diff] [blame] | 66 | /* address of resume code */ |
| 67 | unsigned long resume; |
| 68 | |
Magnus Damm | 323ef8d | 2009-10-30 04:24:07 +0000 | [diff] [blame] | 69 | /* register state saved and restored by the assembly code */ |
| 70 | unsigned long vbr; |
| 71 | unsigned long spc; |
| 72 | unsigned long sr; |
Magnus Damm | bb3e0ee | 2009-10-30 04:24:40 +0000 | [diff] [blame] | 73 | unsigned long sp; |
Magnus Damm | 323ef8d | 2009-10-30 04:24:07 +0000 | [diff] [blame] | 74 | |
| 75 | /* structure for keeping register addresses */ |
| 76 | struct sh_sleep_regs addr; |
| 77 | |
| 78 | /* structure for saving/restoring register state */ |
| 79 | struct sh_sleep_regs data; |
| 80 | }; |
| 81 | |
Magnus Damm | 02bf893 | 2009-10-30 04:24:15 +0000 | [diff] [blame] | 82 | /* a bitmap of supported sleep modes (SUSP_SH..) */ |
| 83 | extern unsigned long sh_mobile_sleep_supported; |
| 84 | |
Magnus Damm | 7759491 | 2009-03-13 15:23:04 +0000 | [diff] [blame] | 85 | #endif |
| 86 | |
| 87 | /* flags passed to assembly suspend code */ |
| 88 | #define SUSP_SH_SLEEP (1 << 0) /* Regular sleep mode */ |
| 89 | #define SUSP_SH_STANDBY (1 << 1) /* SH-Mobile Software standby mode */ |
| 90 | #define SUSP_SH_RSTANDBY (1 << 2) /* SH-Mobile R-standby mode */ |
| 91 | #define SUSP_SH_USTANDBY (1 << 3) /* SH-Mobile U-standby mode */ |
| 92 | #define SUSP_SH_SF (1 << 4) /* Enable self-refresh */ |
Magnus Damm | 99675a7 | 2009-10-30 04:24:23 +0000 | [diff] [blame] | 93 | #define SUSP_SH_MMU (1 << 5) /* Save/restore MMU and cache */ |
Magnus Damm | 41bfb7d | 2010-02-25 11:03:24 +0000 | [diff] [blame] | 94 | #define SUSP_SH_REGS (1 << 6) /* Save/restore registers */ |
Magnus Damm | 2ef7f0d | 2009-03-06 09:47:02 +0000 | [diff] [blame] | 95 | |
| 96 | #endif /* _ASM_SH_SUSPEND_H */ |