]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/arm/mach-omap2/soc.h
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 * Test if multicore OMAP support is needed
47 #ifdef CONFIG_ARCH_MULTIPLATFORM
50 #ifdef CONFIG_SOC_OMAP2420
55 # define OMAP_NAME omap2420
58 #ifdef CONFIG_SOC_OMAP2430
63 # define OMAP_NAME omap2430
66 #ifdef CONFIG_ARCH_OMAP3
71 # define OMAP_NAME omap3
74 #ifdef CONFIG_ARCH_OMAP4
79 # define OMAP_NAME omap4
83 #ifdef CONFIG_SOC_OMAP5
88 # define OMAP_NAME omap5
92 #ifdef CONFIG_SOC_AM33XX
97 # define OMAP_NAME am33xx
101 #ifdef CONFIG_SOC_AM43XX
106 # define OMAP_NAME am43xx
110 #ifdef CONFIG_SOC_DRA7XX
115 # define OMAP_NAME DRA7XX
120 * Omap device type i.e. EMU/HS/TST/GP/BAD
122 #define OMAP2_DEVICE_TYPE_TEST 0
123 #define OMAP2_DEVICE_TYPE_EMU 1
124 #define OMAP2_DEVICE_TYPE_SEC 2
125 #define OMAP2_DEVICE_TYPE_GP 3
126 #define OMAP2_DEVICE_TYPE_BAD 4
132 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
133 * CPU revision (See _REV_ defined in cpu.h) [15:08]
134 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
136 unsigned int omap_rev(void);
138 static inline int soc_is_omap(void)
140 return omap_rev() != 0;
144 * Get the CPU revision for OMAP devices
146 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
149 * Macros to group OMAP into cpu classes.
150 * These can be used in most places.
151 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
152 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
153 * cpu_is_omap243x(): True for OMAP2430
154 * cpu_is_omap343x(): True for OMAP3430
155 * cpu_is_omap443x(): True for OMAP4430
156 * cpu_is_omap446x(): True for OMAP4460
157 * cpu_is_omap447x(): True for OMAP4470
158 * soc_is_omap543x(): True for OMAP5430, OMAP5432
160 #define GET_OMAP_CLASS (omap_rev() & 0xff)
162 #define IS_OMAP_CLASS(class, id) \
163 static inline int is_omap ##class (void) \
165 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
168 #define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
170 #define IS_AM_CLASS(class, id) \
171 static inline int is_am ##class (void) \
173 return (GET_AM_CLASS == (id)) ? 1 : 0; \
176 #define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
178 #define IS_TI_CLASS(class, id) \
179 static inline int is_ti ##class (void) \
181 return (GET_TI_CLASS == (id)) ? 1 : 0; \
184 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
186 #define IS_OMAP_SUBCLASS(subclass, id) \
187 static inline int is_omap ##subclass (void) \
189 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
192 #define IS_TI_SUBCLASS(subclass, id) \
193 static inline int is_ti ##subclass (void) \
195 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
198 #define IS_AM_SUBCLASS(subclass, id) \
199 static inline int is_am ##subclass (void) \
201 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
204 IS_OMAP_CLASS(24xx
, 0x24)
205 IS_OMAP_CLASS(34xx
, 0x34)
206 IS_OMAP_CLASS(44xx
, 0x44)
207 IS_AM_CLASS(35xx
, 0x35)
208 IS_OMAP_CLASS(54xx
, 0x54)
209 IS_AM_CLASS(33xx
, 0x33)
210 IS_AM_CLASS(43xx
, 0x43)
212 IS_TI_CLASS(81xx
, 0x81)
214 IS_OMAP_SUBCLASS(242x
, 0x242)
215 IS_OMAP_SUBCLASS(243x
, 0x243)
216 IS_OMAP_SUBCLASS(343x
, 0x343)
217 IS_OMAP_SUBCLASS(363x
, 0x363)
218 IS_OMAP_SUBCLASS(443x
, 0x443)
219 IS_OMAP_SUBCLASS(446x
, 0x446)
220 IS_OMAP_SUBCLASS(447x
, 0x447)
221 IS_OMAP_SUBCLASS(543x
, 0x543)
223 IS_TI_SUBCLASS(816x
, 0x816)
224 IS_TI_SUBCLASS(814x
, 0x814)
225 IS_AM_SUBCLASS(335x
, 0x335)
226 IS_AM_SUBCLASS(437x
, 0x437)
228 #define cpu_is_omap24xx() 0
229 #define cpu_is_omap242x() 0
230 #define cpu_is_omap243x() 0
231 #define cpu_is_omap34xx() 0
232 #define cpu_is_omap343x() 0
233 #define cpu_is_ti81xx() 0
234 #define cpu_is_ti816x() 0
235 #define cpu_is_ti814x() 0
236 #define soc_is_am35xx() 0
237 #define soc_is_am33xx() 0
238 #define soc_is_am335x() 0
239 #define soc_is_am43xx() 0
240 #define soc_is_am437x() 0
241 #define cpu_is_omap44xx() 0
242 #define cpu_is_omap443x() 0
243 #define cpu_is_omap446x() 0
244 #define cpu_is_omap447x() 0
245 #define soc_is_omap54xx() 0
246 #define soc_is_omap543x() 0
247 #define soc_is_dra7xx() 0
249 #if defined(MULTI_OMAP2)
250 # if defined(CONFIG_ARCH_OMAP2)
251 # undef cpu_is_omap24xx
252 # define cpu_is_omap24xx() is_omap24xx()
254 # if defined (CONFIG_SOC_OMAP2420)
255 # undef cpu_is_omap242x
256 # define cpu_is_omap242x() is_omap242x()
258 # if defined (CONFIG_SOC_OMAP2430)
259 # undef cpu_is_omap243x
260 # define cpu_is_omap243x() is_omap243x()
262 # if defined(CONFIG_ARCH_OMAP3)
263 # undef cpu_is_omap34xx
264 # undef cpu_is_omap343x
265 # define cpu_is_omap34xx() is_omap34xx()
266 # define cpu_is_omap343x() is_omap343x()
269 # if defined(CONFIG_ARCH_OMAP2)
270 # undef cpu_is_omap24xx
271 # define cpu_is_omap24xx() 1
273 # if defined(CONFIG_SOC_OMAP2420)
274 # undef cpu_is_omap242x
275 # define cpu_is_omap242x() 1
277 # if defined(CONFIG_SOC_OMAP2430)
278 # undef cpu_is_omap243x
279 # define cpu_is_omap243x() 1
281 # if defined(CONFIG_ARCH_OMAP3)
282 # undef cpu_is_omap34xx
283 # define cpu_is_omap34xx() 1
285 # if defined(CONFIG_SOC_OMAP3430)
286 # undef cpu_is_omap343x
287 # define cpu_is_omap343x() 1
292 * Macros to detect individual cpu types.
293 * These are only rarely needed.
294 * cpu_is_omap2420(): True for OMAP2420
295 * cpu_is_omap2422(): True for OMAP2422
296 * cpu_is_omap2423(): True for OMAP2423
297 * cpu_is_omap2430(): True for OMAP2430
298 * cpu_is_omap3430(): True for OMAP3430
300 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
302 #define IS_OMAP_TYPE(type, id) \
303 static inline int is_omap ##type (void) \
305 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
308 IS_OMAP_TYPE(2420, 0x2420)
309 IS_OMAP_TYPE(2422, 0x2422)
310 IS_OMAP_TYPE(2423, 0x2423)
311 IS_OMAP_TYPE(2430, 0x2430)
312 IS_OMAP_TYPE(3430, 0x3430)
314 #define cpu_is_omap2420() 0
315 #define cpu_is_omap2422() 0
316 #define cpu_is_omap2423() 0
317 #define cpu_is_omap2430() 0
318 #define cpu_is_omap3430() 0
319 #define cpu_is_omap3630() 0
320 #define soc_is_omap5430() 0
322 /* These are needed for the common code */
323 #ifdef CONFIG_ARCH_OMAP2PLUS
324 #define cpu_is_omap7xx() 0
325 #define cpu_is_omap15xx() 0
326 #define cpu_is_omap16xx() 0
327 #define cpu_is_omap1510() 0
328 #define cpu_is_omap1610() 0
329 #define cpu_is_omap1611() 0
330 #define cpu_is_omap1621() 0
331 #define cpu_is_omap1710() 0
332 #define cpu_class_is_omap1() 0
333 #define cpu_class_is_omap2() 1
336 #if defined(CONFIG_ARCH_OMAP2)
337 # undef cpu_is_omap2420
338 # undef cpu_is_omap2422
339 # undef cpu_is_omap2423
340 # undef cpu_is_omap2430
341 # define cpu_is_omap2420() is_omap2420()
342 # define cpu_is_omap2422() is_omap2422()
343 # define cpu_is_omap2423() is_omap2423()
344 # define cpu_is_omap2430() is_omap2430()
347 #if defined(CONFIG_ARCH_OMAP3)
348 # undef cpu_is_omap3430
349 # undef cpu_is_ti81xx
350 # undef cpu_is_ti816x
351 # undef cpu_is_ti814x
352 # undef soc_is_am35xx
353 # define cpu_is_omap3430() is_omap3430()
354 # undef cpu_is_omap3630
355 # define cpu_is_omap3630() is_omap363x()
356 # define cpu_is_ti81xx() is_ti81xx()
357 # define cpu_is_ti816x() is_ti816x()
358 # define cpu_is_ti814x() is_ti814x()
359 # define soc_is_am35xx() is_am35xx()
362 # if defined(CONFIG_SOC_AM33XX)
363 # undef soc_is_am33xx
364 # undef soc_is_am335x
365 # define soc_is_am33xx() is_am33xx()
366 # define soc_is_am335x() is_am335x()
369 #ifdef CONFIG_SOC_AM43XX
370 # undef soc_is_am43xx
371 # undef soc_is_am437x
372 # define soc_is_am43xx() is_am43xx()
373 # define soc_is_am437x() is_am437x()
376 # if defined(CONFIG_ARCH_OMAP4)
377 # undef cpu_is_omap44xx
378 # undef cpu_is_omap443x
379 # undef cpu_is_omap446x
380 # undef cpu_is_omap447x
381 # define cpu_is_omap44xx() is_omap44xx()
382 # define cpu_is_omap443x() is_omap443x()
383 # define cpu_is_omap446x() is_omap446x()
384 # define cpu_is_omap447x() is_omap447x()
387 # if defined(CONFIG_SOC_OMAP5)
388 # undef soc_is_omap54xx
389 # undef soc_is_omap543x
390 # define soc_is_omap54xx() is_omap54xx()
391 # define soc_is_omap543x() is_omap543x()
394 #if defined(CONFIG_SOC_DRA7XX)
396 #define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7"))
399 /* Various silicon revisions for omap2 */
400 #define OMAP242X_CLASS 0x24200024
401 #define OMAP2420_REV_ES1_0 OMAP242X_CLASS
402 #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
404 #define OMAP243X_CLASS 0x24300024
405 #define OMAP2430_REV_ES1_0 OMAP243X_CLASS
407 #define OMAP343X_CLASS 0x34300034
408 #define OMAP3430_REV_ES1_0 OMAP343X_CLASS
409 #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
410 #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
411 #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
412 #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
413 #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
415 #define OMAP363X_CLASS 0x36300034
416 #define OMAP3630_REV_ES1_0 OMAP363X_CLASS
417 #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
418 #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
420 #define TI816X_CLASS 0x81600034
421 #define TI8168_REV_ES1_0 TI816X_CLASS
422 #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
423 #define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8))
424 #define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8))
426 #define TI814X_CLASS 0x81400034
427 #define TI8148_REV_ES1_0 TI814X_CLASS
428 #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
429 #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
431 #define AM35XX_CLASS 0x35170034
432 #define AM35XX_REV_ES1_0 AM35XX_CLASS
433 #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
435 #define AM335X_CLASS 0x33500033
436 #define AM335X_REV_ES1_0 AM335X_CLASS
437 #define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8))
438 #define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8))
440 #define AM437X_CLASS 0x43700000
441 #define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8))
442 #define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8))
444 #define OMAP443X_CLASS 0x44300044
445 #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
446 #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
447 #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
448 #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
449 #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
451 #define OMAP446X_CLASS 0x44600044
452 #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
453 #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
455 #define OMAP447X_CLASS 0x44700044
456 #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
458 #define OMAP54XX_CLASS 0x54000054
459 #define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8))
460 #define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8))
462 #define DRA7XX_CLASS 0x07000000
463 #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8))
464 #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8))
465 #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8))
467 void omap2xxx_check_revision(void);
468 void omap3xxx_check_revision(void);
469 void omap4xxx_check_revision(void);
470 void omap5xxx_check_revision(void);
471 void dra7xxx_check_revision(void);
472 void omap3xxx_check_features(void);
473 void ti81xx_check_features(void);
474 void am33xx_check_features(void);
475 void omap4xxx_check_features(void);
478 * Runtime detection of OMAP3 features
480 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
481 * family have OS-level control over the I/O chain clock. This is
482 * to avoid a window during which wakeups could potentially be lost
483 * during powerdomain transitions. If this bit is set, it
484 * indicates that the chip does support OS-level control of this
487 extern u32 omap_features
;
489 #define OMAP3_HAS_L2CACHE BIT(0)
490 #define OMAP3_HAS_IVA BIT(1)
491 #define OMAP3_HAS_SGX BIT(2)
492 #define OMAP3_HAS_NEON BIT(3)
493 #define OMAP3_HAS_ISP BIT(4)
494 #define OMAP3_HAS_192MHZ_CLK BIT(5)
495 #define OMAP3_HAS_IO_WAKEUP BIT(6)
496 #define OMAP3_HAS_SDRC BIT(7)
497 #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
498 #define OMAP4_HAS_PERF_SILICON BIT(9)
501 #define OMAP3_HAS_FEATURE(feat,flag) \
502 static inline unsigned int omap3_has_ ##feat(void) \
504 return omap_features & OMAP3_HAS_ ##flag; \
507 OMAP3_HAS_FEATURE(l2cache, L2CACHE)
508 OMAP3_HAS_FEATURE(sgx
, SGX
)
509 OMAP3_HAS_FEATURE(iva
, IVA
)
510 OMAP3_HAS_FEATURE(neon
, NEON
)
511 OMAP3_HAS_FEATURE(isp
, ISP
)
512 OMAP3_HAS_FEATURE(192mhz_clk
, 192MHZ_CLK
)
513 OMAP3_HAS_FEATURE(io_wakeup
, IO_WAKEUP
)
514 OMAP3_HAS_FEATURE(sdrc
, SDRC
)
515 OMAP3_HAS_FEATURE(io_chain_ctrl
, IO_CHAIN_CTRL
)
518 * Runtime detection of OMAP4 features
520 #define OMAP4_HAS_FEATURE(feat, flag) \
521 static inline unsigned int omap4_has_ ##feat(void) \
523 return omap_features & OMAP4_HAS_ ##flag; \
526 OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON)
529 * We need to make sure omap initcalls don't run when
530 * multiplatform kernels are booted on other SoCs.
532 #define omap_initcall(level, fn) \
533 static int __init __used __##fn(void) \
535 if (!soc_is_omap()) \
541 #define omap_early_initcall(fn) omap_initcall(early_initcall, fn)
542 #define omap_core_initcall(fn) omap_initcall(core_initcall, fn)
543 #define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn)
544 #define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn)
545 #define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn)
546 #define omap_device_initcall(fn) omap_initcall(device_initcall, fn)
547 #define omap_late_initcall(fn) omap_initcall(late_initcall, fn)
548 #define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn)
550 #endif /* __ASSEMBLY__ */