diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/arm/plat-omap/include | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/arm/plat-omap/include')
-rw-r--r-- | arch/arm/plat-omap/include/plat/counter-32k.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/cpu.h | 497 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/dmtimer.h | 306 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/i2c.h | 30 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/sram.h | 92 |
5 files changed, 719 insertions, 207 deletions
diff --git a/arch/arm/plat-omap/include/plat/counter-32k.h b/arch/arm/plat-omap/include/plat/counter-32k.h deleted file mode 100644 index da000d482ff..00000000000 --- a/arch/arm/plat-omap/include/plat/counter-32k.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | int omap_init_clocksource_32k(void __iomem *vbase); | ||
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h index c9a66bf36c9..67b3d75884c 100644 --- a/arch/arm/plat-omap/include/plat/cpu.h +++ b/arch/arm/plat-omap/include/plat/cpu.h | |||
@@ -1,4 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/plat-omap/include/mach/cpu.h | ||
3 | * | ||
2 | * OMAP cpu type detection | 4 | * OMAP cpu type detection |
3 | * | 5 | * |
4 | * Copyright (C) 2004, 2008 Nokia Corporation | 6 | * Copyright (C) 2004, 2008 Nokia Corporation |
@@ -7,7 +9,7 @@ | |||
7 | * | 9 | * |
8 | * Written by Tony Lindgren <tony.lindgren@nokia.com> | 10 | * Written by Tony Lindgren <tony.lindgren@nokia.com> |
9 | * | 11 | * |
10 | * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com> | 12 | * Added OMAP4 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com> |
11 | * | 13 | * |
12 | * This program is free software; you can redistribute it and/or modify | 14 | * This program is free software; you can redistribute it and/or modify |
13 | * it under the terms of the GNU General Public License as published by | 15 | * it under the terms of the GNU General Public License as published by |
@@ -28,8 +30,497 @@ | |||
28 | #ifndef __ASM_ARCH_OMAP_CPU_H | 30 | #ifndef __ASM_ARCH_OMAP_CPU_H |
29 | #define __ASM_ARCH_OMAP_CPU_H | 31 | #define __ASM_ARCH_OMAP_CPU_H |
30 | 32 | ||
31 | #ifdef CONFIG_ARCH_OMAP1 | 33 | #include <linux/bitops.h> |
32 | #include <mach/soc.h> | 34 | #include <plat/multi.h> |
35 | |||
36 | /* | ||
37 | * Omap device type i.e. EMU/HS/TST/GP/BAD | ||
38 | */ | ||
39 | #define OMAP2_DEVICE_TYPE_TEST 0 | ||
40 | #define OMAP2_DEVICE_TYPE_EMU 1 | ||
41 | #define OMAP2_DEVICE_TYPE_SEC 2 | ||
42 | #define OMAP2_DEVICE_TYPE_GP 3 | ||
43 | #define OMAP2_DEVICE_TYPE_BAD 4 | ||
44 | |||
45 | int omap_type(void); | ||
46 | |||
47 | struct omap_chip_id { | ||
48 | u16 oc; | ||
49 | u8 type; | ||
50 | }; | ||
51 | |||
52 | #define OMAP_CHIP_INIT(x) { .oc = x } | ||
53 | |||
54 | /* | ||
55 | * omap_rev bits: | ||
56 | * CPU id bits (0730, 1510, 1710, 2422...) [31:16] | ||
57 | * CPU revision (See _REV_ defined in cpu.h) [15:08] | ||
58 | * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00] | ||
59 | */ | ||
60 | unsigned int omap_rev(void); | ||
61 | |||
62 | /* | ||
63 | * Define CPU revision bits | ||
64 | * | ||
65 | * Verbose meaning of the revision bits may be different for a silicon | ||
66 | * family. This difference can be handled separately. | ||
67 | */ | ||
68 | #define OMAP_REVBITS_00 0x00 | ||
69 | #define OMAP_REVBITS_01 0x01 | ||
70 | #define OMAP_REVBITS_02 0x02 | ||
71 | #define OMAP_REVBITS_03 0x03 | ||
72 | #define OMAP_REVBITS_04 0x04 | ||
73 | #define OMAP_REVBITS_05 0x05 | ||
74 | |||
75 | /* | ||
76 | * Get the CPU revision for OMAP devices | ||
77 | */ | ||
78 | #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) | ||
79 | |||
80 | /* | ||
81 | * Macros to group OMAP into cpu classes. | ||
82 | * These can be used in most places. | ||
83 | * cpu_is_omap7xx(): True for OMAP730, OMAP850 | ||
84 | * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 | ||
85 | * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 | ||
86 | * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 | ||
87 | * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 | ||
88 | * cpu_is_omap243x(): True for OMAP2430 | ||
89 | * cpu_is_omap343x(): True for OMAP3430 | ||
90 | * cpu_is_omap443x(): True for OMAP4430 | ||
91 | * cpu_is_omap446x(): True for OMAP4460 | ||
92 | */ | ||
93 | #define GET_OMAP_CLASS (omap_rev() & 0xff) | ||
94 | |||
95 | #define IS_OMAP_CLASS(class, id) \ | ||
96 | static inline int is_omap ##class (void) \ | ||
97 | { \ | ||
98 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ | ||
99 | } | ||
100 | |||
101 | #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) | ||
102 | |||
103 | #define IS_OMAP_SUBCLASS(subclass, id) \ | ||
104 | static inline int is_omap ##subclass (void) \ | ||
105 | { \ | ||
106 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ | ||
107 | } | ||
108 | |||
109 | #define IS_TI_SUBCLASS(subclass, id) \ | ||
110 | static inline int is_ti ##subclass (void) \ | ||
111 | { \ | ||
112 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ | ||
113 | } | ||
114 | |||
115 | IS_OMAP_CLASS(7xx, 0x07) | ||
116 | IS_OMAP_CLASS(15xx, 0x15) | ||
117 | IS_OMAP_CLASS(16xx, 0x16) | ||
118 | IS_OMAP_CLASS(24xx, 0x24) | ||
119 | IS_OMAP_CLASS(34xx, 0x34) | ||
120 | IS_OMAP_CLASS(44xx, 0x44) | ||
121 | |||
122 | IS_OMAP_SUBCLASS(242x, 0x242) | ||
123 | IS_OMAP_SUBCLASS(243x, 0x243) | ||
124 | IS_OMAP_SUBCLASS(343x, 0x343) | ||
125 | IS_OMAP_SUBCLASS(363x, 0x363) | ||
126 | IS_OMAP_SUBCLASS(443x, 0x443) | ||
127 | IS_OMAP_SUBCLASS(446x, 0x446) | ||
128 | |||
129 | IS_TI_SUBCLASS(816x, 0x816) | ||
130 | |||
131 | #define cpu_is_omap7xx() 0 | ||
132 | #define cpu_is_omap15xx() 0 | ||
133 | #define cpu_is_omap16xx() 0 | ||
134 | #define cpu_is_omap24xx() 0 | ||
135 | #define cpu_is_omap242x() 0 | ||
136 | #define cpu_is_omap243x() 0 | ||
137 | #define cpu_is_omap34xx() 0 | ||
138 | #define cpu_is_omap343x() 0 | ||
139 | #define cpu_is_ti816x() 0 | ||
140 | #define cpu_is_omap44xx() 0 | ||
141 | #define cpu_is_omap443x() 0 | ||
142 | #define cpu_is_omap446x() 0 | ||
143 | |||
144 | #if defined(MULTI_OMAP1) | ||
145 | # if defined(CONFIG_ARCH_OMAP730) | ||
146 | # undef cpu_is_omap7xx | ||
147 | # define cpu_is_omap7xx() is_omap7xx() | ||
148 | # endif | ||
149 | # if defined(CONFIG_ARCH_OMAP850) | ||
150 | # undef cpu_is_omap7xx | ||
151 | # define cpu_is_omap7xx() is_omap7xx() | ||
152 | # endif | ||
153 | # if defined(CONFIG_ARCH_OMAP15XX) | ||
154 | # undef cpu_is_omap15xx | ||
155 | # define cpu_is_omap15xx() is_omap15xx() | ||
156 | # endif | ||
157 | # if defined(CONFIG_ARCH_OMAP16XX) | ||
158 | # undef cpu_is_omap16xx | ||
159 | # define cpu_is_omap16xx() is_omap16xx() | ||
160 | # endif | ||
161 | #else | ||
162 | # if defined(CONFIG_ARCH_OMAP730) | ||
163 | # undef cpu_is_omap7xx | ||
164 | # define cpu_is_omap7xx() 1 | ||
165 | # endif | ||
166 | # if defined(CONFIG_ARCH_OMAP850) | ||
167 | # undef cpu_is_omap7xx | ||
168 | # define cpu_is_omap7xx() 1 | ||
169 | # endif | ||
170 | # if defined(CONFIG_ARCH_OMAP15XX) | ||
171 | # undef cpu_is_omap15xx | ||
172 | # define cpu_is_omap15xx() 1 | ||
173 | # endif | ||
174 | # if defined(CONFIG_ARCH_OMAP16XX) | ||
175 | # undef cpu_is_omap16xx | ||
176 | # define cpu_is_omap16xx() 1 | ||
177 | # endif | ||
178 | #endif | ||
179 | |||
180 | #if defined(MULTI_OMAP2) | ||
181 | # if defined(CONFIG_ARCH_OMAP2) | ||
182 | # undef cpu_is_omap24xx | ||
183 | # define cpu_is_omap24xx() is_omap24xx() | ||
184 | # endif | ||
185 | # if defined (CONFIG_SOC_OMAP2420) | ||
186 | # undef cpu_is_omap242x | ||
187 | # define cpu_is_omap242x() is_omap242x() | ||
188 | # endif | ||
189 | # if defined (CONFIG_SOC_OMAP2430) | ||
190 | # undef cpu_is_omap243x | ||
191 | # define cpu_is_omap243x() is_omap243x() | ||
192 | # endif | ||
193 | # if defined(CONFIG_ARCH_OMAP3) | ||
194 | # undef cpu_is_omap34xx | ||
195 | # undef cpu_is_omap343x | ||
196 | # define cpu_is_omap34xx() is_omap34xx() | ||
197 | # define cpu_is_omap343x() is_omap343x() | ||
198 | # endif | ||
199 | #else | ||
200 | # if defined(CONFIG_ARCH_OMAP2) | ||
201 | # undef cpu_is_omap24xx | ||
202 | # define cpu_is_omap24xx() 1 | ||
203 | # endif | ||
204 | # if defined(CONFIG_SOC_OMAP2420) | ||
205 | # undef cpu_is_omap242x | ||
206 | # define cpu_is_omap242x() 1 | ||
207 | # endif | ||
208 | # if defined(CONFIG_SOC_OMAP2430) | ||
209 | # undef cpu_is_omap243x | ||
210 | # define cpu_is_omap243x() 1 | ||
211 | # endif | ||
212 | # if defined(CONFIG_ARCH_OMAP3) | ||
213 | # undef cpu_is_omap34xx | ||
214 | # define cpu_is_omap34xx() 1 | ||
215 | # endif | ||
216 | # if defined(CONFIG_SOC_OMAP3430) | ||
217 | # undef cpu_is_omap343x | ||
218 | # define cpu_is_omap343x() 1 | ||
219 | # endif | ||
220 | #endif | ||
221 | |||
222 | /* | ||
223 | * Macros to detect individual cpu types. | ||
224 | * These are only rarely needed. | ||
225 | * cpu_is_omap330(): True for OMAP330 | ||
226 | * cpu_is_omap730(): True for OMAP730 | ||
227 | * cpu_is_omap850(): True for OMAP850 | ||
228 | * cpu_is_omap1510(): True for OMAP1510 | ||
229 | * cpu_is_omap1610(): True for OMAP1610 | ||
230 | * cpu_is_omap1611(): True for OMAP1611 | ||
231 | * cpu_is_omap5912(): True for OMAP5912 | ||
232 | * cpu_is_omap1621(): True for OMAP1621 | ||
233 | * cpu_is_omap1710(): True for OMAP1710 | ||
234 | * cpu_is_omap2420(): True for OMAP2420 | ||
235 | * cpu_is_omap2422(): True for OMAP2422 | ||
236 | * cpu_is_omap2423(): True for OMAP2423 | ||
237 | * cpu_is_omap2430(): True for OMAP2430 | ||
238 | * cpu_is_omap3430(): True for OMAP3430 | ||
239 | * cpu_is_omap4430(): True for OMAP4430 | ||
240 | * cpu_is_omap3505(): True for OMAP3505 | ||
241 | * cpu_is_omap3517(): True for OMAP3517 | ||
242 | */ | ||
243 | #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) | ||
244 | |||
245 | #define IS_OMAP_TYPE(type, id) \ | ||
246 | static inline int is_omap ##type (void) \ | ||
247 | { \ | ||
248 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ | ||
249 | } | ||
250 | |||
251 | IS_OMAP_TYPE(310, 0x0310) | ||
252 | IS_OMAP_TYPE(730, 0x0730) | ||
253 | IS_OMAP_TYPE(850, 0x0850) | ||
254 | IS_OMAP_TYPE(1510, 0x1510) | ||
255 | IS_OMAP_TYPE(1610, 0x1610) | ||
256 | IS_OMAP_TYPE(1611, 0x1611) | ||
257 | IS_OMAP_TYPE(5912, 0x1611) | ||
258 | IS_OMAP_TYPE(1621, 0x1621) | ||
259 | IS_OMAP_TYPE(1710, 0x1710) | ||
260 | IS_OMAP_TYPE(2420, 0x2420) | ||
261 | IS_OMAP_TYPE(2422, 0x2422) | ||
262 | IS_OMAP_TYPE(2423, 0x2423) | ||
263 | IS_OMAP_TYPE(2430, 0x2430) | ||
264 | IS_OMAP_TYPE(3430, 0x3430) | ||
265 | IS_OMAP_TYPE(3505, 0x3505) | ||
266 | IS_OMAP_TYPE(3517, 0x3517) | ||
267 | |||
268 | #define cpu_is_omap310() 0 | ||
269 | #define cpu_is_omap730() 0 | ||
270 | #define cpu_is_omap850() 0 | ||
271 | #define cpu_is_omap1510() 0 | ||
272 | #define cpu_is_omap1610() 0 | ||
273 | #define cpu_is_omap5912() 0 | ||
274 | #define cpu_is_omap1611() 0 | ||
275 | #define cpu_is_omap1621() 0 | ||
276 | #define cpu_is_omap1710() 0 | ||
277 | #define cpu_is_omap2420() 0 | ||
278 | #define cpu_is_omap2422() 0 | ||
279 | #define cpu_is_omap2423() 0 | ||
280 | #define cpu_is_omap2430() 0 | ||
281 | #define cpu_is_omap3503() 0 | ||
282 | #define cpu_is_omap3515() 0 | ||
283 | #define cpu_is_omap3525() 0 | ||
284 | #define cpu_is_omap3530() 0 | ||
285 | #define cpu_is_omap3505() 0 | ||
286 | #define cpu_is_omap3517() 0 | ||
287 | #define cpu_is_omap3430() 0 | ||
288 | #define cpu_is_omap4430() 0 | ||
289 | #define cpu_is_omap3630() 0 | ||
290 | |||
291 | /* | ||
292 | * Whether we have MULTI_OMAP1 or not, we still need to distinguish | ||
293 | * between 730 vs 850, 330 vs. 1510 and 1611B/5912 vs. 1710. | ||
294 | */ | ||
295 | |||
296 | #if defined(CONFIG_ARCH_OMAP730) | ||
297 | # undef cpu_is_omap730 | ||
298 | # define cpu_is_omap730() is_omap730() | ||
299 | #endif | ||
300 | |||
301 | #if defined(CONFIG_ARCH_OMAP850) | ||
302 | # undef cpu_is_omap850 | ||
303 | # define cpu_is_omap850() is_omap850() | ||
33 | #endif | 304 | #endif |
34 | 305 | ||
306 | #if defined(CONFIG_ARCH_OMAP15XX) | ||
307 | # undef cpu_is_omap310 | ||
308 | # undef cpu_is_omap1510 | ||
309 | # define cpu_is_omap310() is_omap310() | ||
310 | # define cpu_is_omap1510() is_omap1510() | ||
311 | #endif | ||
312 | |||
313 | #if defined(CONFIG_ARCH_OMAP16XX) | ||
314 | # undef cpu_is_omap1610 | ||
315 | # undef cpu_is_omap1611 | ||
316 | # undef cpu_is_omap5912 | ||
317 | # undef cpu_is_omap1621 | ||
318 | # undef cpu_is_omap1710 | ||
319 | # define cpu_is_omap1610() is_omap1610() | ||
320 | # define cpu_is_omap1611() is_omap1611() | ||
321 | # define cpu_is_omap5912() is_omap5912() | ||
322 | # define cpu_is_omap1621() is_omap1621() | ||
323 | # define cpu_is_omap1710() is_omap1710() | ||
324 | #endif | ||
325 | |||
326 | #if defined(CONFIG_ARCH_OMAP2) | ||
327 | # undef cpu_is_omap2420 | ||
328 | # undef cpu_is_omap2422 | ||
329 | # undef cpu_is_omap2423 | ||
330 | # undef cpu_is_omap2430 | ||
331 | # define cpu_is_omap2420() is_omap2420() | ||
332 | # define cpu_is_omap2422() is_omap2422() | ||
333 | # define cpu_is_omap2423() is_omap2423() | ||
334 | # define cpu_is_omap2430() is_omap2430() | ||
335 | #endif | ||
336 | |||
337 | #if defined(CONFIG_ARCH_OMAP3) | ||
338 | # undef cpu_is_omap3430 | ||
339 | # undef cpu_is_omap3503 | ||
340 | # undef cpu_is_omap3515 | ||
341 | # undef cpu_is_omap3525 | ||
342 | # undef cpu_is_omap3530 | ||
343 | # undef cpu_is_omap3505 | ||
344 | # undef cpu_is_omap3517 | ||
345 | # undef cpu_is_ti816x | ||
346 | # define cpu_is_omap3430() is_omap3430() | ||
347 | # define cpu_is_omap3503() (cpu_is_omap3430() && \ | ||
348 | (!omap3_has_iva()) && \ | ||
349 | (!omap3_has_sgx())) | ||
350 | # define cpu_is_omap3515() (cpu_is_omap3430() && \ | ||
351 | (!omap3_has_iva()) && \ | ||
352 | (omap3_has_sgx())) | ||
353 | # define cpu_is_omap3525() (cpu_is_omap3430() && \ | ||
354 | (!omap3_has_sgx()) && \ | ||
355 | (omap3_has_iva())) | ||
356 | # define cpu_is_omap3530() (cpu_is_omap3430()) | ||
357 | # define cpu_is_omap3505() is_omap3505() | ||
358 | # define cpu_is_omap3517() is_omap3517() | ||
359 | # undef cpu_is_omap3630 | ||
360 | # define cpu_is_omap3630() is_omap363x() | ||
361 | # define cpu_is_ti816x() is_ti816x() | ||
362 | #endif | ||
363 | |||
364 | # if defined(CONFIG_ARCH_OMAP4) | ||
365 | # undef cpu_is_omap44xx | ||
366 | # undef cpu_is_omap443x | ||
367 | # undef cpu_is_omap446x | ||
368 | # define cpu_is_omap44xx() is_omap44xx() | ||
369 | # define cpu_is_omap443x() is_omap443x() | ||
370 | # define cpu_is_omap446x() is_omap446x() | ||
371 | # endif | ||
372 | |||
373 | /* Macros to detect if we have OMAP1 or OMAP2 */ | ||
374 | #define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \ | ||
375 | cpu_is_omap16xx()) | ||
376 | #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \ | ||
377 | cpu_is_omap44xx()) | ||
378 | |||
379 | /* Various silicon revisions for omap2 */ | ||
380 | #define OMAP242X_CLASS 0x24200024 | ||
381 | #define OMAP2420_REV_ES1_0 OMAP242X_CLASS | ||
382 | #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (OMAP_REVBITS_01 << 8)) | ||
383 | |||
384 | #define OMAP243X_CLASS 0x24300024 | ||
385 | #define OMAP2430_REV_ES1_0 OMAP243X_CLASS | ||
386 | |||
387 | #define OMAP343X_CLASS 0x34300034 | ||
388 | #define OMAP3430_REV_ES1_0 OMAP343X_CLASS | ||
389 | #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (OMAP_REVBITS_01 << 8)) | ||
390 | #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (OMAP_REVBITS_02 << 8)) | ||
391 | #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (OMAP_REVBITS_03 << 8)) | ||
392 | #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (OMAP_REVBITS_04 << 8)) | ||
393 | #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (OMAP_REVBITS_05 << 8)) | ||
394 | |||
395 | #define OMAP363X_CLASS 0x36300034 | ||
396 | #define OMAP3630_REV_ES1_0 OMAP363X_CLASS | ||
397 | #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (OMAP_REVBITS_01 << 8)) | ||
398 | #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (OMAP_REVBITS_02 << 8)) | ||
399 | |||
400 | #define OMAP35XX_CLASS 0x35000034 | ||
401 | #define OMAP3503_REV(v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 8)) | ||
402 | #define OMAP3515_REV(v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 8)) | ||
403 | #define OMAP3525_REV(v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 8)) | ||
404 | #define OMAP3530_REV(v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 8)) | ||
405 | #define OMAP3505_REV(v) (OMAP35XX_CLASS | (0x3505 << 16) | (v << 8)) | ||
406 | #define OMAP3517_REV(v) (OMAP35XX_CLASS | (0x3517 << 16) | (v << 8)) | ||
407 | |||
408 | #define TI816X_CLASS 0x81600034 | ||
409 | #define TI8168_REV_ES1_0 TI816X_CLASS | ||
410 | #define TI8168_REV_ES1_1 (TI816X_CLASS | (OMAP_REVBITS_01 << 8)) | ||
411 | |||
412 | #define OMAP443X_CLASS 0x44300044 | ||
413 | #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) | ||
414 | #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8)) | ||
415 | #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8)) | ||
416 | #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8)) | ||
417 | |||
418 | #define OMAP446X_CLASS 0x44600044 | ||
419 | #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8)) | ||
420 | |||
421 | /* | ||
422 | * omap_chip bits | ||
423 | * | ||
424 | * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is | ||
425 | * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates | ||
426 | * something that is only valid on that particular ES revision. | ||
427 | * | ||
428 | * These bits may be ORed together to indicate structures that are | ||
429 | * available on multiple chip types. | ||
430 | * | ||
431 | * To test whether a particular structure matches the current OMAP chip type, | ||
432 | * use omap_chip_is(). | ||
433 | * | ||
434 | */ | ||
435 | #define CHIP_IS_OMAP2420 (1 << 0) | ||
436 | #define CHIP_IS_OMAP2430 (1 << 1) | ||
437 | #define CHIP_IS_OMAP3430 (1 << 2) | ||
438 | #define CHIP_IS_OMAP3430ES1 (1 << 3) | ||
439 | #define CHIP_IS_OMAP3430ES2 (1 << 4) | ||
440 | #define CHIP_IS_OMAP3430ES3_0 (1 << 5) | ||
441 | #define CHIP_IS_OMAP3430ES3_1 (1 << 6) | ||
442 | #define CHIP_IS_OMAP3630ES1 (1 << 7) | ||
443 | #define CHIP_IS_OMAP4430ES1 (1 << 8) | ||
444 | #define CHIP_IS_OMAP3630ES1_1 (1 << 9) | ||
445 | #define CHIP_IS_OMAP3630ES1_2 (1 << 10) | ||
446 | #define CHIP_IS_OMAP4430ES2 (1 << 11) | ||
447 | #define CHIP_IS_OMAP4430ES2_1 (1 << 12) | ||
448 | #define CHIP_IS_OMAP4430ES2_2 (1 << 13) | ||
449 | #define CHIP_IS_TI816X (1 << 14) | ||
450 | #define CHIP_IS_OMAP4460ES1_0 (1 << 15) | ||
451 | |||
452 | #define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) | ||
453 | |||
454 | #define CHIP_IS_OMAP4430 (CHIP_IS_OMAP4430ES1 | \ | ||
455 | CHIP_IS_OMAP4430ES2 | \ | ||
456 | CHIP_IS_OMAP4430ES2_1 | \ | ||
457 | CHIP_IS_OMAP4430ES2_2 | \ | ||
458 | CHIP_IS_OMAP4460ES1_0) | ||
459 | |||
460 | /* | ||
461 | * "GE" here represents "greater than or equal to" in terms of ES | ||
462 | * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430 | ||
463 | * chips at ES2 and beyond, but not, for example, any OMAP lines after | ||
464 | * OMAP3. | ||
465 | */ | ||
466 | #define CHIP_GE_OMAP3430ES2 (CHIP_IS_OMAP3430ES2 | \ | ||
467 | CHIP_IS_OMAP3430ES3_0 | \ | ||
468 | CHIP_GE_OMAP3430ES3_1) | ||
469 | #define CHIP_GE_OMAP3430ES3_1 (CHIP_IS_OMAP3430ES3_1 | \ | ||
470 | CHIP_IS_OMAP3630ES1 | \ | ||
471 | CHIP_GE_OMAP3630ES1_1) | ||
472 | #define CHIP_GE_OMAP3630ES1_1 (CHIP_IS_OMAP3630ES1_1 | \ | ||
473 | CHIP_IS_OMAP3630ES1_2) | ||
474 | |||
475 | int omap_chip_is(struct omap_chip_id oci); | ||
476 | void omap2_check_revision(void); | ||
477 | |||
478 | /* | ||
479 | * Runtime detection of OMAP3 features | ||
480 | */ | ||
481 | extern u32 omap_features; | ||
482 | |||
483 | #define OMAP3_HAS_L2CACHE BIT(0) | ||
484 | #define OMAP3_HAS_IVA BIT(1) | ||
485 | #define OMAP3_HAS_SGX BIT(2) | ||
486 | #define OMAP3_HAS_NEON BIT(3) | ||
487 | #define OMAP3_HAS_ISP BIT(4) | ||
488 | #define OMAP3_HAS_192MHZ_CLK BIT(5) | ||
489 | #define OMAP3_HAS_IO_WAKEUP BIT(6) | ||
490 | #define OMAP3_HAS_SDRC BIT(7) | ||
491 | #define OMAP4_HAS_MPU_1GHZ BIT(8) | ||
492 | #define OMAP4_HAS_MPU_1_2GHZ BIT(9) | ||
493 | #define OMAP4_HAS_MPU_1_5GHZ BIT(10) | ||
494 | |||
495 | |||
496 | #define OMAP3_HAS_FEATURE(feat,flag) \ | ||
497 | static inline unsigned int omap3_has_ ##feat(void) \ | ||
498 | { \ | ||
499 | return omap_features & OMAP3_HAS_ ##flag; \ | ||
500 | } \ | ||
501 | |||
502 | OMAP3_HAS_FEATURE(l2cache, L2CACHE) | ||
503 | OMAP3_HAS_FEATURE(sgx, SGX) | ||
504 | OMAP3_HAS_FEATURE(iva, IVA) | ||
505 | OMAP3_HAS_FEATURE(neon, NEON) | ||
506 | OMAP3_HAS_FEATURE(isp, ISP) | ||
507 | OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) | ||
508 | OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) | ||
509 | OMAP3_HAS_FEATURE(sdrc, SDRC) | ||
510 | |||
511 | /* | ||
512 | * Runtime detection of OMAP4 features | ||
513 | */ | ||
514 | extern u32 omap_features; | ||
515 | |||
516 | #define OMAP4_HAS_FEATURE(feat, flag) \ | ||
517 | static inline unsigned int omap4_has_ ##feat(void) \ | ||
518 | { \ | ||
519 | return omap_features & OMAP4_HAS_ ##flag; \ | ||
520 | } \ | ||
521 | |||
522 | OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ) | ||
523 | OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ) | ||
524 | OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ) | ||
525 | |||
35 | #endif | 526 | #endif |
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h index a3fbc48c332..eb5d16c60cd 100644 --- a/arch/arm/plat-omap/include/plat/dmtimer.h +++ b/arch/arm/plat-omap/include/plat/dmtimer.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/plat-omap/include/plat/dmtimer.h | 2 | * arch/arm/plat-omap/include/mach/dmtimer.h |
3 | * | 3 | * |
4 | * OMAP Dual-Mode Timers | 4 | * OMAP Dual-Mode Timers |
5 | * | 5 | * |
@@ -32,9 +32,9 @@ | |||
32 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 32 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/clk.h> | ||
35 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
36 | #include <linux/io.h> | 37 | #include <linux/io.h> |
37 | #include <linux/platform_device.h> | ||
38 | 38 | ||
39 | #ifndef __ASM_ARCH_DMTIMER_H | 39 | #ifndef __ASM_ARCH_DMTIMER_H |
40 | #define __ASM_ARCH_DMTIMER_H | 40 | #define __ASM_ARCH_DMTIMER_H |
@@ -54,81 +54,17 @@ | |||
54 | #define OMAP_TIMER_TRIGGER_OVERFLOW 0x01 | 54 | #define OMAP_TIMER_TRIGGER_OVERFLOW 0x01 |
55 | #define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02 | 55 | #define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02 |
56 | 56 | ||
57 | /* posted mode types */ | ||
58 | #define OMAP_TIMER_NONPOSTED 0x00 | ||
59 | #define OMAP_TIMER_POSTED 0x01 | ||
60 | |||
61 | /* timer capabilities used in hwmod database */ | ||
62 | #define OMAP_TIMER_SECURE 0x80000000 | ||
63 | #define OMAP_TIMER_ALWON 0x40000000 | ||
64 | #define OMAP_TIMER_HAS_PWM 0x20000000 | ||
65 | #define OMAP_TIMER_NEEDS_RESET 0x10000000 | ||
66 | #define OMAP_TIMER_HAS_DSP_IRQ 0x08000000 | ||
67 | |||
68 | /* | 57 | /* |
69 | * timer errata flags | 58 | * IP revision identifier so that Highlander IP |
70 | * | 59 | * in OMAP4 can be distinguished. |
71 | * Errata i103/i767 impacts all OMAP3/4/5 devices including AM33xx. This | ||
72 | * errata prevents us from using posted mode on these devices, unless the | ||
73 | * timer counter register is never read. For more details please refer to | ||
74 | * the OMAP3/4/5 errata documents. | ||
75 | */ | 60 | */ |
76 | #define OMAP_TIMER_ERRATA_I103_I767 0x80000000 | 61 | #define OMAP_TIMER_IP_VERSION_1 0x1 |
77 | 62 | struct omap_dm_timer; | |
78 | struct omap_timer_capability_dev_attr { | 63 | struct clk; |
79 | u32 timer_capability; | ||
80 | }; | ||
81 | |||
82 | struct timer_regs { | ||
83 | u32 tidr; | ||
84 | u32 tier; | ||
85 | u32 twer; | ||
86 | u32 tclr; | ||
87 | u32 tcrr; | ||
88 | u32 tldr; | ||
89 | u32 ttrg; | ||
90 | u32 twps; | ||
91 | u32 tmar; | ||
92 | u32 tcar1; | ||
93 | u32 tsicr; | ||
94 | u32 tcar2; | ||
95 | u32 tpir; | ||
96 | u32 tnir; | ||
97 | u32 tcvr; | ||
98 | u32 tocr; | ||
99 | u32 towr; | ||
100 | }; | ||
101 | |||
102 | struct omap_dm_timer { | ||
103 | int id; | ||
104 | int irq; | ||
105 | struct clk *fclk; | ||
106 | |||
107 | void __iomem *io_base; | ||
108 | void __iomem *irq_stat; /* TISR/IRQSTATUS interrupt status */ | ||
109 | void __iomem *irq_ena; /* irq enable */ | ||
110 | void __iomem *irq_dis; /* irq disable, only on v2 ip */ | ||
111 | void __iomem *pend; /* write pending */ | ||
112 | void __iomem *func_base; /* function register base */ | ||
113 | |||
114 | unsigned long rate; | ||
115 | unsigned reserved:1; | ||
116 | unsigned posted:1; | ||
117 | struct timer_regs context; | ||
118 | int (*get_context_loss_count)(struct device *); | ||
119 | int ctx_loss_count; | ||
120 | int revision; | ||
121 | u32 capability; | ||
122 | u32 errata; | ||
123 | struct platform_device *pdev; | ||
124 | struct list_head node; | ||
125 | }; | ||
126 | 64 | ||
127 | int omap_dm_timer_reserve_systimer(int id); | ||
128 | struct omap_dm_timer *omap_dm_timer_request(void); | 65 | struct omap_dm_timer *omap_dm_timer_request(void); |
129 | struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); | 66 | struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); |
130 | struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap); | 67 | void omap_dm_timer_free(struct omap_dm_timer *timer); |
131 | int omap_dm_timer_free(struct omap_dm_timer *timer); | ||
132 | void omap_dm_timer_enable(struct omap_dm_timer *timer); | 68 | void omap_dm_timer_enable(struct omap_dm_timer *timer); |
133 | void omap_dm_timer_disable(struct omap_dm_timer *timer); | 69 | void omap_dm_timer_disable(struct omap_dm_timer *timer); |
134 | 70 | ||
@@ -137,24 +73,23 @@ int omap_dm_timer_get_irq(struct omap_dm_timer *timer); | |||
137 | u32 omap_dm_timer_modify_idlect_mask(u32 inputmask); | 73 | u32 omap_dm_timer_modify_idlect_mask(u32 inputmask); |
138 | struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer); | 74 | struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer); |
139 | 75 | ||
140 | int omap_dm_timer_trigger(struct omap_dm_timer *timer); | 76 | void omap_dm_timer_trigger(struct omap_dm_timer *timer); |
141 | int omap_dm_timer_start(struct omap_dm_timer *timer); | 77 | void omap_dm_timer_start(struct omap_dm_timer *timer); |
142 | int omap_dm_timer_stop(struct omap_dm_timer *timer); | 78 | void omap_dm_timer_stop(struct omap_dm_timer *timer); |
143 | 79 | ||
144 | int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source); | 80 | int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source); |
145 | int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value); | 81 | void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value); |
146 | int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value); | 82 | void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value); |
147 | int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match); | 83 | void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match); |
148 | int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger); | 84 | void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger); |
149 | int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); | 85 | void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); |
150 | 86 | ||
151 | int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value); | 87 | void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value); |
152 | int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask); | ||
153 | 88 | ||
154 | unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer); | 89 | unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer); |
155 | int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value); | 90 | void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value); |
156 | unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer); | 91 | unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer); |
157 | int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value); | 92 | void omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value); |
158 | 93 | ||
159 | int omap_dm_timers_active(void); | 94 | int omap_dm_timers_active(void); |
160 | 95 | ||
@@ -163,30 +98,12 @@ int omap_dm_timers_active(void); | |||
163 | * used by dmtimer.c and sys_timer related code. | 98 | * used by dmtimer.c and sys_timer related code. |
164 | */ | 99 | */ |
165 | 100 | ||
166 | /* | 101 | /* register offsets */ |
167 | * The interrupt registers are different between v1 and v2 ip. | 102 | #define _OMAP_TIMER_ID_OFFSET 0x00 |
168 | * These registers are offsets from timer->iobase. | 103 | #define _OMAP_TIMER_OCP_CFG_OFFSET 0x10 |
169 | */ | 104 | #define _OMAP_TIMER_SYS_STAT_OFFSET 0x14 |
170 | #define OMAP_TIMER_ID_OFFSET 0x00 | 105 | #define _OMAP_TIMER_STAT_OFFSET 0x18 |
171 | #define OMAP_TIMER_OCP_CFG_OFFSET 0x10 | 106 | #define _OMAP_TIMER_INT_EN_OFFSET 0x1c |
172 | |||
173 | #define OMAP_TIMER_V1_SYS_STAT_OFFSET 0x14 | ||
174 | #define OMAP_TIMER_V1_STAT_OFFSET 0x18 | ||
175 | #define OMAP_TIMER_V1_INT_EN_OFFSET 0x1c | ||
176 | |||
177 | #define OMAP_TIMER_V2_IRQSTATUS_RAW 0x24 | ||
178 | #define OMAP_TIMER_V2_IRQSTATUS 0x28 | ||
179 | #define OMAP_TIMER_V2_IRQENABLE_SET 0x2c | ||
180 | #define OMAP_TIMER_V2_IRQENABLE_CLR 0x30 | ||
181 | |||
182 | /* | ||
183 | * The functional registers have a different base on v1 and v2 ip. | ||
184 | * These registers are offsets from timer->func_base. The func_base | ||
185 | * is samae as io_base for v1 and io_base + 0x14 for v2 ip. | ||
186 | * | ||
187 | */ | ||
188 | #define OMAP_TIMER_V2_FUNC_OFFSET 0x14 | ||
189 | |||
190 | #define _OMAP_TIMER_WAKEUP_EN_OFFSET 0x20 | 107 | #define _OMAP_TIMER_WAKEUP_EN_OFFSET 0x20 |
191 | #define _OMAP_TIMER_CTRL_OFFSET 0x24 | 108 | #define _OMAP_TIMER_CTRL_OFFSET 0x24 |
192 | #define OMAP_TIMER_CTRL_GPOCFG (1 << 14) | 109 | #define OMAP_TIMER_CTRL_GPOCFG (1 << 14) |
@@ -230,6 +147,21 @@ int omap_dm_timers_active(void); | |||
230 | /* register offsets with the write pending bit encoded */ | 147 | /* register offsets with the write pending bit encoded */ |
231 | #define WPSHIFT 16 | 148 | #define WPSHIFT 16 |
232 | 149 | ||
150 | #define OMAP_TIMER_ID_REG (_OMAP_TIMER_ID_OFFSET \ | ||
151 | | (WP_NONE << WPSHIFT)) | ||
152 | |||
153 | #define OMAP_TIMER_OCP_CFG_REG (_OMAP_TIMER_OCP_CFG_OFFSET \ | ||
154 | | (WP_NONE << WPSHIFT)) | ||
155 | |||
156 | #define OMAP_TIMER_SYS_STAT_REG (_OMAP_TIMER_SYS_STAT_OFFSET \ | ||
157 | | (WP_NONE << WPSHIFT)) | ||
158 | |||
159 | #define OMAP_TIMER_STAT_REG (_OMAP_TIMER_STAT_OFFSET \ | ||
160 | | (WP_NONE << WPSHIFT)) | ||
161 | |||
162 | #define OMAP_TIMER_INT_EN_REG (_OMAP_TIMER_INT_EN_OFFSET \ | ||
163 | | (WP_NONE << WPSHIFT)) | ||
164 | |||
233 | #define OMAP_TIMER_WAKEUP_EN_REG (_OMAP_TIMER_WAKEUP_EN_OFFSET \ | 165 | #define OMAP_TIMER_WAKEUP_EN_REG (_OMAP_TIMER_WAKEUP_EN_OFFSET \ |
234 | | (WP_NONE << WPSHIFT)) | 166 | | (WP_NONE << WPSHIFT)) |
235 | 167 | ||
@@ -275,103 +207,97 @@ int omap_dm_timers_active(void); | |||
275 | #define OMAP_TIMER_TICK_INT_MASK_COUNT_REG \ | 207 | #define OMAP_TIMER_TICK_INT_MASK_COUNT_REG \ |
276 | (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT)) | 208 | (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT)) |
277 | 209 | ||
278 | static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg, | 210 | struct omap_dm_timer { |
211 | unsigned long phys_base; | ||
212 | int irq; | ||
213 | #ifdef CONFIG_ARCH_OMAP2PLUS | ||
214 | struct clk *iclk, *fclk; | ||
215 | #endif | ||
216 | void __iomem *io_base; | ||
217 | unsigned long rate; | ||
218 | unsigned reserved:1; | ||
219 | unsigned enabled:1; | ||
220 | unsigned posted:1; | ||
221 | }; | ||
222 | |||
223 | extern u32 sys_timer_reserved; | ||
224 | void omap_dm_timer_prepare(struct omap_dm_timer *timer); | ||
225 | |||
226 | static inline u32 __omap_dm_timer_read(void __iomem *base, u32 reg, | ||
279 | int posted) | 227 | int posted) |
280 | { | 228 | { |
281 | if (posted) | 229 | if (posted) |
282 | while (__raw_readl(timer->pend) & (reg >> WPSHIFT)) | 230 | while (__raw_readl(base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)) |
231 | & (reg >> WPSHIFT)) | ||
283 | cpu_relax(); | 232 | cpu_relax(); |
284 | 233 | ||
285 | return __raw_readl(timer->func_base + (reg & 0xff)); | 234 | return __raw_readl(base + (reg & 0xff)); |
286 | } | 235 | } |
287 | 236 | ||
288 | static inline void __omap_dm_timer_write(struct omap_dm_timer *timer, | 237 | static inline void __omap_dm_timer_write(void __iomem *base, u32 reg, u32 val, |
289 | u32 reg, u32 val, int posted) | 238 | int posted) |
290 | { | 239 | { |
291 | if (posted) | 240 | if (posted) |
292 | while (__raw_readl(timer->pend) & (reg >> WPSHIFT)) | 241 | while (__raw_readl(base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)) |
242 | & (reg >> WPSHIFT)) | ||
293 | cpu_relax(); | 243 | cpu_relax(); |
294 | 244 | ||
295 | __raw_writel(val, timer->func_base + (reg & 0xff)); | 245 | __raw_writel(val, base + (reg & 0xff)); |
296 | } | 246 | } |
297 | 247 | ||
298 | static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer) | 248 | /* Assumes the source clock has been set by caller */ |
249 | static inline void __omap_dm_timer_reset(void __iomem *base, int autoidle, | ||
250 | int wakeup) | ||
299 | { | 251 | { |
300 | u32 tidr; | 252 | u32 l; |
301 | |||
302 | /* Assume v1 ip if bits [31:16] are zero */ | ||
303 | tidr = __raw_readl(timer->io_base); | ||
304 | if (!(tidr >> 16)) { | ||
305 | timer->revision = 1; | ||
306 | timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET; | ||
307 | timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET; | ||
308 | timer->irq_dis = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET; | ||
309 | timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET; | ||
310 | timer->func_base = timer->io_base; | ||
311 | } else { | ||
312 | timer->revision = 2; | ||
313 | timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS; | ||
314 | timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET; | ||
315 | timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR; | ||
316 | timer->pend = timer->io_base + | ||
317 | _OMAP_TIMER_WRITE_PEND_OFFSET + | ||
318 | OMAP_TIMER_V2_FUNC_OFFSET; | ||
319 | timer->func_base = timer->io_base + OMAP_TIMER_V2_FUNC_OFFSET; | ||
320 | } | ||
321 | } | ||
322 | 253 | ||
323 | /* | 254 | l = __omap_dm_timer_read(base, OMAP_TIMER_OCP_CFG_REG, 0); |
324 | * __omap_dm_timer_enable_posted - enables write posted mode | 255 | l |= 0x02 << 3; /* Set to smart-idle mode */ |
325 | * @timer: pointer to timer instance handle | 256 | l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */ |
326 | * | 257 | |
327 | * Enables the write posted mode for the timer. When posted mode is enabled | 258 | if (autoidle) |
328 | * writes to certain timer registers are immediately acknowledged by the | 259 | l |= 0x1 << 0; |
329 | * internal bus and hence prevents stalling the CPU waiting for the write to | ||
330 | * complete. Enabling this feature can improve performance for writing to the | ||
331 | * timer registers. | ||
332 | */ | ||
333 | static inline void __omap_dm_timer_enable_posted(struct omap_dm_timer *timer) | ||
334 | { | ||
335 | if (timer->posted) | ||
336 | return; | ||
337 | 260 | ||
338 | if (timer->errata & OMAP_TIMER_ERRATA_I103_I767) | 261 | if (wakeup) |
339 | return; | 262 | l |= 1 << 2; |
340 | 263 | ||
341 | __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, | 264 | __omap_dm_timer_write(base, OMAP_TIMER_OCP_CFG_REG, l, 0); |
342 | OMAP_TIMER_CTRL_POSTED, 0); | 265 | |
343 | timer->context.tsicr = OMAP_TIMER_CTRL_POSTED; | 266 | /* Match hardware reset default of posted mode */ |
344 | timer->posted = OMAP_TIMER_POSTED; | 267 | __omap_dm_timer_write(base, OMAP_TIMER_IF_CTRL_REG, |
268 | OMAP_TIMER_CTRL_POSTED, 0); | ||
345 | } | 269 | } |
346 | 270 | ||
347 | /** | 271 | static inline int __omap_dm_timer_set_source(struct clk *timer_fck, |
348 | * __omap_dm_timer_override_errata - override errata flags for a timer | 272 | struct clk *parent) |
349 | * @timer: pointer to timer handle | ||
350 | * @errata: errata flags to be ignored | ||
351 | * | ||
352 | * For a given timer, override a timer errata by clearing the flags | ||
353 | * specified by the errata argument. A specific erratum should only be | ||
354 | * overridden for a timer if the timer is used in such a way the erratum | ||
355 | * has no impact. | ||
356 | */ | ||
357 | static inline void __omap_dm_timer_override_errata(struct omap_dm_timer *timer, | ||
358 | u32 errata) | ||
359 | { | 273 | { |
360 | timer->errata &= ~errata; | 274 | int ret; |
275 | |||
276 | clk_disable(timer_fck); | ||
277 | ret = clk_set_parent(timer_fck, parent); | ||
278 | clk_enable(timer_fck); | ||
279 | |||
280 | /* | ||
281 | * When the functional clock disappears, too quick writes seem | ||
282 | * to cause an abort. XXX Is this still necessary? | ||
283 | */ | ||
284 | __delay(300000); | ||
285 | |||
286 | return ret; | ||
361 | } | 287 | } |
362 | 288 | ||
363 | static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer, | 289 | static inline void __omap_dm_timer_stop(void __iomem *base, int posted, |
364 | int posted, unsigned long rate) | 290 | unsigned long rate) |
365 | { | 291 | { |
366 | u32 l; | 292 | u32 l; |
367 | 293 | ||
368 | l = __omap_dm_timer_read(timer, OMAP_TIMER_CTRL_REG, posted); | 294 | l = __omap_dm_timer_read(base, OMAP_TIMER_CTRL_REG, posted); |
369 | if (l & OMAP_TIMER_CTRL_ST) { | 295 | if (l & OMAP_TIMER_CTRL_ST) { |
370 | l &= ~0x1; | 296 | l &= ~0x1; |
371 | __omap_dm_timer_write(timer, OMAP_TIMER_CTRL_REG, l, posted); | 297 | __omap_dm_timer_write(base, OMAP_TIMER_CTRL_REG, l, posted); |
372 | #ifdef CONFIG_ARCH_OMAP2PLUS | 298 | #ifdef CONFIG_ARCH_OMAP2PLUS |
373 | /* Readback to make sure write has completed */ | 299 | /* Readback to make sure write has completed */ |
374 | __omap_dm_timer_read(timer, OMAP_TIMER_CTRL_REG, posted); | 300 | __omap_dm_timer_read(base, OMAP_TIMER_CTRL_REG, posted); |
375 | /* | 301 | /* |
376 | * Wait for functional clock period x 3.5 to make sure that | 302 | * Wait for functional clock period x 3.5 to make sure that |
377 | * timer is stopped | 303 | * timer is stopped |
@@ -381,34 +307,34 @@ static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer, | |||
381 | } | 307 | } |
382 | 308 | ||
383 | /* Ack possibly pending interrupt */ | 309 | /* Ack possibly pending interrupt */ |
384 | __raw_writel(OMAP_TIMER_INT_OVERFLOW, timer->irq_stat); | 310 | __omap_dm_timer_write(base, OMAP_TIMER_STAT_REG, |
311 | OMAP_TIMER_INT_OVERFLOW, 0); | ||
385 | } | 312 | } |
386 | 313 | ||
387 | static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer, | 314 | static inline void __omap_dm_timer_load_start(void __iomem *base, u32 ctrl, |
388 | u32 ctrl, unsigned int load, | 315 | unsigned int load, int posted) |
389 | int posted) | ||
390 | { | 316 | { |
391 | __omap_dm_timer_write(timer, OMAP_TIMER_COUNTER_REG, load, posted); | 317 | __omap_dm_timer_write(base, OMAP_TIMER_COUNTER_REG, load, posted); |
392 | __omap_dm_timer_write(timer, OMAP_TIMER_CTRL_REG, ctrl, posted); | 318 | __omap_dm_timer_write(base, OMAP_TIMER_CTRL_REG, ctrl, posted); |
393 | } | 319 | } |
394 | 320 | ||
395 | static inline void __omap_dm_timer_int_enable(struct omap_dm_timer *timer, | 321 | static inline void __omap_dm_timer_int_enable(void __iomem *base, |
396 | unsigned int value) | 322 | unsigned int value) |
397 | { | 323 | { |
398 | __raw_writel(value, timer->irq_ena); | 324 | __omap_dm_timer_write(base, OMAP_TIMER_INT_EN_REG, value, 0); |
399 | __omap_dm_timer_write(timer, OMAP_TIMER_WAKEUP_EN_REG, value, 0); | 325 | __omap_dm_timer_write(base, OMAP_TIMER_WAKEUP_EN_REG, value, 0); |
400 | } | 326 | } |
401 | 327 | ||
402 | static inline unsigned int | 328 | static inline unsigned int __omap_dm_timer_read_counter(void __iomem *base, |
403 | __omap_dm_timer_read_counter(struct omap_dm_timer *timer, int posted) | 329 | int posted) |
404 | { | 330 | { |
405 | return __omap_dm_timer_read(timer, OMAP_TIMER_COUNTER_REG, posted); | 331 | return __omap_dm_timer_read(base, OMAP_TIMER_COUNTER_REG, posted); |
406 | } | 332 | } |
407 | 333 | ||
408 | static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer, | 334 | static inline void __omap_dm_timer_write_status(void __iomem *base, |
409 | unsigned int value) | 335 | unsigned int value) |
410 | { | 336 | { |
411 | __raw_writel(value, timer->irq_stat); | 337 | __omap_dm_timer_write(base, OMAP_TIMER_STAT_REG, value, 0); |
412 | } | 338 | } |
413 | 339 | ||
414 | #endif /* __ASM_ARCH_DMTIMER_H */ | 340 | #endif /* __ASM_ARCH_DMTIMER_H */ |
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h index 7a9028cb5a7..7c22b9e10dc 100644 --- a/arch/arm/plat-omap/include/plat/i2c.h +++ b/arch/arm/plat-omap/include/plat/i2c.h | |||
@@ -18,15 +18,11 @@ | |||
18 | * 02110-1301 USA | 18 | * 02110-1301 USA |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | #ifndef __ASM__ARCH_OMAP_I2C_H | ||
22 | #define __ASM__ARCH_OMAP_I2C_H | ||
21 | 23 | ||
22 | #ifndef __PLAT_OMAP_I2C_H | 24 | #include <linux/i2c.h> |
23 | #define __PLAT_OMAP_I2C_H | 25 | #include <linux/i2c-omap.h> |
24 | |||
25 | struct i2c_board_info; | ||
26 | struct omap_i2c_bus_platform_data; | ||
27 | |||
28 | int omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata, | ||
29 | int bus_id); | ||
30 | 26 | ||
31 | #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) | 27 | #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) |
32 | extern int omap_register_i2c_bus(int bus_id, u32 clkrate, | 28 | extern int omap_register_i2c_bus(int bus_id, u32 clkrate, |
@@ -41,7 +37,23 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate, | |||
41 | } | 37 | } |
42 | #endif | 38 | #endif |
43 | 39 | ||
40 | /** | ||
41 | * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod | ||
42 | * @fifo_depth: total controller FIFO size (in bytes) | ||
43 | * @flags: differences in hardware support capability | ||
44 | * | ||
45 | * @fifo_depth represents what exists on the hardware, not what is | ||
46 | * actually configured at runtime by the device driver. | ||
47 | */ | ||
48 | struct omap_i2c_dev_attr { | ||
49 | u8 fifo_depth; | ||
50 | u32 flags; | ||
51 | }; | ||
52 | |||
53 | void __init omap1_i2c_mux_pins(int bus_id); | ||
54 | void __init omap2_i2c_mux_pins(int bus_id); | ||
55 | |||
44 | struct omap_hwmod; | 56 | struct omap_hwmod; |
45 | int omap_i2c_reset(struct omap_hwmod *oh); | 57 | int omap_i2c_reset(struct omap_hwmod *oh); |
46 | 58 | ||
47 | #endif /* __PLAT_OMAP_I2C_H */ | 59 | #endif /* __ASM__ARCH_OMAP_I2C_H */ |
diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h index ba4525059a9..f500fc34d06 100644 --- a/arch/arm/plat-omap/include/plat/sram.h +++ b/arch/arm/plat-omap/include/plat/sram.h | |||
@@ -1,8 +1,18 @@ | |||
1 | int omap_sram_init(void); | 1 | /* |
2 | * arch/arm/plat-omap/include/mach/sram.h | ||
3 | * | ||
4 | * Interface for functions that need to be run in internal SRAM | ||
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 | */ | ||
2 | 10 | ||
3 | void omap_map_sram(unsigned long start, unsigned long size, | 11 | #ifndef __ARCH_ARM_OMAP_SRAM_H |
4 | unsigned long skip, int cached); | 12 | #define __ARCH_ARM_OMAP_SRAM_H |
5 | void omap_sram_reset(void); | 13 | |
14 | #ifndef __ASSEMBLY__ | ||
15 | #include <asm/fncpy.h> | ||
6 | 16 | ||
7 | extern void *omap_sram_push_address(unsigned long size); | 17 | extern void *omap_sram_push_address(unsigned long size); |
8 | 18 | ||
@@ -14,3 +24,77 @@ extern void *omap_sram_push_address(unsigned long size); | |||
14 | _res = fncpy(_sram_address, &(funcp), size); \ | 24 | _res = fncpy(_sram_address, &(funcp), size); \ |
15 | _res; \ | 25 | _res; \ |
16 | }) | 26 | }) |
27 | |||
28 | extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl); | ||
29 | |||
30 | extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, | ||
31 | u32 base_cs, u32 force_unlock); | ||
32 | extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, | ||
33 | u32 mem_type); | ||
34 | extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); | ||
35 | |||
36 | extern u32 omap3_configure_core_dpll( | ||
37 | u32 m2, u32 unlock_dll, u32 f, u32 inc, | ||
38 | u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0, | ||
39 | u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0, | ||
40 | u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1, | ||
41 | u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1); | ||
42 | extern void omap3_sram_restore_context(void); | ||
43 | |||
44 | /* Do not use these */ | ||
45 | extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl); | ||
46 | extern unsigned long omap1_sram_reprogram_clock_sz; | ||
47 | |||
48 | extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl); | ||
49 | extern unsigned long omap24xx_sram_reprogram_clock_sz; | ||
50 | |||
51 | extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, | ||
52 | u32 base_cs, u32 force_unlock); | ||
53 | extern unsigned long omap242x_sram_ddr_init_sz; | ||
54 | |||
55 | extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, | ||
56 | int bypass); | ||
57 | extern unsigned long omap242x_sram_set_prcm_sz; | ||
58 | |||
59 | extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, | ||
60 | u32 mem_type); | ||
61 | extern unsigned long omap242x_sram_reprogram_sdrc_sz; | ||
62 | |||
63 | |||
64 | extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, | ||
65 | u32 base_cs, u32 force_unlock); | ||
66 | extern unsigned long omap243x_sram_ddr_init_sz; | ||
67 | |||
68 | extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, | ||
69 | int bypass); | ||
70 | extern unsigned long omap243x_sram_set_prcm_sz; | ||
71 | |||
72 | extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, | ||
73 | u32 mem_type); | ||
74 | extern unsigned long omap243x_sram_reprogram_sdrc_sz; | ||
75 | |||
76 | extern u32 omap3_sram_configure_core_dpll( | ||
77 | u32 m2, u32 unlock_dll, u32 f, u32 inc, | ||
78 | u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0, | ||
79 | u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0, | ||
80 | u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1, | ||
81 | u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1); | ||
82 | extern unsigned long omap3_sram_configure_core_dpll_sz; | ||
83 | |||
84 | #ifdef CONFIG_PM | ||
85 | extern void omap_push_sram_idle(void); | ||
86 | #else | ||
87 | static inline void omap_push_sram_idle(void) {} | ||
88 | #endif /* CONFIG_PM */ | ||
89 | |||
90 | #endif /* __ASSEMBLY__ */ | ||
91 | |||
92 | /* | ||
93 | * OMAP2+: define the SRAM PA addresses. | ||
94 | * Used by the SRAM management code and the idle sleep code. | ||
95 | */ | ||
96 | #define OMAP2_SRAM_PA 0x40200000 | ||
97 | #define OMAP3_SRAM_PA 0x40200000 | ||
98 | #define OMAP4_SRAM_PA 0x40300000 | ||
99 | |||
100 | #endif | ||