blob: 64eb41a063e8162c7bde64bdcf0cd8ce3e4c45b1 [file] [log] [blame]
Magnus Damm2ef7f0d2009-03-06 09:47:02 +00001#ifndef _ASM_SH_SUSPEND_H
2#define _ASM_SH_SUSPEND_H
3
Magnus Damm77594912009-03-13 15:23:04 +00004#ifndef __ASSEMBLY__
Magnus Damm49f42642009-10-29 10:51:48 +00005#include <linux/notifier.h>
Magnus Damm2ef7f0d2009-03-06 09:47:02 +00006static inline int arch_prepare_suspend(void) { return 0; }
7
8#include <asm/ptrace.h>
9
10struct swsusp_arch_regs {
11 struct pt_regs user_regs;
12 unsigned long bank1_regs[8];
13};
Magnus Damm74263942009-07-03 10:28:00 +000014
15void sh_mobile_call_standby(unsigned long mode);
16
17#ifdef CONFIG_CPU_IDLE
18void sh_mobile_setup_cpuidle(void);
19#else
20static inline void sh_mobile_setup_cpuidle(void) {}
21#endif
22
Magnus Damm49f42642009-10-29 10:51:48 +000023/* notifier chains for pre/post sleep hooks */
24extern struct atomic_notifier_head sh_mobile_pre_sleep_notifier_list;
25extern struct atomic_notifier_head sh_mobile_post_sleep_notifier_list;
26
27/* priority levels for notifiers */
28#define SH_MOBILE_SLEEP_BOARD 0
29#define SH_MOBILE_SLEEP_CPU 1
30#define SH_MOBILE_PRE(x) (x)
31#define SH_MOBILE_POST(x) (-(x))
32
Magnus Damm159f8cd2009-10-29 10:52:06 +000033/* board code registration function for self-refresh assembly snippets */
34void sh_mobile_register_self_refresh(unsigned long flags,
35 void *pre_start, void *pre_end,
36 void *post_start, void *post_end);
Magnus Damm323ef8d2009-10-30 04:24:07 +000037
38/* register structure for address/data information */
39struct sh_sleep_regs {
40 unsigned long stbcr;
Magnus Dammbb3e0ee2009-10-30 04:24:40 +000041 unsigned long bar;
Magnus Damm99675a72009-10-30 04:24:23 +000042
43 /* MMU */
44 unsigned long pteh;
45 unsigned long ptel;
46 unsigned long ttb;
47 unsigned long tea;
48 unsigned long mmucr;
49 unsigned long ptea;
50 unsigned long pascr;
51 unsigned long irmcr;
52
53 /* Cache */
54 unsigned long ccr;
55 unsigned long ramcr;
Magnus Damm323ef8d2009-10-30 04:24:07 +000056};
57
58/* data area for low-level sleep code */
59struct sh_sleep_data {
60 /* current sleep mode (SUSP_SH_...) */
61 unsigned long mode;
62
63 /* addresses of board specific self-refresh snippets */
64 unsigned long sf_pre;
65 unsigned long sf_post;
66
Magnus Dammbb3e0ee2009-10-30 04:24:40 +000067 /* address of resume code */
68 unsigned long resume;
69
Magnus Damm323ef8d2009-10-30 04:24:07 +000070 /* register state saved and restored by the assembly code */
71 unsigned long vbr;
72 unsigned long spc;
73 unsigned long sr;
Magnus Dammbb3e0ee2009-10-30 04:24:40 +000074 unsigned long sp;
Magnus Damm323ef8d2009-10-30 04:24:07 +000075
76 /* structure for keeping register addresses */
77 struct sh_sleep_regs addr;
78
79 /* structure for saving/restoring register state */
80 struct sh_sleep_regs data;
81};
82
Magnus Damm02bf8932009-10-30 04:24:15 +000083/* a bitmap of supported sleep modes (SUSP_SH..) */
84extern unsigned long sh_mobile_sleep_supported;
85
Magnus Damm77594912009-03-13 15:23:04 +000086#endif
87
88/* flags passed to assembly suspend code */
89#define SUSP_SH_SLEEP (1 << 0) /* Regular sleep mode */
90#define SUSP_SH_STANDBY (1 << 1) /* SH-Mobile Software standby mode */
91#define SUSP_SH_RSTANDBY (1 << 2) /* SH-Mobile R-standby mode */
92#define SUSP_SH_USTANDBY (1 << 3) /* SH-Mobile U-standby mode */
93#define SUSP_SH_SF (1 << 4) /* Enable self-refresh */
Magnus Damm99675a72009-10-30 04:24:23 +000094#define SUSP_SH_MMU (1 << 5) /* Save/restore MMU and cache */
Magnus Damm41bfb7d2010-02-25 11:03:24 +000095#define SUSP_SH_REGS (1 << 6) /* Save/restore registers */
Magnus Damm2ef7f0d2009-03-06 09:47:02 +000096
97#endif /* _ASM_SH_SUSPEND_H */