1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30#ifndef __ASM_ARCH_OMAP_CPU_H
31#define __ASM_ARCH_OMAP_CPU_H
32
33#include <linux/bitops.h>
34#include <plat/multi.h>
35
36
37
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
45int omap_type(void);
46
47
48
49
50
51
52
53unsigned int omap_rev(void);
54
55
56
57
58#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74#define GET_OMAP_CLASS (omap_rev() & 0xff)
75
76#define IS_OMAP_CLASS(class, id) \
77static inline int is_omap ##class (void) \
78{ \
79 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
80}
81
82#define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
83
84#define IS_AM_CLASS(class, id) \
85static inline int is_am ##class (void) \
86{ \
87 return (GET_AM_CLASS == (id)) ? 1 : 0; \
88}
89
90#define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
91
92#define IS_TI_CLASS(class, id) \
93static inline int is_ti ##class (void) \
94{ \
95 return (GET_TI_CLASS == (id)) ? 1 : 0; \
96}
97
98#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
99
100#define IS_OMAP_SUBCLASS(subclass, id) \
101static inline int is_omap ##subclass (void) \
102{ \
103 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
104}
105
106#define IS_TI_SUBCLASS(subclass, id) \
107static inline int is_ti ##subclass (void) \
108{ \
109 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
110}
111
112#define IS_AM_SUBCLASS(subclass, id) \
113static inline int is_am ##subclass (void) \
114{ \
115 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
116}
117
118IS_OMAP_CLASS(7xx, 0x07)
119IS_OMAP_CLASS(15xx, 0x15)
120IS_OMAP_CLASS(16xx, 0x16)
121IS_OMAP_CLASS(24xx, 0x24)
122IS_OMAP_CLASS(34xx, 0x34)
123IS_OMAP_CLASS(44xx, 0x44)
124IS_AM_CLASS(33xx, 0x33)
125
126IS_TI_CLASS(81xx, 0x81)
127
128IS_OMAP_SUBCLASS(242x, 0x242)
129IS_OMAP_SUBCLASS(243x, 0x243)
130IS_OMAP_SUBCLASS(343x, 0x343)
131IS_OMAP_SUBCLASS(363x, 0x363)
132IS_OMAP_SUBCLASS(443x, 0x443)
133IS_OMAP_SUBCLASS(446x, 0x446)
134IS_OMAP_SUBCLASS(447x, 0x447)
135
136IS_TI_SUBCLASS(816x, 0x816)
137IS_TI_SUBCLASS(814x, 0x814)
138IS_AM_SUBCLASS(335x, 0x335)
139
140#define cpu_is_omap7xx() 0
141#define cpu_is_omap15xx() 0
142#define cpu_is_omap16xx() 0
143#define cpu_is_omap24xx() 0
144#define cpu_is_omap242x() 0
145#define cpu_is_omap243x() 0
146#define cpu_is_omap34xx() 0
147#define cpu_is_omap343x() 0
148#define cpu_is_ti81xx() 0
149#define cpu_is_ti816x() 0
150#define cpu_is_ti814x() 0
151#define cpu_is_am33xx() 0
152#define cpu_is_am335x() 0
153#define cpu_is_omap44xx() 0
154#define cpu_is_omap443x() 0
155#define cpu_is_omap446x() 0
156#define cpu_is_omap447x() 0
157
158#if defined(MULTI_OMAP1)
159# if defined(CONFIG_ARCH_OMAP730)
160# undef cpu_is_omap7xx
161# define cpu_is_omap7xx() is_omap7xx()
162# endif
163# if defined(CONFIG_ARCH_OMAP850)
164# undef cpu_is_omap7xx
165# define cpu_is_omap7xx() is_omap7xx()
166# endif
167# if defined(CONFIG_ARCH_OMAP15XX)
168# undef cpu_is_omap15xx
169# define cpu_is_omap15xx() is_omap15xx()
170# endif
171# if defined(CONFIG_ARCH_OMAP16XX)
172# undef cpu_is_omap16xx
173# define cpu_is_omap16xx() is_omap16xx()
174# endif
175#else
176# if defined(CONFIG_ARCH_OMAP730)
177# undef cpu_is_omap7xx
178# define cpu_is_omap7xx() 1
179# endif
180# if defined(CONFIG_ARCH_OMAP850)
181# undef cpu_is_omap7xx
182# define cpu_is_omap7xx() 1
183# endif
184# if defined(CONFIG_ARCH_OMAP15XX)
185# undef cpu_is_omap15xx
186# define cpu_is_omap15xx() 1
187# endif
188# if defined(CONFIG_ARCH_OMAP16XX)
189# undef cpu_is_omap16xx
190# define cpu_is_omap16xx() 1
191# endif
192#endif
193
194#if defined(MULTI_OMAP2)
195# if defined(CONFIG_ARCH_OMAP2)
196# undef cpu_is_omap24xx
197# define cpu_is_omap24xx() is_omap24xx()
198# endif
199# if defined (CONFIG_SOC_OMAP2420)
200# undef cpu_is_omap242x
201# define cpu_is_omap242x() is_omap242x()
202# endif
203# if defined (CONFIG_SOC_OMAP2430)
204# undef cpu_is_omap243x
205# define cpu_is_omap243x() is_omap243x()
206# endif
207# if defined(CONFIG_ARCH_OMAP3)
208# undef cpu_is_omap34xx
209# undef cpu_is_omap343x
210# define cpu_is_omap34xx() is_omap34xx()
211# define cpu_is_omap343x() is_omap343x()
212# endif
213#else
214# if defined(CONFIG_ARCH_OMAP2)
215# undef cpu_is_omap24xx
216# define cpu_is_omap24xx() 1
217# endif
218# if defined(CONFIG_SOC_OMAP2420)
219# undef cpu_is_omap242x
220# define cpu_is_omap242x() 1
221# endif
222# if defined(CONFIG_SOC_OMAP2430)
223# undef cpu_is_omap243x
224# define cpu_is_omap243x() 1
225# endif
226# if defined(CONFIG_ARCH_OMAP3)
227# undef cpu_is_omap34xx
228# define cpu_is_omap34xx() 1
229# endif
230# if defined(CONFIG_SOC_OMAP3430)
231# undef cpu_is_omap343x
232# define cpu_is_omap343x() 1
233# endif
234#endif
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
257
258#define IS_OMAP_TYPE(type, id) \
259static inline int is_omap ##type (void) \
260{ \
261 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
262}
263
264IS_OMAP_TYPE(310, 0x0310)
265IS_OMAP_TYPE(730, 0x0730)
266IS_OMAP_TYPE(850, 0x0850)
267IS_OMAP_TYPE(1510, 0x1510)
268IS_OMAP_TYPE(1610, 0x1610)
269IS_OMAP_TYPE(1611, 0x1611)
270IS_OMAP_TYPE(5912, 0x1611)
271IS_OMAP_TYPE(1621, 0x1621)
272IS_OMAP_TYPE(1710, 0x1710)
273IS_OMAP_TYPE(2420, 0x2420)
274IS_OMAP_TYPE(2422, 0x2422)
275IS_OMAP_TYPE(2423, 0x2423)
276IS_OMAP_TYPE(2430, 0x2430)
277IS_OMAP_TYPE(3430, 0x3430)
278IS_OMAP_TYPE(3505, 0x3517)
279IS_OMAP_TYPE(3517, 0x3517)
280
281#define cpu_is_omap310() 0
282#define cpu_is_omap730() 0
283#define cpu_is_omap850() 0
284#define cpu_is_omap1510() 0
285#define cpu_is_omap1610() 0
286#define cpu_is_omap5912() 0
287#define cpu_is_omap1611() 0
288#define cpu_is_omap1621() 0
289#define cpu_is_omap1710() 0
290#define cpu_is_omap2420() 0
291#define cpu_is_omap2422() 0
292#define cpu_is_omap2423() 0
293#define cpu_is_omap2430() 0
294#define cpu_is_omap3503() 0
295#define cpu_is_omap3515() 0
296#define cpu_is_omap3525() 0
297#define cpu_is_omap3530() 0
298#define cpu_is_omap3505() 0
299#define cpu_is_omap3517() 0
300#define cpu_is_omap3430() 0
301#define cpu_is_omap3630() 0
302
303
304
305
306
307
308#if defined(CONFIG_ARCH_OMAP730)
309# undef cpu_is_omap730
310# define cpu_is_omap730() is_omap730()
311#endif
312
313#if defined(CONFIG_ARCH_OMAP850)
314# undef cpu_is_omap850
315# define cpu_is_omap850() is_omap850()
316#endif
317
318#if defined(CONFIG_ARCH_OMAP15XX)
319# undef cpu_is_omap310
320# undef cpu_is_omap1510
321# define cpu_is_omap310() is_omap310()
322# define cpu_is_omap1510() is_omap1510()
323#endif
324
325#if defined(CONFIG_ARCH_OMAP16XX)
326# undef cpu_is_omap1610
327# undef cpu_is_omap1611
328# undef cpu_is_omap5912
329# undef cpu_is_omap1621
330# undef cpu_is_omap1710
331# define cpu_is_omap1610() is_omap1610()
332# define cpu_is_omap1611() is_omap1611()
333# define cpu_is_omap5912() is_omap5912()
334# define cpu_is_omap1621() is_omap1621()
335# define cpu_is_omap1710() is_omap1710()
336#endif
337
338#if defined(CONFIG_ARCH_OMAP2)
339# undef cpu_is_omap2420
340# undef cpu_is_omap2422
341# undef cpu_is_omap2423
342# undef cpu_is_omap2430
343# define cpu_is_omap2420() is_omap2420()
344# define cpu_is_omap2422() is_omap2422()
345# define cpu_is_omap2423() is_omap2423()
346# define cpu_is_omap2430() is_omap2430()
347#endif
348
349#if defined(CONFIG_ARCH_OMAP3)
350# undef cpu_is_omap3430
351# undef cpu_is_omap3503
352# undef cpu_is_omap3515
353# undef cpu_is_omap3525
354# undef cpu_is_omap3530
355# undef cpu_is_omap3505
356# undef cpu_is_omap3517
357# undef cpu_is_ti81xx
358# undef cpu_is_ti816x
359# undef cpu_is_ti814x
360# undef cpu_is_am33xx
361# undef cpu_is_am335x
362# define cpu_is_omap3430() is_omap3430()
363# define cpu_is_omap3503() (cpu_is_omap3430() && \
364 (!omap3_has_iva()) && \
365 (!omap3_has_sgx()))
366# define cpu_is_omap3515() (cpu_is_omap3430() && \
367 (!omap3_has_iva()) && \
368 (omap3_has_sgx()))
369# define cpu_is_omap3525() (cpu_is_omap3430() && \
370 (!omap3_has_sgx()) && \
371 (omap3_has_iva()))
372# define cpu_is_omap3530() (cpu_is_omap3430())
373# define cpu_is_omap3517() is_omap3517()
374# define cpu_is_omap3505() (cpu_is_omap3517() && \
375 !omap3_has_sgx())
376# undef cpu_is_omap3630
377# define cpu_is_omap3630() is_omap363x()
378# define cpu_is_ti81xx() is_ti81xx()
379# define cpu_is_ti816x() is_ti816x()
380# define cpu_is_ti814x() is_ti814x()
381# define cpu_is_am33xx() is_am33xx()
382# define cpu_is_am335x() is_am335x()
383#endif
384
385# if defined(CONFIG_ARCH_OMAP4)
386# undef cpu_is_omap44xx
387# undef cpu_is_omap443x
388# undef cpu_is_omap446x
389# undef cpu_is_omap447x
390# define cpu_is_omap44xx() is_omap44xx()
391# define cpu_is_omap443x() is_omap443x()
392# define cpu_is_omap446x() is_omap446x()
393# define cpu_is_omap447x() is_omap447x()
394# endif
395
396
397#define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
398 cpu_is_omap16xx())
399#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
400 cpu_is_omap44xx())
401
402
403#define OMAP242X_CLASS 0x24200024
404#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
405#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
406
407#define OMAP243X_CLASS 0x24300024
408#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
409
410#define OMAP343X_CLASS 0x34300034
411#define OMAP3430_REV_ES1_0 OMAP343X_CLASS
412#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
413#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
414#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
415#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
416#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
417
418#define OMAP363X_CLASS 0x36300034
419#define OMAP3630_REV_ES1_0 OMAP363X_CLASS
420#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
421#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
422
423#define OMAP3517_CLASS 0x35170034
424#define OMAP3517_REV_ES1_0 OMAP3517_CLASS
425#define OMAP3517_REV_ES1_1 (OMAP3517_CLASS | (0x1 << 8))
426
427#define TI816X_CLASS 0x81600034
428#define TI8168_REV_ES1_0 TI816X_CLASS
429#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
430
431#define TI814X_CLASS 0x81400034
432#define TI8148_REV_ES1_0 TI814X_CLASS
433#define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
434#define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
435
436#define AM335X_CLASS 0x33500034
437#define AM335X_REV_ES1_0 AM335X_CLASS
438
439#define OMAP443X_CLASS 0x44300044
440#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
441#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
442#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
443#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
444#define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
445
446#define OMAP446X_CLASS 0x44600044
447#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
448
449#define OMAP447X_CLASS 0x44700044
450#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
451
452void omap2xxx_check_revision(void);
453void omap3xxx_check_revision(void);
454void omap4xxx_check_revision(void);
455void omap3xxx_check_features(void);
456void ti81xx_check_features(void);
457void omap4xxx_check_features(void);
458
459
460
461
462
463
464
465
466
467
468
469extern u32 omap_features;
470
471#define OMAP3_HAS_L2CACHE BIT(0)
472#define OMAP3_HAS_IVA BIT(1)
473#define OMAP3_HAS_SGX BIT(2)
474#define OMAP3_HAS_NEON BIT(3)
475#define OMAP3_HAS_ISP BIT(4)
476#define OMAP3_HAS_192MHZ_CLK BIT(5)
477#define OMAP3_HAS_IO_WAKEUP BIT(6)
478#define OMAP3_HAS_SDRC BIT(7)
479#define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
480#define OMAP4_HAS_MPU_1GHZ BIT(9)
481#define OMAP4_HAS_MPU_1_2GHZ BIT(10)
482#define OMAP4_HAS_MPU_1_5GHZ BIT(11)
483
484
485#define OMAP3_HAS_FEATURE(feat,flag) \
486static inline unsigned int omap3_has_ ##feat(void) \
487{ \
488 return omap_features & OMAP3_HAS_ ##flag; \
489} \
490
491OMAP3_HAS_FEATURE(l2cache, L2CACHE)
492OMAP3_HAS_FEATURE(sgx, SGX)
493OMAP3_HAS_FEATURE(iva, IVA)
494OMAP3_HAS_FEATURE(neon, NEON)
495OMAP3_HAS_FEATURE(isp, ISP)
496OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
497OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
498OMAP3_HAS_FEATURE(sdrc, SDRC)
499OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
500
501
502
503
504#define OMAP4_HAS_FEATURE(feat, flag) \
505static inline unsigned int omap4_has_ ##feat(void) \
506{ \
507 return omap_features & OMAP4_HAS_ ##flag; \
508} \
509
510OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
511OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
512OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
513
514#endif
515