2 * OMAP cpu type detection
4 * Copyright (C) 2004, 2008 Nokia Corporation
6 * Copyright (C) 2009-11 Texas Instruments.
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
10 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
11 * Added DRA7xxx specific defines - Sricharan R<r.sricharan@ti.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 #include <linux/bitops.h>
42 * OMAP2+ is always defined as ARCH_MULTIPLATFORM in Kconfig
48 * Omap device type i.e. EMU/HS/TST/GP/BAD
50 #define OMAP2_DEVICE_TYPE_TEST 0
51 #define OMAP2_DEVICE_TYPE_EMU 1
52 #define OMAP2_DEVICE_TYPE_SEC 2
53 #define OMAP2_DEVICE_TYPE_GP 3
54 #define OMAP2_DEVICE_TYPE_BAD 4
60 * SoC id bits (0730, 1510, 1710, 2422...) [31:16]
61 * SoC revision (See _REV_ defined in cpu.h) [15:08]
62 * SoC class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
64 unsigned int omap_rev(void);
66 static inline int soc_is_omap(void)
68 return omap_rev() != 0;
72 * Get the SoC revision for OMAP devices
74 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
77 * Macros to group OMAP into cpu classes.
78 * These can be used in most places.
79 * soc_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
80 * soc_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
81 * soc_is_omap243x(): True for OMAP2430
82 * soc_is_omap343x(): True for OMAP3430
83 * soc_is_omap443x(): True for OMAP4430
84 * soc_is_omap446x(): True for OMAP4460
85 * soc_is_omap447x(): True for OMAP4470
86 * soc_is_omap543x(): True for OMAP5430, OMAP5432
88 #define GET_OMAP_CLASS (omap_rev() & 0xff)
90 #define IS_OMAP_CLASS(class, id) \
91 static inline int is_omap ##class (void) \
93 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
96 #define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
98 #define IS_AM_CLASS(class, id) \
99 static inline int is_am ##class (void) \
101 return (GET_AM_CLASS == (id)) ? 1 : 0; \
104 #define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
106 #define IS_TI_CLASS(class, id) \
107 static inline int is_ti ##class (void) \
109 return (GET_TI_CLASS == (id)) ? 1 : 0; \
112 #define GET_DRA_CLASS ((omap_rev() >> 24) & 0xff)
114 #define IS_DRA_CLASS(class, id) \
115 static inline int is_dra ##class (void) \
117 return (GET_DRA_CLASS == (id)) ? 1 : 0; \
120 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
122 #define IS_OMAP_SUBCLASS(subclass, id) \
123 static inline int is_omap ##subclass (void) \
125 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
128 #define IS_TI_SUBCLASS(subclass, id) \
129 static inline int is_ti ##subclass (void) \
131 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
134 #define IS_AM_SUBCLASS(subclass, id) \
135 static inline int is_am ##subclass (void) \
137 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
140 #define IS_DRA_SUBCLASS(subclass, id) \
141 static inline int is_dra ##subclass (void) \
143 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
146 IS_OMAP_CLASS(24xx
, 0x24)
147 IS_OMAP_CLASS(34xx
, 0x34)
148 IS_OMAP_CLASS(44xx
, 0x44)
149 IS_AM_CLASS(35xx
, 0x35)
150 IS_OMAP_CLASS(54xx
, 0x54)
151 IS_AM_CLASS(33xx
, 0x33)
152 IS_AM_CLASS(43xx
, 0x43)
154 IS_TI_CLASS(81xx
, 0x81)
155 IS_DRA_CLASS(7xx
, 0x7)
157 IS_OMAP_SUBCLASS(242x
, 0x242)
158 IS_OMAP_SUBCLASS(243x
, 0x243)
159 IS_OMAP_SUBCLASS(343x
, 0x343)
160 IS_OMAP_SUBCLASS(363x
, 0x363)
161 IS_OMAP_SUBCLASS(443x
, 0x443)
162 IS_OMAP_SUBCLASS(446x
, 0x446)
163 IS_OMAP_SUBCLASS(447x
, 0x447)
164 IS_OMAP_SUBCLASS(543x
, 0x543)
166 IS_TI_SUBCLASS(816x
, 0x816)
167 IS_TI_SUBCLASS(814x
, 0x814)
168 IS_AM_SUBCLASS(335x
, 0x335)
169 IS_AM_SUBCLASS(437x
, 0x437)
170 IS_DRA_SUBCLASS(76x
, 0x76)
171 IS_DRA_SUBCLASS(75x
, 0x75)
172 IS_DRA_SUBCLASS(72x
, 0x72)
174 #define soc_is_ti81xx() 0
175 #define soc_is_ti816x() 0
176 #define soc_is_ti814x() 0
177 #define soc_is_am35xx() 0
178 #define soc_is_am33xx() 0
179 #define soc_is_am335x() 0
180 #define soc_is_am43xx() 0
181 #define soc_is_am437x() 0
182 #define soc_is_omap44xx() 0
183 #define soc_is_omap443x() 0
184 #define soc_is_omap446x() 0
185 #define soc_is_omap447x() 0
186 #define soc_is_omap54xx() 0
187 #define soc_is_omap543x() 0
188 #define soc_is_dra7xx() 0
189 #define soc_is_dra76x() 0
190 #define soc_is_dra74x() 0
191 #define soc_is_dra72x() 0
193 #if defined(CONFIG_ARCH_OMAP2)
194 # define soc_is_omap24xx() is_omap24xx()
196 # define soc_is_omap24xx() 0
198 #if defined(CONFIG_SOC_OMAP2420)
199 # define soc_is_omap242x() is_omap242x()
201 # define soc_is_omap242x() 0
203 #if defined(CONFIG_SOC_OMAP2430)
204 # define soc_is_omap243x() is_omap243x()
206 # define soc_is_omap243x() 0
208 #if defined(CONFIG_ARCH_OMAP3)
209 # define soc_is_omap34xx() is_omap34xx()
210 # define soc_is_omap343x() is_omap343x()
212 # define soc_is_omap34xx() 0
213 # define soc_is_omap343x() 0
217 * Macros to detect individual cpu types.
218 * These are only rarely needed.
219 * soc_is_omap2420(): True for OMAP2420
220 * soc_is_omap2422(): True for OMAP2422
221 * soc_is_omap2423(): True for OMAP2423
222 * soc_is_omap2430(): True for OMAP2430
223 * soc_is_omap3430(): True for OMAP3430
225 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
227 #define IS_OMAP_TYPE(type, id) \
228 static inline int is_omap ##type (void) \
230 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
233 IS_OMAP_TYPE(2420, 0x2420)
234 IS_OMAP_TYPE(2422, 0x2422)
235 IS_OMAP_TYPE(2423, 0x2423)
236 IS_OMAP_TYPE(2430, 0x2430)
237 IS_OMAP_TYPE(3430, 0x3430)
239 #define soc_is_omap2420() 0
240 #define soc_is_omap2422() 0
241 #define soc_is_omap2423() 0
242 #define soc_is_omap2430() 0
243 #define soc_is_omap3430() 0
244 #define soc_is_omap3630() 0
245 #define soc_is_omap5430() 0
247 /* These are needed for the common code */
248 #define soc_is_omap7xx() 0
249 #define soc_is_omap15xx() 0
250 #define soc_is_omap16xx() 0
251 #define soc_is_omap1510() 0
252 #define soc_is_omap1610() 0
253 #define soc_is_omap1611() 0
254 #define soc_is_omap1621() 0
255 #define soc_is_omap1710() 0
256 #define cpu_class_is_omap1() 0
257 #define cpu_class_is_omap2() 1
259 #if defined(CONFIG_ARCH_OMAP2)
260 # undef soc_is_omap2420
261 # undef soc_is_omap2422
262 # undef soc_is_omap2423
263 # undef soc_is_omap2430
264 # define soc_is_omap2420() is_omap2420()
265 # define soc_is_omap2422() is_omap2422()
266 # define soc_is_omap2423() is_omap2423()
267 # define soc_is_omap2430() is_omap2430()
270 #if defined(CONFIG_ARCH_OMAP3)
271 # undef soc_is_omap3430
272 # undef soc_is_ti81xx
273 # undef soc_is_ti816x
274 # undef soc_is_ti814x
275 # undef soc_is_am35xx
276 # define soc_is_omap3430() is_omap3430()
277 # undef soc_is_omap3630
278 # define soc_is_omap3630() is_omap363x()
279 # define soc_is_ti81xx() is_ti81xx()
280 # define soc_is_ti816x() is_ti816x()
281 # define soc_is_ti814x() is_ti814x()
282 # define soc_is_am35xx() is_am35xx()
285 # if defined(CONFIG_SOC_AM33XX)
286 # undef soc_is_am33xx
287 # undef soc_is_am335x
288 # define soc_is_am33xx() is_am33xx()
289 # define soc_is_am335x() is_am335x()
292 #ifdef CONFIG_SOC_AM43XX
293 # undef soc_is_am43xx
294 # undef soc_is_am437x
295 # define soc_is_am43xx() is_am43xx()
296 # define soc_is_am437x() is_am437x()
299 # if defined(CONFIG_ARCH_OMAP4)
300 # undef soc_is_omap44xx
301 # undef soc_is_omap443x
302 # undef soc_is_omap446x
303 # undef soc_is_omap447x
304 # define soc_is_omap44xx() is_omap44xx()
305 # define soc_is_omap443x() is_omap443x()
306 # define soc_is_omap446x() is_omap446x()
307 # define soc_is_omap447x() is_omap447x()
310 # if defined(CONFIG_SOC_OMAP5)
311 # undef soc_is_omap54xx
312 # undef soc_is_omap543x
313 # define soc_is_omap54xx() is_omap54xx()
314 # define soc_is_omap543x() is_omap543x()
317 #if defined(CONFIG_SOC_DRA7XX)
322 #define soc_is_dra7xx() is_dra7xx()
323 #define soc_is_dra76x() is_dra76x()
324 #define soc_is_dra74x() is_dra75x()
325 #define soc_is_dra72x() is_dra72x()
328 /* Various silicon revisions for omap2 */
329 #define OMAP242X_CLASS 0x24200024
330 #define OMAP2420_REV_ES1_0 OMAP242X_CLASS
331 #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
333 #define OMAP243X_CLASS 0x24300024
334 #define OMAP2430_REV_ES1_0 OMAP243X_CLASS
336 #define OMAP343X_CLASS 0x34300034
337 #define OMAP3430_REV_ES1_0 OMAP343X_CLASS
338 #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
339 #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
340 #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
341 #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
342 #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
344 #define OMAP363X_CLASS 0x36300034
345 #define OMAP3630_REV_ES1_0 OMAP363X_CLASS
346 #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
347 #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
349 #define TI816X_CLASS 0x81600081
350 #define TI8168_REV_ES1_0 TI816X_CLASS
351 #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
352 #define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8))
353 #define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8))
355 #define TI814X_CLASS 0x81400081
356 #define TI8148_REV_ES1_0 TI814X_CLASS
357 #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
358 #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
360 #define AM35XX_CLASS 0x35170034
361 #define AM35XX_REV_ES1_0 AM35XX_CLASS
362 #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
364 #define AM335X_CLASS 0x33500033
365 #define AM335X_REV_ES1_0 AM335X_CLASS
366 #define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8))
367 #define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8))
369 #define AM437X_CLASS 0x43700000
370 #define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8))
371 #define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8))
372 #define AM437X_REV_ES1_2 (AM437X_CLASS | (0x12 << 8))
374 #define OMAP443X_CLASS 0x44300044
375 #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
376 #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
377 #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
378 #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
379 #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
381 #define OMAP446X_CLASS 0x44600044
382 #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
383 #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
385 #define OMAP447X_CLASS 0x44700044
386 #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
388 #define OMAP54XX_CLASS 0x54000054
389 #define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8))
390 #define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8))
392 #define DRA7XX_CLASS 0x07000000
393 #define DRA762_REV_ES1_0 (DRA7XX_CLASS | (0x62 << 16) | (0x10 << 8))
394 #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8))
395 #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8))
396 #define DRA752_REV_ES2_0 (DRA7XX_CLASS | (0x52 << 16) | (0x20 << 8))
397 #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8))
398 #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8))
399 #define DRA722_REV_ES2_0 (DRA7XX_CLASS | (0x22 << 16) | (0x20 << 8))
401 void omap2xxx_check_revision(void);
402 void omap3xxx_check_revision(void);
403 void omap4xxx_check_revision(void);
404 void omap5xxx_check_revision(void);
405 void dra7xxx_check_revision(void);
406 void omap3xxx_check_features(void);
407 void ti81xx_check_features(void);
408 void am33xx_check_features(void);
409 void omap4xxx_check_features(void);
412 * Runtime detection of OMAP3 features
414 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
415 * family have OS-level control over the I/O chain clock. This is
416 * to avoid a window during which wakeups could potentially be lost
417 * during powerdomain transitions. If this bit is set, it
418 * indicates that the chip does support OS-level control of this
421 extern u32 omap_features
;
423 #define OMAP3_HAS_L2CACHE BIT(0)
424 #define OMAP3_HAS_IVA BIT(1)
425 #define OMAP3_HAS_SGX BIT(2)
426 #define OMAP3_HAS_NEON BIT(3)
427 #define OMAP3_HAS_ISP BIT(4)
428 #define OMAP3_HAS_192MHZ_CLK BIT(5)
429 #define OMAP3_HAS_IO_WAKEUP BIT(6)
430 #define OMAP3_HAS_SDRC BIT(7)
431 #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
432 #define OMAP4_HAS_PERF_SILICON BIT(9)
435 #define OMAP3_HAS_FEATURE(feat,flag) \
436 static inline unsigned int omap3_has_ ##feat(void) \
438 return omap_features & OMAP3_HAS_ ##flag; \
441 OMAP3_HAS_FEATURE(l2cache, L2CACHE)
442 OMAP3_HAS_FEATURE(sgx
, SGX
)
443 OMAP3_HAS_FEATURE(iva
, IVA
)
444 OMAP3_HAS_FEATURE(neon
, NEON
)
445 OMAP3_HAS_FEATURE(isp
, ISP
)
446 OMAP3_HAS_FEATURE(192mhz_clk
, 192MHZ_CLK
)
447 OMAP3_HAS_FEATURE(io_wakeup
, IO_WAKEUP
)
448 OMAP3_HAS_FEATURE(sdrc
, SDRC
)
449 OMAP3_HAS_FEATURE(io_chain_ctrl
, IO_CHAIN_CTRL
)
452 * Runtime detection of OMAP4 features
454 #define OMAP4_HAS_FEATURE(feat, flag) \
455 static inline unsigned int omap4_has_ ##feat(void) \
457 return omap_features & OMAP4_HAS_ ##flag; \
460 OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON)
463 * We need to make sure omap initcalls don't run when
464 * multiplatform kernels are booted on other SoCs.
466 #define omap_initcall(level, fn) \
467 static int __init __used __##fn(void) \
469 if (!soc_is_omap()) \
475 #define omap_early_initcall(fn) omap_initcall(early_initcall, fn)
476 #define omap_core_initcall(fn) omap_initcall(core_initcall, fn)
477 #define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn)
478 #define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn)
479 #define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn)
480 #define omap_device_initcall(fn) omap_initcall(device_initcall, fn)
481 #define omap_late_initcall(fn) omap_initcall(late_initcall, fn)
482 #define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn)
484 /* Legacy defines, these can be removed when users are removed */
485 #define cpu_is_omap2420() soc_is_omap2420()
486 #define cpu_is_omap2422() soc_is_omap2422()
487 #define cpu_is_omap242x() soc_is_omap242x()
488 #define cpu_is_omap2430() soc_is_omap2430()
489 #define cpu_is_omap243x() soc_is_omap243x()
490 #define cpu_is_omap24xx() soc_is_omap24xx()
491 #define cpu_is_omap3430() soc_is_omap3430()
492 #define cpu_is_omap343x() soc_is_omap343x()
493 #define cpu_is_omap34xx() soc_is_omap34xx()
494 #define cpu_is_omap3630() soc_is_omap3630()
495 #define cpu_is_omap443x() soc_is_omap443x()
496 #define cpu_is_omap446x() soc_is_omap446x()
497 #define cpu_is_omap44xx() soc_is_omap44xx()
498 #define cpu_is_ti814x() soc_is_ti814x()
499 #define cpu_is_ti816x() soc_is_ti816x()
500 #define cpu_is_ti81xx() soc_is_ti81xx()
502 #endif /* __ASSEMBLY__ */