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>
12 * 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
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37 #include <linux/bitops.h>
40 * Test if multicore OMAP support is needed
45 #ifdef CONFIG_SOC_OMAP2420
50 # define OMAP_NAME omap2420
53 #ifdef CONFIG_SOC_OMAP2430
58 # define OMAP_NAME omap2430
61 #ifdef CONFIG_ARCH_OMAP3
66 # define OMAP_NAME omap3
69 #ifdef CONFIG_ARCH_OMAP4
74 # define OMAP_NAME omap4
78 #ifdef CONFIG_SOC_OMAP5
83 # define OMAP_NAME omap5
87 #ifdef CONFIG_SOC_AM33XX
92 # define OMAP_NAME am33xx
97 * Omap device type i.e. EMU/HS/TST/GP/BAD
99 #define OMAP2_DEVICE_TYPE_TEST 0
100 #define OMAP2_DEVICE_TYPE_EMU 1
101 #define OMAP2_DEVICE_TYPE_SEC 2
102 #define OMAP2_DEVICE_TYPE_GP 3
103 #define OMAP2_DEVICE_TYPE_BAD 4
109 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
110 * CPU revision (See _REV_ defined in cpu.h) [15:08]
111 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
113 unsigned int omap_rev(void);
116 * Get the CPU revision for OMAP devices
118 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
121 * Macros to group OMAP into cpu classes.
122 * These can be used in most places.
123 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
124 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
125 * cpu_is_omap243x(): True for OMAP2430
126 * cpu_is_omap343x(): True for OMAP3430
127 * cpu_is_omap443x(): True for OMAP4430
128 * cpu_is_omap446x(): True for OMAP4460
129 * cpu_is_omap447x(): True for OMAP4470
130 * soc_is_omap543x(): True for OMAP5430, OMAP5432
132 #define GET_OMAP_CLASS (omap_rev() & 0xff)
134 #define IS_OMAP_CLASS(class, id) \
135 static inline int is_omap ##class (void) \
137 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
140 #define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
142 #define IS_AM_CLASS(class, id) \
143 static inline int is_am ##class (void) \
145 return (GET_AM_CLASS == (id)) ? 1 : 0; \
148 #define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
150 #define IS_TI_CLASS(class, id) \
151 static inline int is_ti ##class (void) \
153 return (GET_TI_CLASS == (id)) ? 1 : 0; \
156 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
158 #define IS_OMAP_SUBCLASS(subclass, id) \
159 static inline int is_omap ##subclass (void) \
161 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
164 #define IS_TI_SUBCLASS(subclass, id) \
165 static inline int is_ti ##subclass (void) \
167 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
170 #define IS_AM_SUBCLASS(subclass, id) \
171 static inline int is_am ##subclass (void) \
173 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
176 IS_OMAP_CLASS(24xx
, 0x24)
177 IS_OMAP_CLASS(34xx
, 0x34)
178 IS_OMAP_CLASS(44xx
, 0x44)
179 IS_AM_CLASS(35xx
, 0x35)
180 IS_OMAP_CLASS(54xx
, 0x54)
181 IS_AM_CLASS(33xx
, 0x33)
183 IS_TI_CLASS(81xx
, 0x81)
185 IS_OMAP_SUBCLASS(242x
, 0x242)
186 IS_OMAP_SUBCLASS(243x
, 0x243)
187 IS_OMAP_SUBCLASS(343x
, 0x343)
188 IS_OMAP_SUBCLASS(363x
, 0x363)
189 IS_OMAP_SUBCLASS(443x
, 0x443)
190 IS_OMAP_SUBCLASS(446x
, 0x446)
191 IS_OMAP_SUBCLASS(447x
, 0x447)
192 IS_OMAP_SUBCLASS(543x
, 0x543)
194 IS_TI_SUBCLASS(816x
, 0x816)
195 IS_TI_SUBCLASS(814x
, 0x814)
196 IS_AM_SUBCLASS(335x
, 0x335)
198 #define cpu_is_omap24xx() 0
199 #define cpu_is_omap242x() 0
200 #define cpu_is_omap243x() 0
201 #define cpu_is_omap34xx() 0
202 #define cpu_is_omap343x() 0
203 #define cpu_is_ti81xx() 0
204 #define cpu_is_ti816x() 0
205 #define cpu_is_ti814x() 0
206 #define soc_is_am35xx() 0
207 #define soc_is_am33xx() 0
208 #define soc_is_am335x() 0
209 #define cpu_is_omap44xx() 0
210 #define cpu_is_omap443x() 0
211 #define cpu_is_omap446x() 0
212 #define cpu_is_omap447x() 0
213 #define soc_is_omap54xx() 0
214 #define soc_is_omap543x() 0
216 #if defined(MULTI_OMAP2)
217 # if defined(CONFIG_ARCH_OMAP2)
218 # undef cpu_is_omap24xx
219 # define cpu_is_omap24xx() is_omap24xx()
221 # if defined (CONFIG_SOC_OMAP2420)
222 # undef cpu_is_omap242x
223 # define cpu_is_omap242x() is_omap242x()
225 # if defined (CONFIG_SOC_OMAP2430)
226 # undef cpu_is_omap243x
227 # define cpu_is_omap243x() is_omap243x()
229 # if defined(CONFIG_ARCH_OMAP3)
230 # undef cpu_is_omap34xx
231 # undef cpu_is_omap343x
232 # define cpu_is_omap34xx() is_omap34xx()
233 # define cpu_is_omap343x() is_omap343x()
236 # if defined(CONFIG_ARCH_OMAP2)
237 # undef cpu_is_omap24xx
238 # define cpu_is_omap24xx() 1
240 # if defined(CONFIG_SOC_OMAP2420)
241 # undef cpu_is_omap242x
242 # define cpu_is_omap242x() 1
244 # if defined(CONFIG_SOC_OMAP2430)
245 # undef cpu_is_omap243x
246 # define cpu_is_omap243x() 1
248 # if defined(CONFIG_ARCH_OMAP3)
249 # undef cpu_is_omap34xx
250 # define cpu_is_omap34xx() 1
252 # if defined(CONFIG_SOC_OMAP3430)
253 # undef cpu_is_omap343x
254 # define cpu_is_omap343x() 1
259 * Macros to detect individual cpu types.
260 * These are only rarely needed.
261 * cpu_is_omap2420(): True for OMAP2420
262 * cpu_is_omap2422(): True for OMAP2422
263 * cpu_is_omap2423(): True for OMAP2423
264 * cpu_is_omap2430(): True for OMAP2430
265 * cpu_is_omap3430(): True for OMAP3430
267 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
269 #define IS_OMAP_TYPE(type, id) \
270 static inline int is_omap ##type (void) \
272 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
275 IS_OMAP_TYPE(2420, 0x2420)
276 IS_OMAP_TYPE(2422, 0x2422)
277 IS_OMAP_TYPE(2423, 0x2423)
278 IS_OMAP_TYPE(2430, 0x2430)
279 IS_OMAP_TYPE(3430, 0x3430)
281 #define cpu_is_omap2420() 0
282 #define cpu_is_omap2422() 0
283 #define cpu_is_omap2423() 0
284 #define cpu_is_omap2430() 0
285 #define cpu_is_omap3430() 0
286 #define cpu_is_omap3630() 0
287 #define soc_is_omap5430() 0
289 /* These are needed for the common code */
290 #ifdef CONFIG_ARCH_OMAP2PLUS
291 #define cpu_is_omap7xx() 0
292 #define cpu_is_omap15xx() 0
293 #define cpu_is_omap16xx() 0
294 #define cpu_is_omap1510() 0
295 #define cpu_is_omap1610() 0
296 #define cpu_is_omap1611() 0
297 #define cpu_is_omap1621() 0
298 #define cpu_is_omap1710() 0
299 #define cpu_class_is_omap1() 0
300 #define cpu_class_is_omap2() 1
303 #if defined(CONFIG_ARCH_OMAP2)
304 # undef cpu_is_omap2420
305 # undef cpu_is_omap2422
306 # undef cpu_is_omap2423
307 # undef cpu_is_omap2430
308 # define cpu_is_omap2420() is_omap2420()
309 # define cpu_is_omap2422() is_omap2422()
310 # define cpu_is_omap2423() is_omap2423()
311 # define cpu_is_omap2430() is_omap2430()
314 #if defined(CONFIG_ARCH_OMAP3)
315 # undef cpu_is_omap3430
316 # undef cpu_is_ti81xx
317 # undef cpu_is_ti816x
318 # undef cpu_is_ti814x
319 # undef soc_is_am35xx
320 # define cpu_is_omap3430() is_omap3430()
321 # undef cpu_is_omap3630
322 # define cpu_is_omap3630() is_omap363x()
323 # define cpu_is_ti81xx() is_ti81xx()
324 # define cpu_is_ti816x() is_ti816x()
325 # define cpu_is_ti814x() is_ti814x()
326 # define soc_is_am35xx() is_am35xx()
329 # if defined(CONFIG_SOC_AM33XX)
330 # undef soc_is_am33xx
331 # undef soc_is_am335x
332 # define soc_is_am33xx() is_am33xx()
333 # define soc_is_am335x() is_am335x()
336 # if defined(CONFIG_ARCH_OMAP4)
337 # undef cpu_is_omap44xx
338 # undef cpu_is_omap443x
339 # undef cpu_is_omap446x
340 # undef cpu_is_omap447x
341 # define cpu_is_omap44xx() is_omap44xx()
342 # define cpu_is_omap443x() is_omap443x()
343 # define cpu_is_omap446x() is_omap446x()
344 # define cpu_is_omap447x() is_omap447x()
347 # if defined(CONFIG_SOC_OMAP5)
348 # undef soc_is_omap54xx
349 # undef soc_is_omap543x
350 # define soc_is_omap54xx() is_omap54xx()
351 # define soc_is_omap543x() is_omap543x()
354 /* Various silicon revisions for omap2 */
355 #define OMAP242X_CLASS 0x24200024
356 #define OMAP2420_REV_ES1_0 OMAP242X_CLASS
357 #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
359 #define OMAP243X_CLASS 0x24300024
360 #define OMAP2430_REV_ES1_0 OMAP243X_CLASS
362 #define OMAP343X_CLASS 0x34300034
363 #define OMAP3430_REV_ES1_0 OMAP343X_CLASS
364 #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
365 #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
366 #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
367 #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
368 #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
370 #define OMAP363X_CLASS 0x36300034
371 #define OMAP3630_REV_ES1_0 OMAP363X_CLASS
372 #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
373 #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
375 #define TI816X_CLASS 0x81600034
376 #define TI8168_REV_ES1_0 TI816X_CLASS
377 #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
379 #define TI814X_CLASS 0x81400034
380 #define TI8148_REV_ES1_0 TI814X_CLASS
381 #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
382 #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
384 #define AM35XX_CLASS 0x35170034
385 #define AM35XX_REV_ES1_0 AM35XX_CLASS
386 #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
388 #define AM335X_CLASS 0x33500033
389 #define AM335X_REV_ES1_0 AM335X_CLASS
391 #define OMAP443X_CLASS 0x44300044
392 #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
393 #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
394 #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
395 #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
396 #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
398 #define OMAP446X_CLASS 0x44600044
399 #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
400 #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
402 #define OMAP447X_CLASS 0x44700044
403 #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
405 #define OMAP54XX_CLASS 0x54000054
406 #define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
407 #define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
409 void omap2xxx_check_revision(void);
410 void omap3xxx_check_revision(void);
411 void omap4xxx_check_revision(void);
412 void omap5xxx_check_revision(void);
413 void omap3xxx_check_features(void);
414 void ti81xx_check_features(void);
415 void omap4xxx_check_features(void);
418 * Runtime detection of OMAP3 features
420 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
421 * family have OS-level control over the I/O chain clock. This is
422 * to avoid a window during which wakeups could potentially be lost
423 * during powerdomain transitions. If this bit is set, it
424 * indicates that the chip does support OS-level control of this
427 extern u32 omap_features
;
429 #define OMAP3_HAS_L2CACHE BIT(0)
430 #define OMAP3_HAS_IVA BIT(1)
431 #define OMAP3_HAS_SGX BIT(2)
432 #define OMAP3_HAS_NEON BIT(3)
433 #define OMAP3_HAS_ISP BIT(4)
434 #define OMAP3_HAS_192MHZ_CLK BIT(5)
435 #define OMAP3_HAS_IO_WAKEUP BIT(6)
436 #define OMAP3_HAS_SDRC BIT(7)
437 #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
438 #define OMAP4_HAS_MPU_1GHZ BIT(9)
439 #define OMAP4_HAS_MPU_1_2GHZ BIT(10)
440 #define OMAP4_HAS_MPU_1_5GHZ BIT(11)
443 #define OMAP3_HAS_FEATURE(feat,flag) \
444 static inline unsigned int omap3_has_ ##feat(void) \
446 return omap_features & OMAP3_HAS_ ##flag; \
449 OMAP3_HAS_FEATURE(l2cache, L2CACHE)
450 OMAP3_HAS_FEATURE(sgx
, SGX
)
451 OMAP3_HAS_FEATURE(iva
, IVA
)
452 OMAP3_HAS_FEATURE(neon
, NEON
)
453 OMAP3_HAS_FEATURE(isp
, ISP
)
454 OMAP3_HAS_FEATURE(192mhz_clk
, 192MHZ_CLK
)
455 OMAP3_HAS_FEATURE(io_wakeup
, IO_WAKEUP
)
456 OMAP3_HAS_FEATURE(sdrc
, SDRC
)
457 OMAP3_HAS_FEATURE(io_chain_ctrl
, IO_CHAIN_CTRL
)
460 * Runtime detection of OMAP4 features
462 #define OMAP4_HAS_FEATURE(feat, flag) \
463 static inline unsigned int omap4_has_ ##feat(void) \
465 return omap_features & OMAP4_HAS_ ##flag; \
468 OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
469 OMAP4_HAS_FEATURE(mpu_1_2ghz
, MPU_1_2GHZ
)
470 OMAP4_HAS_FEATURE(mpu_1_5ghz
, MPU_1_5GHZ
)
472 #endif /* __ASSEMBLY__ */
This page took 0.058017 seconds and 5 git commands to generate.