This source file includes following definitions.
- sh_wdt_read_cnt
- sh_wdt_write_cnt
- sh_wdt_write_bst
- sh_wdt_read_csr
- sh_wdt_write_csr
- sh_wdt_read_cnt
- sh_wdt_write_cnt
- sh_wdt_read_csr
- sh_wdt_write_csr
1
2
3
4
5
6
7
8
9 #ifndef __ASM_SH_WATCHDOG_H
10 #define __ASM_SH_WATCHDOG_H
11 #ifdef __KERNEL__
12
13 #include <linux/types.h>
14 #include <linux/io.h>
15
16 #define WTCNT_HIGH 0x5a
17 #define WTCSR_HIGH 0xa5
18
19 #define WTCSR_CKS2 0x04
20 #define WTCSR_CKS1 0x02
21 #define WTCSR_CKS0 0x01
22
23 #include <cpu/watchdog.h>
24
25
26
27
28 #ifndef WTCNT_R
29 # define WTCNT_R WTCNT
30 #endif
31
32 #ifndef WTCSR_R
33 # define WTCSR_R WTCSR
34 #endif
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 #define WTCSR_CKS_32 0x00
54 #define WTCSR_CKS_64 0x01
55 #define WTCSR_CKS_128 0x02
56 #define WTCSR_CKS_256 0x03
57 #define WTCSR_CKS_512 0x04
58 #define WTCSR_CKS_1024 0x05
59 #define WTCSR_CKS_2048 0x06
60 #define WTCSR_CKS_4096 0x07
61
62 #if defined(CONFIG_CPU_SUBTYPE_SH7785) || defined(CONFIG_CPU_SUBTYPE_SH7780)
63
64
65
66
67 static inline __u32 sh_wdt_read_cnt(void)
68 {
69 return __raw_readl(WTCNT_R);
70 }
71
72
73
74
75
76
77
78
79 static inline void sh_wdt_write_cnt(__u32 val)
80 {
81 __raw_writel((WTCNT_HIGH << 24) | (__u32)val, WTCNT);
82 }
83
84
85
86
87
88
89
90
91 static inline void sh_wdt_write_bst(__u32 val)
92 {
93 __raw_writel((WTBST_HIGH << 24) | (__u32)val, WTBST);
94 }
95
96
97
98
99
100 static inline __u32 sh_wdt_read_csr(void)
101 {
102 return __raw_readl(WTCSR_R);
103 }
104
105
106
107
108
109
110
111
112 static inline void sh_wdt_write_csr(__u32 val)
113 {
114 __raw_writel((WTCSR_HIGH << 24) | (__u32)val, WTCSR);
115 }
116 #else
117
118
119
120
121 static inline __u8 sh_wdt_read_cnt(void)
122 {
123 return __raw_readb(WTCNT_R);
124 }
125
126
127
128
129
130
131
132
133 static inline void sh_wdt_write_cnt(__u8 val)
134 {
135 __raw_writew((WTCNT_HIGH << 8) | (__u16)val, WTCNT);
136 }
137
138
139
140
141
142
143 static inline __u8 sh_wdt_read_csr(void)
144 {
145 return __raw_readb(WTCSR_R);
146 }
147
148
149
150
151
152
153
154
155 static inline void sh_wdt_write_csr(__u8 val)
156 {
157 __raw_writew((WTCSR_HIGH << 8) | (__u16)val, WTCSR);
158 }
159 #endif
160 #endif
161 #endif