blob: 2d1d3845253c33493f2a3f66edf05db136c03a65 [file] [log] [blame]
Tony Lindgrene4c060d2012-10-05 13:25:59 -07001/*
2 * OMAP cpu type detection
3 *
4 * Copyright (C) 2004, 2008 Nokia Corporation
5 *
6 * Copyright (C) 2009-11 Texas Instruments.
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
R Sricharan68522152013-02-06 20:25:40 +053011 * Added DRA7xxx specific defines - Sricharan R<r.sricharan@ti.com>
Tony Lindgrene4c060d2012-10-05 13:25:59 -070012 *
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.
17 *
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.
22 *
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
26 *
27 */
28
Tony Lindgrenc49f34b2012-08-31 16:08:07 -070029#include "omap24xx.h"
30#include "omap34xx.h"
31#include "omap44xx.h"
32#include "ti81xx.h"
33#include "am33xx.h"
34#include "omap54xx.h"
Tony Lindgrene4c060d2012-10-05 13:25:59 -070035
36#ifndef __ASSEMBLY__
37
38#include <linux/bitops.h>
R Sricharan68522152013-02-06 20:25:40 +053039#include <linux/of.h>
Tony Lindgrene4c060d2012-10-05 13:25:59 -070040
41/*
42 * Test if multicore OMAP support is needed
43 */
44#undef MULTI_OMAP2
45#undef OMAP_NAME
46
Tony Lindgren816a65e2013-01-11 11:24:18 -080047#ifdef CONFIG_ARCH_MULTIPLATFORM
48#define MULTI_OMAP2
49#endif
Tony Lindgrene4c060d2012-10-05 13:25:59 -070050#ifdef CONFIG_SOC_OMAP2420
51# ifdef OMAP_NAME
52# undef MULTI_OMAP2
53# define MULTI_OMAP2
54# else
55# define OMAP_NAME omap2420
56# endif
57#endif
58#ifdef CONFIG_SOC_OMAP2430
59# ifdef OMAP_NAME
60# undef MULTI_OMAP2
61# define MULTI_OMAP2
62# else
63# define OMAP_NAME omap2430
64# endif
65#endif
66#ifdef CONFIG_ARCH_OMAP3
67# ifdef OMAP_NAME
68# undef MULTI_OMAP2
69# define MULTI_OMAP2
70# else
71# define OMAP_NAME omap3
72# endif
73#endif
74#ifdef CONFIG_ARCH_OMAP4
75# ifdef OMAP_NAME
76# undef MULTI_OMAP2
77# define MULTI_OMAP2
78# else
79# define OMAP_NAME omap4
80# endif
81#endif
82
83#ifdef CONFIG_SOC_OMAP5
84# ifdef OMAP_NAME
85# undef MULTI_OMAP2
86# define MULTI_OMAP2
87# else
88# define OMAP_NAME omap5
89# endif
90#endif
91
92#ifdef CONFIG_SOC_AM33XX
93# ifdef OMAP_NAME
94# undef MULTI_OMAP2
95# define MULTI_OMAP2
96# else
97# define OMAP_NAME am33xx
98# endif
99#endif
100
Afzal Mohammedc664d0a2013-05-27 20:05:51 +0530101#ifdef CONFIG_SOC_AM43XX
102# ifdef OMAP_NAME
103# undef MULTI_OMAP2
104# define MULTI_OMAP2
105# else
106# define OMAP_NAME am43xx
107# endif
108#endif
109
R Sricharan68522152013-02-06 20:25:40 +0530110#ifdef CONFIG_SOC_DRA7XX
111# ifdef OMAP_NAME
112# undef MULTI_OMAP2
113# define MULTI_OMAP2
114# else
115# define OMAP_NAME DRA7XX
116# endif
117#endif
118
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700119/*
120 * Omap device type i.e. EMU/HS/TST/GP/BAD
121 */
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
127
128int omap_type(void);
129
130/*
131 * omap_rev bits:
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]
135 */
136unsigned int omap_rev(void);
137
Tony Lindgren816a65e2013-01-11 11:24:18 -0800138static inline int soc_is_omap(void)
139{
140 return omap_rev() != 0;
141}
142
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700143/*
144 * Get the CPU revision for OMAP devices
145 */
146#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
147
148/*
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
159 */
160#define GET_OMAP_CLASS (omap_rev() & 0xff)
161
162#define IS_OMAP_CLASS(class, id) \
163static inline int is_omap ##class (void) \
164{ \
165 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
166}
167
168#define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
169
170#define IS_AM_CLASS(class, id) \
171static inline int is_am ##class (void) \
172{ \
173 return (GET_AM_CLASS == (id)) ? 1 : 0; \
174}
175
176#define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
177
178#define IS_TI_CLASS(class, id) \
179static inline int is_ti ##class (void) \
180{ \
181 return (GET_TI_CLASS == (id)) ? 1 : 0; \
182}
183
184#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
185
186#define IS_OMAP_SUBCLASS(subclass, id) \
187static inline int is_omap ##subclass (void) \
188{ \
189 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
190}
191
192#define IS_TI_SUBCLASS(subclass, id) \
193static inline int is_ti ##subclass (void) \
194{ \
195 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
196}
197
198#define IS_AM_SUBCLASS(subclass, id) \
199static inline int is_am ##subclass (void) \
200{ \
201 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
202}
203
204IS_OMAP_CLASS(24xx, 0x24)
205IS_OMAP_CLASS(34xx, 0x34)
206IS_OMAP_CLASS(44xx, 0x44)
207IS_AM_CLASS(35xx, 0x35)
208IS_OMAP_CLASS(54xx, 0x54)
209IS_AM_CLASS(33xx, 0x33)
Afzal Mohammedc664d0a2013-05-27 20:05:51 +0530210IS_AM_CLASS(43xx, 0x43)
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700211
212IS_TI_CLASS(81xx, 0x81)
213
214IS_OMAP_SUBCLASS(242x, 0x242)
215IS_OMAP_SUBCLASS(243x, 0x243)
216IS_OMAP_SUBCLASS(343x, 0x343)
217IS_OMAP_SUBCLASS(363x, 0x363)
218IS_OMAP_SUBCLASS(443x, 0x443)
219IS_OMAP_SUBCLASS(446x, 0x446)
220IS_OMAP_SUBCLASS(447x, 0x447)
221IS_OMAP_SUBCLASS(543x, 0x543)
222
223IS_TI_SUBCLASS(816x, 0x816)
224IS_TI_SUBCLASS(814x, 0x814)
225IS_AM_SUBCLASS(335x, 0x335)
Afzal Mohammedc664d0a2013-05-27 20:05:51 +0530226IS_AM_SUBCLASS(437x, 0x437)
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700227
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
Afzal Mohammedc664d0a2013-05-27 20:05:51 +0530239#define soc_is_am43xx() 0
240#define soc_is_am437x() 0
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700241#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
R Sricharan68522152013-02-06 20:25:40 +0530247#define soc_is_dra7xx() 0
Rajendra Nayakaf438fe2014-08-27 19:38:22 -0600248#define soc_is_dra74x() 0
249#define soc_is_dra72x() 0
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700250
251#if defined(MULTI_OMAP2)
252# if defined(CONFIG_ARCH_OMAP2)
253# undef cpu_is_omap24xx
254# define cpu_is_omap24xx() is_omap24xx()
255# endif
256# if defined (CONFIG_SOC_OMAP2420)
257# undef cpu_is_omap242x
258# define cpu_is_omap242x() is_omap242x()
259# endif
260# if defined (CONFIG_SOC_OMAP2430)
261# undef cpu_is_omap243x
262# define cpu_is_omap243x() is_omap243x()
263# endif
264# if defined(CONFIG_ARCH_OMAP3)
265# undef cpu_is_omap34xx
266# undef cpu_is_omap343x
267# define cpu_is_omap34xx() is_omap34xx()
268# define cpu_is_omap343x() is_omap343x()
269# endif
270#else
271# if defined(CONFIG_ARCH_OMAP2)
272# undef cpu_is_omap24xx
273# define cpu_is_omap24xx() 1
274# endif
275# if defined(CONFIG_SOC_OMAP2420)
276# undef cpu_is_omap242x
277# define cpu_is_omap242x() 1
278# endif
279# if defined(CONFIG_SOC_OMAP2430)
280# undef cpu_is_omap243x
281# define cpu_is_omap243x() 1
282# endif
283# if defined(CONFIG_ARCH_OMAP3)
284# undef cpu_is_omap34xx
285# define cpu_is_omap34xx() 1
286# endif
287# if defined(CONFIG_SOC_OMAP3430)
288# undef cpu_is_omap343x
289# define cpu_is_omap343x() 1
290# endif
291#endif
292
293/*
294 * Macros to detect individual cpu types.
295 * These are only rarely needed.
296 * cpu_is_omap2420(): True for OMAP2420
297 * cpu_is_omap2422(): True for OMAP2422
298 * cpu_is_omap2423(): True for OMAP2423
299 * cpu_is_omap2430(): True for OMAP2430
300 * cpu_is_omap3430(): True for OMAP3430
301 */
302#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
303
304#define IS_OMAP_TYPE(type, id) \
305static inline int is_omap ##type (void) \
306{ \
307 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
308}
309
310IS_OMAP_TYPE(2420, 0x2420)
311IS_OMAP_TYPE(2422, 0x2422)
312IS_OMAP_TYPE(2423, 0x2423)
313IS_OMAP_TYPE(2430, 0x2430)
314IS_OMAP_TYPE(3430, 0x3430)
315
316#define cpu_is_omap2420() 0
317#define cpu_is_omap2422() 0
318#define cpu_is_omap2423() 0
319#define cpu_is_omap2430() 0
320#define cpu_is_omap3430() 0
321#define cpu_is_omap3630() 0
322#define soc_is_omap5430() 0
323
324/* These are needed for the common code */
325#ifdef CONFIG_ARCH_OMAP2PLUS
326#define cpu_is_omap7xx() 0
327#define cpu_is_omap15xx() 0
328#define cpu_is_omap16xx() 0
329#define cpu_is_omap1510() 0
330#define cpu_is_omap1610() 0
331#define cpu_is_omap1611() 0
332#define cpu_is_omap1621() 0
333#define cpu_is_omap1710() 0
334#define cpu_class_is_omap1() 0
335#define cpu_class_is_omap2() 1
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_ti81xx
352# undef cpu_is_ti816x
353# undef cpu_is_ti814x
354# undef soc_is_am35xx
355# define cpu_is_omap3430() is_omap3430()
356# undef cpu_is_omap3630
357# define cpu_is_omap3630() is_omap363x()
358# define cpu_is_ti81xx() is_ti81xx()
359# define cpu_is_ti816x() is_ti816x()
360# define cpu_is_ti814x() is_ti814x()
361# define soc_is_am35xx() is_am35xx()
362#endif
363
364# if defined(CONFIG_SOC_AM33XX)
365# undef soc_is_am33xx
366# undef soc_is_am335x
367# define soc_is_am33xx() is_am33xx()
368# define soc_is_am335x() is_am335x()
369#endif
370
Afzal Mohammedc664d0a2013-05-27 20:05:51 +0530371#ifdef CONFIG_SOC_AM43XX
372# undef soc_is_am43xx
373# undef soc_is_am437x
374# define soc_is_am43xx() is_am43xx()
375# define soc_is_am437x() is_am437x()
376#endif
377
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700378# if defined(CONFIG_ARCH_OMAP4)
379# undef cpu_is_omap44xx
380# undef cpu_is_omap443x
381# undef cpu_is_omap446x
382# undef cpu_is_omap447x
383# define cpu_is_omap44xx() is_omap44xx()
384# define cpu_is_omap443x() is_omap443x()
385# define cpu_is_omap446x() is_omap446x()
386# define cpu_is_omap447x() is_omap447x()
387# endif
388
389# if defined(CONFIG_SOC_OMAP5)
390# undef soc_is_omap54xx
391# undef soc_is_omap543x
392# define soc_is_omap54xx() is_omap54xx()
393# define soc_is_omap543x() is_omap543x()
394#endif
395
R Sricharan68522152013-02-06 20:25:40 +0530396#if defined(CONFIG_SOC_DRA7XX)
397#undef soc_is_dra7xx
Rajendra Nayakaf438fe2014-08-27 19:38:22 -0600398#undef soc_is_dra74x
399#undef soc_is_dra72x
R Sricharan68522152013-02-06 20:25:40 +0530400#define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7"))
Rajendra Nayakaf438fe2014-08-27 19:38:22 -0600401#define soc_is_dra74x() (of_machine_is_compatible("ti,dra74"))
402#define soc_is_dra72x() (of_machine_is_compatible("ti,dra72"))
R Sricharan68522152013-02-06 20:25:40 +0530403#endif
404
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700405/* Various silicon revisions for omap2 */
406#define OMAP242X_CLASS 0x24200024
407#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
408#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
409
410#define OMAP243X_CLASS 0x24300024
411#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
412
413#define OMAP343X_CLASS 0x34300034
414#define OMAP3430_REV_ES1_0 OMAP343X_CLASS
415#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
416#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
417#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
418#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
419#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
420
421#define OMAP363X_CLASS 0x36300034
422#define OMAP3630_REV_ES1_0 OMAP363X_CLASS
423#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
424#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
425
Tony Lindgrenc27964b2015-01-14 17:37:16 -0800426#define TI816X_CLASS 0x81600081
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700427#define TI8168_REV_ES1_0 TI816X_CLASS
428#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
Aida Mynzhasovaa5f93d92013-05-30 14:21:01 +0400429#define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8))
430#define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8))
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700431
Tony Lindgrenc27964b2015-01-14 17:37:16 -0800432#define TI814X_CLASS 0x81400081
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700433#define TI8148_REV_ES1_0 TI814X_CLASS
434#define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
435#define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
436
437#define AM35XX_CLASS 0x35170034
438#define AM35XX_REV_ES1_0 AM35XX_CLASS
439#define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
440
441#define AM335X_CLASS 0x33500033
442#define AM335X_REV_ES1_0 AM335X_CLASS
AnilKumar Ch5af044f2013-02-01 15:58:22 +0530443#define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8))
Vaibhav Hiremathd240ef32013-05-08 16:48:02 -0700444#define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8))
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700445
Afzal Mohammedc664d0a2013-05-27 20:05:51 +0530446#define AM437X_CLASS 0x43700000
Lokesh Vutla4a2ed4c2014-02-07 15:51:24 +0530447#define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8))
448#define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8))
Lokesh Vutla4fdd54f2014-11-28 09:02:07 +0530449#define AM437X_REV_ES1_2 (AM437X_CLASS | (0x12 << 8))
Afzal Mohammedc664d0a2013-05-27 20:05:51 +0530450
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700451#define OMAP443X_CLASS 0x44300044
452#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
453#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
454#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
455#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
456#define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
457
458#define OMAP446X_CLASS 0x44600044
459#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
460#define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
461
462#define OMAP447X_CLASS 0x44700044
463#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
464
465#define OMAP54XX_CLASS 0x54000054
Santosh Shilimkar5a898a72013-01-07 19:29:46 +0530466#define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8))
Santosh Shilimkar5a898a72013-01-07 19:29:46 +0530467#define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8))
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700468
Nishanth Menon733d20e2014-05-19 10:27:11 -0500469#define DRA7XX_CLASS 0x07000000
470#define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8))
471#define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8))
Vishal Mahaveer81032e32015-09-01 13:59:25 -0700472#define DRA752_REV_ES2_0 (DRA7XX_CLASS | (0x52 << 16) | (0x20 << 8))
473#define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8))
Nishanth Menon73d20282014-05-29 14:05:50 -0500474#define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8))
Nishanth Menon733d20e2014-05-19 10:27:11 -0500475
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700476void omap2xxx_check_revision(void);
477void omap3xxx_check_revision(void);
478void omap4xxx_check_revision(void);
479void omap5xxx_check_revision(void);
Nishanth Menon733d20e2014-05-19 10:27:11 -0500480void dra7xxx_check_revision(void);
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700481void omap3xxx_check_features(void);
482void ti81xx_check_features(void);
Vaibhav Hiremath7bcad172013-05-17 15:43:41 +0530483void am33xx_check_features(void);
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700484void omap4xxx_check_features(void);
485
486/*
487 * Runtime detection of OMAP3 features
488 *
489 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
490 * family have OS-level control over the I/O chain clock. This is
491 * to avoid a window during which wakeups could potentially be lost
492 * during powerdomain transitions. If this bit is set, it
493 * indicates that the chip does support OS-level control of this
494 * feature.
495 */
496extern u32 omap_features;
497
498#define OMAP3_HAS_L2CACHE BIT(0)
499#define OMAP3_HAS_IVA BIT(1)
500#define OMAP3_HAS_SGX BIT(2)
501#define OMAP3_HAS_NEON BIT(3)
502#define OMAP3_HAS_ISP BIT(4)
503#define OMAP3_HAS_192MHZ_CLK BIT(5)
504#define OMAP3_HAS_IO_WAKEUP BIT(6)
505#define OMAP3_HAS_SDRC BIT(7)
506#define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
Ivan Khoronzhuk42a1cc92012-11-14 12:10:37 -0800507#define OMAP4_HAS_PERF_SILICON BIT(9)
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700508
509
510#define OMAP3_HAS_FEATURE(feat,flag) \
511static inline unsigned int omap3_has_ ##feat(void) \
512{ \
513 return omap_features & OMAP3_HAS_ ##flag; \
514} \
515
516OMAP3_HAS_FEATURE(l2cache, L2CACHE)
517OMAP3_HAS_FEATURE(sgx, SGX)
518OMAP3_HAS_FEATURE(iva, IVA)
519OMAP3_HAS_FEATURE(neon, NEON)
520OMAP3_HAS_FEATURE(isp, ISP)
521OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
522OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
523OMAP3_HAS_FEATURE(sdrc, SDRC)
524OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
525
526/*
527 * Runtime detection of OMAP4 features
528 */
529#define OMAP4_HAS_FEATURE(feat, flag) \
530static inline unsigned int omap4_has_ ##feat(void) \
531{ \
532 return omap_features & OMAP4_HAS_ ##flag; \
533} \
534
Ivan Khoronzhuk42a1cc92012-11-14 12:10:37 -0800535OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON)
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700536
Tony Lindgren816a65e2013-01-11 11:24:18 -0800537/*
538 * We need to make sure omap initcalls don't run when
539 * multiplatform kernels are booted on other SoCs.
540 */
541#define omap_initcall(level, fn) \
542static int __init __used __##fn(void) \
543{ \
544 if (!soc_is_omap()) \
545 return 0; \
546 return fn(); \
547} \
548level(__##fn);
549
550#define omap_early_initcall(fn) omap_initcall(early_initcall, fn)
551#define omap_core_initcall(fn) omap_initcall(core_initcall, fn)
552#define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn)
553#define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn)
554#define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn)
555#define omap_device_initcall(fn) omap_initcall(device_initcall, fn)
556#define omap_late_initcall(fn) omap_initcall(late_initcall, fn)
Kevin Hilmane7e17c52013-05-08 16:48:01 -0700557#define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn)
Tony Lindgren816a65e2013-01-11 11:24:18 -0800558
Tony Lindgrene4c060d2012-10-05 13:25:59 -0700559#endif /* __ASSEMBLY__ */
560