1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM2XXX_3XXX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM2XXX_3XXX_H
18
19#include "prcm-common.h"
20#include "prm.h"
21
22
23
24
25
26
27
28
29
30
31
32
33
34#define OMAP2_RM_RSTCTRL 0x0050
35#define OMAP2_RM_RSTTIME 0x0054
36#define OMAP2_RM_RSTST 0x0058
37#define OMAP2_PM_PWSTCTRL 0x00e0
38#define OMAP2_PM_PWSTST 0x00e4
39
40#define PM_WKEN 0x00a0
41#define PM_WKEN1 PM_WKEN
42#define PM_WKST 0x00b0
43#define PM_WKST1 PM_WKST
44#define PM_WKDEP 0x00c8
45#define PM_EVGENCTRL 0x00d4
46#define PM_EVGENONTIM 0x00d8
47#define PM_EVGENOFFTIM 0x00dc
48
49
50#ifndef __ASSEMBLER__
51
52#include <linux/io.h>
53#include "powerdomain.h"
54
55
56static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
57{
58 return __raw_readl(prm_base + module + idx);
59}
60
61static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
62{
63 __raw_writel(val, prm_base + module + idx);
64}
65
66
67static inline u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
68 s16 idx)
69{
70 u32 v;
71
72 v = omap2_prm_read_mod_reg(module, idx);
73 v &= ~mask;
74 v |= bits;
75 omap2_prm_write_mod_reg(v, module, idx);
76
77 return v;
78}
79
80
81static inline u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
82{
83 u32 v;
84
85 v = omap2_prm_read_mod_reg(domain, idx);
86 v &= mask;
87 v >>= __ffs(mask);
88
89 return v;
90}
91
92static inline u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
93{
94 return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
95}
96
97static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
98{
99 return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
100}
101
102
103extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
104extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
105extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
106
107extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
108extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
109extern int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm);
110extern int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
111 u8 pwrst);
112extern int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
113 u8 pwrst);
114extern int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
115extern int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
116extern int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst);
117extern int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm);
118
119extern int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
120 struct clockdomain *clkdm2);
121extern int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
122 struct clockdomain *clkdm2);
123extern int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
124 struct clockdomain *clkdm2);
125extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
126
127#endif
128
129
130
131
132
133
134
135
136
137
138#define OMAP_ONTIMEVAL_SHIFT 0
139#define OMAP_ONTIMEVAL_MASK (0xffffffff << 0)
140
141
142
143#define OMAP_OFFTIMEVAL_SHIFT 0
144#define OMAP_OFFTIMEVAL_MASK (0xffffffff << 0)
145
146
147
148#define OMAP_SETUP_TIME_SHIFT 0
149#define OMAP_SETUP_TIME_MASK (0xffff << 0)
150
151
152
153#define OMAP_SYSCLKDIV_SHIFT 6
154#define OMAP_SYSCLKDIV_MASK (0x3 << 6)
155#define OMAP_SYSCLKDIV_WIDTH 2
156#define OMAP_AUTOEXTCLKMODE_SHIFT 3
157#define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3)
158#define OMAP_SYSCLKSEL_SHIFT 0
159#define OMAP_SYSCLKSEL_MASK (0x3 << 0)
160
161
162#define OMAP_OFFLOADMODE_SHIFT 3
163#define OMAP_OFFLOADMODE_MASK (0x3 << 3)
164#define OMAP_ONLOADMODE_SHIFT 1
165#define OMAP_ONLOADMODE_MASK (0x3 << 1)
166#define OMAP_ENABLE_MASK (1 << 0)
167
168
169
170#define OMAP_RSTTIME2_SHIFT 8
171#define OMAP_RSTTIME2_MASK (0x1f << 8)
172#define OMAP_RSTTIME1_SHIFT 0
173#define OMAP_RSTTIME1_MASK (0xff << 0)
174
175
176
177
178#define OMAP_RST_DPLL3_MASK (1 << 2)
179#define OMAP_RST_GS_MASK (1 << 1)
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196#define OMAP_COREDOMAINWKUP_RST_MASK (1 << 3)
197
198
199
200
201
202
203
204
205#define OMAP_DOMAINWKUP_RST_MASK (1 << 2)
206
207
208
209
210
211
212
213
214
215#define OMAP_GLOBALWARM_RST_SHIFT 1
216#define OMAP_GLOBALWARM_RST_MASK (1 << 1)
217#define OMAP_GLOBALCOLD_RST_SHIFT 0
218#define OMAP_GLOBALCOLD_RST_MASK (1 << 0)
219
220
221
222
223
224
225
226
227
228
229#define OMAP_EN_WKUP_SHIFT 4
230#define OMAP_EN_WKUP_MASK (1 << 4)
231
232
233
234
235
236
237
238
239
240
241
242#define OMAP_LOGICRETSTATE_MASK (1 << 2)
243
244
245#endif
246