2 * arch/arm/plat-omap/include/mach/cpu.h
4 * OMAP cpu type detection
6 * Copyright (C) 2004, 2008 Nokia Corporation
8 * Copyright (C) 2009-11 Texas Instruments.
10 * Written by Tony Lindgren <tony.lindgren@nokia.com>
12 * Added OMAP4 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #ifndef __ASM_ARCH_OMAP_CPU_H
31 #define __ASM_ARCH_OMAP_CPU_H
33 #include <linux/bitops.h>
34 #include <plat/multi.h>
37 * Omap device type i.e. EMU/HS/TST/GP/BAD
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
49 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
50 * CPU revision (See _REV_ defined in cpu.h) [15:08]
51 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
53 unsigned int omap_rev(void);
56 * Get the CPU revision for OMAP devices
58 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
61 * Macros to group OMAP into cpu classes.
62 * These can be used in most places.
63 * cpu_is_omap7xx(): True for OMAP730, OMAP850
64 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
65 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
66 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
67 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
68 * cpu_is_omap243x(): True for OMAP2430
69 * cpu_is_omap343x(): True for OMAP3430
70 * cpu_is_omap443x(): True for OMAP4430
71 * cpu_is_omap446x(): True for OMAP4460
73 #define GET_OMAP_CLASS (omap_rev() & 0xff)
75 #define IS_OMAP_CLASS(class, id) \
76 static inline int is_omap ##class (void) \
78 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
81 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
83 #define IS_OMAP_SUBCLASS(subclass, id) \
84 static inline int is_omap ##subclass (void) \
86 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
89 #define IS_TI_SUBCLASS(subclass, id) \
90 static inline int is_ti ##subclass (void) \
92 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
95 IS_OMAP_CLASS(7xx
, 0x07)
96 IS_OMAP_CLASS(15xx
, 0x15)
97 IS_OMAP_CLASS(16xx
, 0x16)
98 IS_OMAP_CLASS(24xx
, 0x24)
99 IS_OMAP_CLASS(34xx
, 0x34)
100 IS_OMAP_CLASS(44xx
, 0x44)
102 IS_OMAP_SUBCLASS(242x
, 0x242)
103 IS_OMAP_SUBCLASS(243x
, 0x243)
104 IS_OMAP_SUBCLASS(343x
, 0x343)
105 IS_OMAP_SUBCLASS(363x
, 0x363)
106 IS_OMAP_SUBCLASS(443x
, 0x443)
107 IS_OMAP_SUBCLASS(446x
, 0x446)
109 IS_TI_SUBCLASS(816x
, 0x816)
111 #define cpu_is_omap7xx() 0
112 #define cpu_is_omap15xx() 0
113 #define cpu_is_omap16xx() 0
114 #define cpu_is_omap24xx() 0
115 #define cpu_is_omap242x() 0
116 #define cpu_is_omap243x() 0
117 #define cpu_is_omap34xx() 0
118 #define cpu_is_omap343x() 0
119 #define cpu_is_ti816x() 0
120 #define cpu_is_omap44xx() 0
121 #define cpu_is_omap443x() 0
122 #define cpu_is_omap446x() 0
124 #if defined(MULTI_OMAP1)
125 # if defined(CONFIG_ARCH_OMAP730)
126 # undef cpu_is_omap7xx
127 # define cpu_is_omap7xx() is_omap7xx()
129 # if defined(CONFIG_ARCH_OMAP850)
130 # undef cpu_is_omap7xx
131 # define cpu_is_omap7xx() is_omap7xx()
133 # if defined(CONFIG_ARCH_OMAP15XX)
134 # undef cpu_is_omap15xx
135 # define cpu_is_omap15xx() is_omap15xx()
137 # if defined(CONFIG_ARCH_OMAP16XX)
138 # undef cpu_is_omap16xx
139 # define cpu_is_omap16xx() is_omap16xx()
142 # if defined(CONFIG_ARCH_OMAP730)
143 # undef cpu_is_omap7xx
144 # define cpu_is_omap7xx() 1
146 # if defined(CONFIG_ARCH_OMAP850)
147 # undef cpu_is_omap7xx
148 # define cpu_is_omap7xx() 1
150 # if defined(CONFIG_ARCH_OMAP15XX)
151 # undef cpu_is_omap15xx
152 # define cpu_is_omap15xx() 1
154 # if defined(CONFIG_ARCH_OMAP16XX)
155 # undef cpu_is_omap16xx
156 # define cpu_is_omap16xx() 1
160 #if defined(MULTI_OMAP2)
161 # if defined(CONFIG_ARCH_OMAP2)
162 # undef cpu_is_omap24xx
163 # define cpu_is_omap24xx() is_omap24xx()
165 # if defined (CONFIG_SOC_OMAP2420)
166 # undef cpu_is_omap242x
167 # define cpu_is_omap242x() is_omap242x()
169 # if defined (CONFIG_SOC_OMAP2430)
170 # undef cpu_is_omap243x
171 # define cpu_is_omap243x() is_omap243x()
173 # if defined(CONFIG_ARCH_OMAP3)
174 # undef cpu_is_omap34xx
175 # undef cpu_is_omap343x
176 # define cpu_is_omap34xx() is_omap34xx()
177 # define cpu_is_omap343x() is_omap343x()
180 # if defined(CONFIG_ARCH_OMAP2)
181 # undef cpu_is_omap24xx
182 # define cpu_is_omap24xx() 1
184 # if defined(CONFIG_SOC_OMAP2420)
185 # undef cpu_is_omap242x
186 # define cpu_is_omap242x() 1
188 # if defined(CONFIG_SOC_OMAP2430)
189 # undef cpu_is_omap243x
190 # define cpu_is_omap243x() 1
192 # if defined(CONFIG_ARCH_OMAP3)
193 # undef cpu_is_omap34xx
194 # define cpu_is_omap34xx() 1
196 # if defined(CONFIG_SOC_OMAP3430)
197 # undef cpu_is_omap343x
198 # define cpu_is_omap343x() 1
203 * Macros to detect individual cpu types.
204 * These are only rarely needed.
205 * cpu_is_omap330(): True for OMAP330
206 * cpu_is_omap730(): True for OMAP730
207 * cpu_is_omap850(): True for OMAP850
208 * cpu_is_omap1510(): True for OMAP1510
209 * cpu_is_omap1610(): True for OMAP1610
210 * cpu_is_omap1611(): True for OMAP1611
211 * cpu_is_omap5912(): True for OMAP5912
212 * cpu_is_omap1621(): True for OMAP1621
213 * cpu_is_omap1710(): True for OMAP1710
214 * cpu_is_omap2420(): True for OMAP2420
215 * cpu_is_omap2422(): True for OMAP2422
216 * cpu_is_omap2423(): True for OMAP2423
217 * cpu_is_omap2430(): True for OMAP2430
218 * cpu_is_omap3430(): True for OMAP3430
219 * cpu_is_omap4430(): True for OMAP4430
220 * cpu_is_omap3505(): True for OMAP3505
221 * cpu_is_omap3517(): True for OMAP3517
223 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
225 #define IS_OMAP_TYPE(type, id) \
226 static inline int is_omap ##type (void) \
228 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
231 IS_OMAP_TYPE(310, 0x0310)
232 IS_OMAP_TYPE(730, 0x0730)
233 IS_OMAP_TYPE(850, 0x0850)
234 IS_OMAP_TYPE(1510, 0x1510)
235 IS_OMAP_TYPE(1610, 0x1610)
236 IS_OMAP_TYPE(1611, 0x1611)
237 IS_OMAP_TYPE(5912, 0x1611)
238 IS_OMAP_TYPE(1621, 0x1621)
239 IS_OMAP_TYPE(1710, 0x1710)
240 IS_OMAP_TYPE(2420, 0x2420)
241 IS_OMAP_TYPE(2422, 0x2422)
242 IS_OMAP_TYPE(2423, 0x2423)
243 IS_OMAP_TYPE(2430, 0x2430)
244 IS_OMAP_TYPE(3430, 0x3430)
245 IS_OMAP_TYPE(3505, 0x3517)
246 IS_OMAP_TYPE(3517, 0x3517)
248 #define cpu_is_omap310() 0
249 #define cpu_is_omap730() 0
250 #define cpu_is_omap850() 0
251 #define cpu_is_omap1510() 0
252 #define cpu_is_omap1610() 0
253 #define cpu_is_omap5912() 0
254 #define cpu_is_omap1611() 0
255 #define cpu_is_omap1621() 0
256 #define cpu_is_omap1710() 0
257 #define cpu_is_omap2420() 0
258 #define cpu_is_omap2422() 0
259 #define cpu_is_omap2423() 0
260 #define cpu_is_omap2430() 0
261 #define cpu_is_omap3503() 0
262 #define cpu_is_omap3515() 0
263 #define cpu_is_omap3525() 0
264 #define cpu_is_omap3530() 0
265 #define cpu_is_omap3505() 0
266 #define cpu_is_omap3517() 0
267 #define cpu_is_omap3430() 0
268 #define cpu_is_omap4430() 0
269 #define cpu_is_omap3630() 0
272 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
273 * between 730 vs 850, 330 vs. 1510 and 1611B/5912 vs. 1710.
276 #if defined(CONFIG_ARCH_OMAP730)
277 # undef cpu_is_omap730
278 # define cpu_is_omap730() is_omap730()
281 #if defined(CONFIG_ARCH_OMAP850)
282 # undef cpu_is_omap850
283 # define cpu_is_omap850() is_omap850()
286 #if defined(CONFIG_ARCH_OMAP15XX)
287 # undef cpu_is_omap310
288 # undef cpu_is_omap1510
289 # define cpu_is_omap310() is_omap310()
290 # define cpu_is_omap1510() is_omap1510()
293 #if defined(CONFIG_ARCH_OMAP16XX)
294 # undef cpu_is_omap1610
295 # undef cpu_is_omap1611
296 # undef cpu_is_omap5912
297 # undef cpu_is_omap1621
298 # undef cpu_is_omap1710
299 # define cpu_is_omap1610() is_omap1610()
300 # define cpu_is_omap1611() is_omap1611()
301 # define cpu_is_omap5912() is_omap5912()
302 # define cpu_is_omap1621() is_omap1621()
303 # define cpu_is_omap1710() is_omap1710()
306 #if defined(CONFIG_ARCH_OMAP2)
307 # undef cpu_is_omap2420
308 # undef cpu_is_omap2422
309 # undef cpu_is_omap2423
310 # undef cpu_is_omap2430
311 # define cpu_is_omap2420() is_omap2420()
312 # define cpu_is_omap2422() is_omap2422()
313 # define cpu_is_omap2423() is_omap2423()
314 # define cpu_is_omap2430() is_omap2430()
317 #if defined(CONFIG_ARCH_OMAP3)
318 # undef cpu_is_omap3430
319 # undef cpu_is_omap3503
320 # undef cpu_is_omap3515
321 # undef cpu_is_omap3525
322 # undef cpu_is_omap3530
323 # undef cpu_is_omap3505
324 # undef cpu_is_omap3517
325 # undef cpu_is_ti816x
326 # define cpu_is_omap3430() is_omap3430()
327 # define cpu_is_omap3503() (cpu_is_omap3430() && \
328 (!omap3_has_iva()) && \
330 # define cpu_is_omap3515() (cpu_is_omap3430() && \
331 (!omap3_has_iva()) && \
333 # define cpu_is_omap3525() (cpu_is_omap3430() && \
334 (!omap3_has_sgx()) && \
336 # define cpu_is_omap3530() (cpu_is_omap3430())
337 # define cpu_is_omap3517() is_omap3517()
338 # define cpu_is_omap3505() (cpu_is_omap3517() && \
340 # undef cpu_is_omap3630
341 # define cpu_is_omap3630() is_omap363x()
342 # define cpu_is_ti816x() is_ti816x()
345 # if defined(CONFIG_ARCH_OMAP4)
346 # undef cpu_is_omap44xx
347 # undef cpu_is_omap443x
348 # undef cpu_is_omap446x
349 # define cpu_is_omap44xx() is_omap44xx()
350 # define cpu_is_omap443x() is_omap443x()
351 # define cpu_is_omap446x() is_omap446x()
354 /* Macros to detect if we have OMAP1 or OMAP2 */
355 #define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
357 #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
360 /* Various silicon revisions for omap2 */
361 #define OMAP242X_CLASS 0x24200024
362 #define OMAP2420_REV_ES1_0 OMAP242X_CLASS
363 #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
365 #define OMAP243X_CLASS 0x24300024
366 #define OMAP2430_REV_ES1_0 OMAP243X_CLASS
368 #define OMAP343X_CLASS 0x34300034
369 #define OMAP3430_REV_ES1_0 OMAP343X_CLASS
370 #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
371 #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
372 #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
373 #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
374 #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
376 #define OMAP363X_CLASS 0x36300034
377 #define OMAP3630_REV_ES1_0 OMAP363X_CLASS
378 #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
379 #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
381 #define OMAP3517_CLASS 0x35170034
382 #define OMAP3517_REV_ES1_0 OMAP3517_CLASS
383 #define OMAP3517_REV_ES1_1 (OMAP3517_CLASS | (0x1 << 8))
385 #define TI816X_CLASS 0x81600034
386 #define TI8168_REV_ES1_0 TI816X_CLASS
387 #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
389 #define OMAP443X_CLASS 0x44300044
390 #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
391 #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
392 #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
393 #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
395 #define OMAP446X_CLASS 0x44600044
396 #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
398 void omap2_check_revision(void);
401 * Runtime detection of OMAP3 features
403 extern u32 omap_features
;
405 #define OMAP3_HAS_L2CACHE BIT(0)
406 #define OMAP3_HAS_IVA BIT(1)
407 #define OMAP3_HAS_SGX BIT(2)
408 #define OMAP3_HAS_NEON BIT(3)
409 #define OMAP3_HAS_ISP BIT(4)
410 #define OMAP3_HAS_192MHZ_CLK BIT(5)
411 #define OMAP3_HAS_IO_WAKEUP BIT(6)
412 #define OMAP3_HAS_SDRC BIT(7)
413 #define OMAP4_HAS_MPU_1GHZ BIT(8)
414 #define OMAP4_HAS_MPU_1_2GHZ BIT(9)
415 #define OMAP4_HAS_MPU_1_5GHZ BIT(10)
418 #define OMAP3_HAS_FEATURE(feat,flag) \
419 static inline unsigned int omap3_has_ ##feat(void) \
421 return omap_features & OMAP3_HAS_ ##flag; \
424 OMAP3_HAS_FEATURE(l2cache, L2CACHE)
425 OMAP3_HAS_FEATURE(sgx
, SGX
)
426 OMAP3_HAS_FEATURE(iva
, IVA
)
427 OMAP3_HAS_FEATURE(neon
, NEON
)
428 OMAP3_HAS_FEATURE(isp
, ISP
)
429 OMAP3_HAS_FEATURE(192mhz_clk
, 192MHZ_CLK
)
430 OMAP3_HAS_FEATURE(io_wakeup
, IO_WAKEUP
)
431 OMAP3_HAS_FEATURE(sdrc
, SDRC
)
434 * Runtime detection of OMAP4 features
436 extern u32 omap_features
;
438 #define OMAP4_HAS_FEATURE(feat, flag) \
439 static inline unsigned int omap4_has_ ##feat(void) \
441 return omap_features & OMAP4_HAS_ ##flag; \
444 OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
445 OMAP4_HAS_FEATURE(mpu_1_2ghz
, MPU_1_2GHZ
)
446 OMAP4_HAS_FEATURE(mpu_1_5ghz
, MPU_1_5GHZ
)