blob: bfd9c5f5ee1485b1f4f2c6f98e507fbd79b5d29d [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
2 * arch/arm/plat-omap/include/mach/cpu.h
3 *
4 * OMAP cpu type detection
5 *
6 * Copyright (C) 2004, 2008 Nokia Corporation
7 *
Nishant Kamate49c4d22011-02-17 09:55:03 -08008 * Copyright (C) 2009-11 Texas Instruments.
Santosh Shilimkar44169072009-05-28 14:16:04 -07009 *
Russell Kinga09e64f2008-08-05 16:14:15 +010010 * Written by Tony Lindgren <tony.lindgren@nokia.com>
11 *
R Sricharanb13e80a2012-04-19 17:42:19 +053012 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
Santosh Shilimkar44169072009-05-28 14:16:04 -070013 *
Russell Kinga09e64f2008-08-05 16:14:15 +010014 * 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.
18 *
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.
23 *
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
27 *
28 */
29
30#ifndef __ASM_ARCH_OMAP_CPU_H
31#define __ASM_ARCH_OMAP_CPU_H
32
Tony Lindgrendbc04162012-08-31 10:59:07 -070033#ifndef __ASSEMBLY__
34
Sanjeev Premi8384ce02009-11-22 10:10:53 -080035#include <linux/bitops.h>
Tony Lindgrendc843282012-10-03 11:23:43 -070036
37/*
38 * Test if multicore OMAP support is needed
39 */
40#undef MULTI_OMAP1
41#undef MULTI_OMAP2
42#undef OMAP_NAME
43
44#ifdef CONFIG_ARCH_OMAP730
45# ifdef OMAP_NAME
46# undef MULTI_OMAP1
47# define MULTI_OMAP1
48# else
49# define OMAP_NAME omap730
50# endif
51#endif
52#ifdef CONFIG_ARCH_OMAP850
53# ifdef OMAP_NAME
54# undef MULTI_OMAP1
55# define MULTI_OMAP1
56# else
57# define OMAP_NAME omap850
58# endif
59#endif
60#ifdef CONFIG_ARCH_OMAP15XX
61# ifdef OMAP_NAME
62# undef MULTI_OMAP1
63# define MULTI_OMAP1
64# else
65# define OMAP_NAME omap1510
66# endif
67#endif
68#ifdef CONFIG_ARCH_OMAP16XX
69# ifdef OMAP_NAME
70# undef MULTI_OMAP1
71# define MULTI_OMAP1
72# else
73# define OMAP_NAME omap16xx
74# endif
75#endif
76#ifdef CONFIG_ARCH_OMAP2PLUS
77# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
78# error "OMAP1 and OMAP2PLUS can't be selected at the same time"
79# endif
80#endif
81#ifdef CONFIG_SOC_OMAP2420
82# ifdef OMAP_NAME
83# undef MULTI_OMAP2
84# define MULTI_OMAP2
85# else
86# define OMAP_NAME omap2420
87# endif
88#endif
89#ifdef CONFIG_SOC_OMAP2430
90# ifdef OMAP_NAME
91# undef MULTI_OMAP2
92# define MULTI_OMAP2
93# else
94# define OMAP_NAME omap2430
95# endif
96#endif
97#ifdef CONFIG_ARCH_OMAP3
98# ifdef OMAP_NAME
99# undef MULTI_OMAP2
100# define MULTI_OMAP2
101# else
102# define OMAP_NAME omap3
103# endif
104#endif
105#ifdef CONFIG_ARCH_OMAP4
106# ifdef OMAP_NAME
107# undef MULTI_OMAP2
108# define MULTI_OMAP2
109# else
110# define OMAP_NAME omap4
111# endif
112#endif
113
114#ifdef CONFIG_SOC_OMAP5
115# ifdef OMAP_NAME
116# undef MULTI_OMAP2
117# define MULTI_OMAP2
118# else
119# define OMAP_NAME omap5
120# endif
121#endif
122
123#ifdef CONFIG_SOC_AM33XX
124# ifdef OMAP_NAME
125# undef MULTI_OMAP2
126# define MULTI_OMAP2
127# else
128# define OMAP_NAME am33xx
129# endif
130#endif
Sanjeev Premi8384ce02009-11-22 10:10:53 -0800131
Kevin Hilman8e25ad92009-06-23 13:30:23 +0300132/*
133 * Omap device type i.e. EMU/HS/TST/GP/BAD
134 */
135#define OMAP2_DEVICE_TYPE_TEST 0
136#define OMAP2_DEVICE_TYPE_EMU 1
137#define OMAP2_DEVICE_TYPE_SEC 2
138#define OMAP2_DEVICE_TYPE_GP 3
139#define OMAP2_DEVICE_TYPE_BAD 4
140
141int omap_type(void);
142
Tony Lindgrena8823142008-12-10 17:36:30 -0800143/*
Lauri Leukkunen84a34342008-12-10 17:36:31 -0800144 * omap_rev bits:
Tony Lindgrena8823142008-12-10 17:36:30 -0800145 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
146 * CPU revision (See _REV_ defined in cpu.h) [15:08]
147 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
148 */
Lauri Leukkunen84a34342008-12-10 17:36:31 -0800149unsigned int omap_rev(void);
Russell Kinga09e64f2008-08-05 16:14:15 +0100150
Russell Kinga09e64f2008-08-05 16:14:15 +0100151/*
Sanjeev Premi048f4bd2009-11-22 10:10:54 -0800152 * Get the CPU revision for OMAP devices
153 */
154#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
155
156/*
Russell Kinga09e64f2008-08-05 16:14:15 +0100157 * Macros to group OMAP into cpu classes.
158 * These can be used in most places.
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700159 * cpu_is_omap7xx(): True for OMAP730, OMAP850
Russell Kinga09e64f2008-08-05 16:14:15 +0100160 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
161 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
162 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
163 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
164 * cpu_is_omap243x(): True for OMAP2430
165 * cpu_is_omap343x(): True for OMAP3430
Abhijit Pagarec6a6e6e2010-01-26 20:12:51 -0700166 * cpu_is_omap443x(): True for OMAP4430
Aneesh Vfa54dcc2011-07-02 08:00:21 +0530167 * cpu_is_omap446x(): True for OMAP4460
Leonid Iziumtsevec023e42011-12-13 10:46:44 -0800168 * cpu_is_omap447x(): True for OMAP4470
R Sricharanb13e80a2012-04-19 17:42:19 +0530169 * soc_is_omap543x(): True for OMAP5430, OMAP5432
Russell Kinga09e64f2008-08-05 16:14:15 +0100170 */
Lauri Leukkunen84a34342008-12-10 17:36:31 -0800171#define GET_OMAP_CLASS (omap_rev() & 0xff)
Russell Kinga09e64f2008-08-05 16:14:15 +0100172
173#define IS_OMAP_CLASS(class, id) \
174static inline int is_omap ##class (void) \
175{ \
176 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
177}
178
Afzal Mohammed99541192011-12-13 10:46:43 -0800179#define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
180
181#define IS_AM_CLASS(class, id) \
182static inline int is_am ##class (void) \
183{ \
184 return (GET_AM_CLASS == (id)) ? 1 : 0; \
185}
186
Hemant Pedanekara9203602011-12-13 10:46:44 -0800187#define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
188
189#define IS_TI_CLASS(class, id) \
190static inline int is_ti ##class (void) \
191{ \
192 return (GET_TI_CLASS == (id)) ? 1 : 0; \
193}
194
Lauri Leukkunen84a34342008-12-10 17:36:31 -0800195#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
Russell Kinga09e64f2008-08-05 16:14:15 +0100196
197#define IS_OMAP_SUBCLASS(subclass, id) \
198static inline int is_omap ##subclass (void) \
199{ \
200 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
201}
202
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800203#define IS_TI_SUBCLASS(subclass, id) \
204static inline int is_ti ##subclass (void) \
205{ \
206 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
207}
208
Afzal Mohammed99541192011-12-13 10:46:43 -0800209#define IS_AM_SUBCLASS(subclass, id) \
210static inline int is_am ##subclass (void) \
211{ \
212 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
213}
214
Russell Kinga09e64f2008-08-05 16:14:15 +0100215IS_OMAP_CLASS(7xx, 0x07)
216IS_OMAP_CLASS(15xx, 0x15)
217IS_OMAP_CLASS(16xx, 0x16)
218IS_OMAP_CLASS(24xx, 0x24)
219IS_OMAP_CLASS(34xx, 0x34)
Santosh Shilimkarb570e0e2009-12-11 16:16:34 -0800220IS_OMAP_CLASS(44xx, 0x44)
Kevin Hilman68a88b92012-04-30 16:37:10 -0700221IS_AM_CLASS(35xx, 0x35)
R Sricharanb13e80a2012-04-19 17:42:19 +0530222IS_OMAP_CLASS(54xx, 0x54)
Afzal Mohammed99541192011-12-13 10:46:43 -0800223IS_AM_CLASS(33xx, 0x33)
Russell Kinga09e64f2008-08-05 16:14:15 +0100224
Hemant Pedanekara9203602011-12-13 10:46:44 -0800225IS_TI_CLASS(81xx, 0x81)
226
Russell Kinga09e64f2008-08-05 16:14:15 +0100227IS_OMAP_SUBCLASS(242x, 0x242)
228IS_OMAP_SUBCLASS(243x, 0x243)
229IS_OMAP_SUBCLASS(343x, 0x343)
Nishanth Menon2456a102009-11-22 10:10:56 -0800230IS_OMAP_SUBCLASS(363x, 0x363)
Santosh Shilimkarb570e0e2009-12-11 16:16:34 -0800231IS_OMAP_SUBCLASS(443x, 0x443)
Aneesh Vfa54dcc2011-07-02 08:00:21 +0530232IS_OMAP_SUBCLASS(446x, 0x446)
Leonid Iziumtsevec023e42011-12-13 10:46:44 -0800233IS_OMAP_SUBCLASS(447x, 0x447)
R Sricharanb13e80a2012-04-19 17:42:19 +0530234IS_OMAP_SUBCLASS(543x, 0x543)
Russell Kinga09e64f2008-08-05 16:14:15 +0100235
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800236IS_TI_SUBCLASS(816x, 0x816)
Hemant Pedanekar4390f5b2011-12-13 10:46:45 -0800237IS_TI_SUBCLASS(814x, 0x814)
Afzal Mohammed99541192011-12-13 10:46:43 -0800238IS_AM_SUBCLASS(335x, 0x335)
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800239
Russell Kinga09e64f2008-08-05 16:14:15 +0100240#define cpu_is_omap7xx() 0
241#define cpu_is_omap15xx() 0
242#define cpu_is_omap16xx() 0
243#define cpu_is_omap24xx() 0
244#define cpu_is_omap242x() 0
245#define cpu_is_omap243x() 0
246#define cpu_is_omap34xx() 0
247#define cpu_is_omap343x() 0
Hemant Pedanekara9203602011-12-13 10:46:44 -0800248#define cpu_is_ti81xx() 0
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800249#define cpu_is_ti816x() 0
Hemant Pedanekar4390f5b2011-12-13 10:46:45 -0800250#define cpu_is_ti814x() 0
Kevin Hilman68a88b92012-04-30 16:37:10 -0700251#define soc_is_am35xx() 0
Vaibhav Hiremath971b8a92012-07-05 08:05:15 -0700252#define soc_is_am33xx() 0
253#define soc_is_am335x() 0
Santosh Shilimkar44169072009-05-28 14:16:04 -0700254#define cpu_is_omap44xx() 0
255#define cpu_is_omap443x() 0
Aneesh Vfa54dcc2011-07-02 08:00:21 +0530256#define cpu_is_omap446x() 0
Leonid Iziumtsevec023e42011-12-13 10:46:44 -0800257#define cpu_is_omap447x() 0
R Sricharanb13e80a2012-04-19 17:42:19 +0530258#define soc_is_omap54xx() 0
259#define soc_is_omap543x() 0
Russell Kinga09e64f2008-08-05 16:14:15 +0100260
261#if defined(MULTI_OMAP1)
262# if defined(CONFIG_ARCH_OMAP730)
263# undef cpu_is_omap7xx
264# define cpu_is_omap7xx() is_omap7xx()
265# endif
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700266# if defined(CONFIG_ARCH_OMAP850)
267# undef cpu_is_omap7xx
268# define cpu_is_omap7xx() is_omap7xx()
269# endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100270# if defined(CONFIG_ARCH_OMAP15XX)
271# undef cpu_is_omap15xx
272# define cpu_is_omap15xx() is_omap15xx()
273# endif
274# if defined(CONFIG_ARCH_OMAP16XX)
275# undef cpu_is_omap16xx
276# define cpu_is_omap16xx() is_omap16xx()
277# endif
278#else
279# if defined(CONFIG_ARCH_OMAP730)
280# undef cpu_is_omap7xx
281# define cpu_is_omap7xx() 1
282# endif
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700283# if defined(CONFIG_ARCH_OMAP850)
284# undef cpu_is_omap7xx
285# define cpu_is_omap7xx() 1
286# endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100287# if defined(CONFIG_ARCH_OMAP15XX)
288# undef cpu_is_omap15xx
289# define cpu_is_omap15xx() 1
290# endif
291# if defined(CONFIG_ARCH_OMAP16XX)
292# undef cpu_is_omap16xx
293# define cpu_is_omap16xx() 1
294# endif
295#endif
296
297#if defined(MULTI_OMAP2)
Tony Lindgren088ef952010-02-12 12:26:47 -0800298# if defined(CONFIG_ARCH_OMAP2)
Russell Kinga09e64f2008-08-05 16:14:15 +0100299# undef cpu_is_omap24xx
Russell Kinga09e64f2008-08-05 16:14:15 +0100300# define cpu_is_omap24xx() is_omap24xx()
Kevin Hilman54c44fb2010-03-10 17:16:30 +0000301# endif
Tony Lindgren59b479e2011-01-27 16:39:40 -0800302# if defined (CONFIG_SOC_OMAP2420)
Kevin Hilman54c44fb2010-03-10 17:16:30 +0000303# undef cpu_is_omap242x
Russell Kinga09e64f2008-08-05 16:14:15 +0100304# define cpu_is_omap242x() is_omap242x()
Kevin Hilman54c44fb2010-03-10 17:16:30 +0000305# endif
Tony Lindgren59b479e2011-01-27 16:39:40 -0800306# if defined (CONFIG_SOC_OMAP2430)
Kevin Hilman54c44fb2010-03-10 17:16:30 +0000307# undef cpu_is_omap243x
Russell Kinga09e64f2008-08-05 16:14:15 +0100308# define cpu_is_omap243x() is_omap243x()
309# endif
Tony Lindgrena8eb7ca2010-02-12 12:26:48 -0800310# if defined(CONFIG_ARCH_OMAP3)
Russell Kinga09e64f2008-08-05 16:14:15 +0100311# undef cpu_is_omap34xx
312# undef cpu_is_omap343x
313# define cpu_is_omap34xx() is_omap34xx()
314# define cpu_is_omap343x() is_omap343x()
315# endif
316#else
Tony Lindgren088ef952010-02-12 12:26:47 -0800317# if defined(CONFIG_ARCH_OMAP2)
Russell Kinga09e64f2008-08-05 16:14:15 +0100318# undef cpu_is_omap24xx
319# define cpu_is_omap24xx() 1
320# endif
Tony Lindgren59b479e2011-01-27 16:39:40 -0800321# if defined(CONFIG_SOC_OMAP2420)
Russell Kinga09e64f2008-08-05 16:14:15 +0100322# undef cpu_is_omap242x
323# define cpu_is_omap242x() 1
324# endif
Tony Lindgren59b479e2011-01-27 16:39:40 -0800325# if defined(CONFIG_SOC_OMAP2430)
Russell Kinga09e64f2008-08-05 16:14:15 +0100326# undef cpu_is_omap243x
327# define cpu_is_omap243x() 1
328# endif
Tony Lindgrena8eb7ca2010-02-12 12:26:48 -0800329# if defined(CONFIG_ARCH_OMAP3)
Russell Kinga09e64f2008-08-05 16:14:15 +0100330# undef cpu_is_omap34xx
331# define cpu_is_omap34xx() 1
332# endif
Tony Lindgren59b479e2011-01-27 16:39:40 -0800333# if defined(CONFIG_SOC_OMAP3430)
Russell Kinga09e64f2008-08-05 16:14:15 +0100334# undef cpu_is_omap343x
335# define cpu_is_omap343x() 1
336# endif
337#endif
338
339/*
340 * Macros to detect individual cpu types.
341 * These are only rarely needed.
Paul Bolled2ba7792012-06-26 23:12:47 +0200342 * cpu_is_omap310(): True for OMAP310
Russell Kinga09e64f2008-08-05 16:14:15 +0100343 * cpu_is_omap1510(): True for OMAP1510
344 * cpu_is_omap1610(): True for OMAP1610
345 * cpu_is_omap1611(): True for OMAP1611
346 * cpu_is_omap5912(): True for OMAP5912
347 * cpu_is_omap1621(): True for OMAP1621
348 * cpu_is_omap1710(): True for OMAP1710
349 * cpu_is_omap2420(): True for OMAP2420
350 * cpu_is_omap2422(): True for OMAP2422
351 * cpu_is_omap2423(): True for OMAP2423
352 * cpu_is_omap2430(): True for OMAP2430
353 * cpu_is_omap3430(): True for OMAP3430
354 */
Lauri Leukkunen84a34342008-12-10 17:36:31 -0800355#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
Russell Kinga09e64f2008-08-05 16:14:15 +0100356
357#define IS_OMAP_TYPE(type, id) \
358static inline int is_omap ##type (void) \
359{ \
360 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
361}
362
363IS_OMAP_TYPE(310, 0x0310)
Russell Kinga09e64f2008-08-05 16:14:15 +0100364IS_OMAP_TYPE(1510, 0x1510)
365IS_OMAP_TYPE(1610, 0x1610)
366IS_OMAP_TYPE(1611, 0x1611)
367IS_OMAP_TYPE(5912, 0x1611)
368IS_OMAP_TYPE(1621, 0x1621)
369IS_OMAP_TYPE(1710, 0x1710)
370IS_OMAP_TYPE(2420, 0x2420)
371IS_OMAP_TYPE(2422, 0x2422)
372IS_OMAP_TYPE(2423, 0x2423)
373IS_OMAP_TYPE(2430, 0x2430)
374IS_OMAP_TYPE(3430, 0x3430)
375
376#define cpu_is_omap310() 0
Russell Kinga09e64f2008-08-05 16:14:15 +0100377#define cpu_is_omap1510() 0
378#define cpu_is_omap1610() 0
379#define cpu_is_omap5912() 0
380#define cpu_is_omap1611() 0
381#define cpu_is_omap1621() 0
382#define cpu_is_omap1710() 0
383#define cpu_is_omap2420() 0
384#define cpu_is_omap2422() 0
385#define cpu_is_omap2423() 0
386#define cpu_is_omap2430() 0
387#define cpu_is_omap3430() 0
Nishanth Menon2456a102009-11-22 10:10:56 -0800388#define cpu_is_omap3630() 0
R Sricharanb13e80a2012-04-19 17:42:19 +0530389#define soc_is_omap5430() 0
Russell Kinga09e64f2008-08-05 16:14:15 +0100390
Russell Kinga09e64f2008-08-05 16:14:15 +0100391/*
392 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
Paul Bolle0fb37842012-06-26 23:13:29 +0200393 * between 310 vs. 1510 and 1611B/5912 vs. 1710.
Russell Kinga09e64f2008-08-05 16:14:15 +0100394 */
Tony Lindgrena9f82d12009-10-05 13:31:43 -0700395
Russell Kinga09e64f2008-08-05 16:14:15 +0100396#if defined(CONFIG_ARCH_OMAP15XX)
397# undef cpu_is_omap310
398# undef cpu_is_omap1510
399# define cpu_is_omap310() is_omap310()
400# define cpu_is_omap1510() is_omap1510()
401#endif
402
403#if defined(CONFIG_ARCH_OMAP16XX)
404# undef cpu_is_omap1610
405# undef cpu_is_omap1611
406# undef cpu_is_omap5912
407# undef cpu_is_omap1621
408# undef cpu_is_omap1710
409# define cpu_is_omap1610() is_omap1610()
410# define cpu_is_omap1611() is_omap1611()
411# define cpu_is_omap5912() is_omap5912()
412# define cpu_is_omap1621() is_omap1621()
413# define cpu_is_omap1710() is_omap1710()
414#endif
415
Tony Lindgren088ef952010-02-12 12:26:47 -0800416#if defined(CONFIG_ARCH_OMAP2)
Russell Kinga09e64f2008-08-05 16:14:15 +0100417# undef cpu_is_omap2420
418# undef cpu_is_omap2422
419# undef cpu_is_omap2423
420# undef cpu_is_omap2430
421# define cpu_is_omap2420() is_omap2420()
422# define cpu_is_omap2422() is_omap2422()
423# define cpu_is_omap2423() is_omap2423()
424# define cpu_is_omap2430() is_omap2430()
425#endif
426
Tony Lindgrena8eb7ca2010-02-12 12:26:48 -0800427#if defined(CONFIG_ARCH_OMAP3)
Russell Kinga09e64f2008-08-05 16:14:15 +0100428# undef cpu_is_omap3430
Hemant Pedanekara9203602011-12-13 10:46:44 -0800429# undef cpu_is_ti81xx
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800430# undef cpu_is_ti816x
Hemant Pedanekar4390f5b2011-12-13 10:46:45 -0800431# undef cpu_is_ti814x
Kevin Hilman68a88b92012-04-30 16:37:10 -0700432# undef soc_is_am35xx
Russell Kinga09e64f2008-08-05 16:14:15 +0100433# define cpu_is_omap3430() is_omap3430()
Nishanth Menon2456a102009-11-22 10:10:56 -0800434# undef cpu_is_omap3630
435# define cpu_is_omap3630() is_omap363x()
Hemant Pedanekara9203602011-12-13 10:46:44 -0800436# define cpu_is_ti81xx() is_ti81xx()
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800437# define cpu_is_ti816x() is_ti816x()
Hemant Pedanekar4390f5b2011-12-13 10:46:45 -0800438# define cpu_is_ti814x() is_ti814x()
Kevin Hilman68a88b92012-04-30 16:37:10 -0700439# define soc_is_am35xx() is_am35xx()
Vaibhav Hiremath1c213ba2012-07-05 08:05:15 -0700440#endif
441
442# if defined(CONFIG_SOC_AM33XX)
Vaibhav Hiremath971b8a92012-07-05 08:05:15 -0700443# undef soc_is_am33xx
444# undef soc_is_am335x
445# define soc_is_am33xx() is_am33xx()
446# define soc_is_am335x() is_am335x()
Russell Kinga09e64f2008-08-05 16:14:15 +0100447#endif
448
Santosh Shilimkar44169072009-05-28 14:16:04 -0700449# if defined(CONFIG_ARCH_OMAP4)
450# undef cpu_is_omap44xx
451# undef cpu_is_omap443x
Aneesh Vfa54dcc2011-07-02 08:00:21 +0530452# undef cpu_is_omap446x
Leonid Iziumtsevec023e42011-12-13 10:46:44 -0800453# undef cpu_is_omap447x
Santosh Shilimkarb570e0e2009-12-11 16:16:34 -0800454# define cpu_is_omap44xx() is_omap44xx()
455# define cpu_is_omap443x() is_omap443x()
Aneesh Vfa54dcc2011-07-02 08:00:21 +0530456# define cpu_is_omap446x() is_omap446x()
Leonid Iziumtsevec023e42011-12-13 10:46:44 -0800457# define cpu_is_omap447x() is_omap447x()
Santosh Shilimkar44169072009-05-28 14:16:04 -0700458# endif
459
R Sricharanb13e80a2012-04-19 17:42:19 +0530460# if defined(CONFIG_SOC_OMAP5)
461# undef soc_is_omap54xx
462# undef soc_is_omap543x
463# define soc_is_omap54xx() is_omap54xx()
464# define soc_is_omap543x() is_omap543x()
465#endif
466
Russell Kinga09e64f2008-08-05 16:14:15 +0100467/* Macros to detect if we have OMAP1 or OMAP2 */
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700468#define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
Russell Kinga09e64f2008-08-05 16:14:15 +0100469 cpu_is_omap16xx())
Santosh Shilimkar44169072009-05-28 14:16:04 -0700470#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
Vaibhav Hiremath90f7f9a2012-08-07 19:44:01 +0530471 cpu_is_omap44xx() || soc_is_omap54xx() || \
472 soc_is_am33xx())
Russell Kinga09e64f2008-08-05 16:14:15 +0100473
Tony Lindgrena8823142008-12-10 17:36:30 -0800474/* Various silicon revisions for omap2 */
475#define OMAP242X_CLASS 0x24200024
Sanjeev Premi76abab22010-10-01 16:35:24 -0700476#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
Paul Walmsley057673d2011-09-13 19:52:15 -0600477#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
Russell Kinga09e64f2008-08-05 16:14:15 +0100478
Tony Lindgrena8823142008-12-10 17:36:30 -0800479#define OMAP243X_CLASS 0x24300024
Sanjeev Premi76abab22010-10-01 16:35:24 -0700480#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
Russell Kinga09e64f2008-08-05 16:14:15 +0100481
Tony Lindgrena8823142008-12-10 17:36:30 -0800482#define OMAP343X_CLASS 0x34300034
Sanjeev Premi76abab22010-10-01 16:35:24 -0700483#define OMAP3430_REV_ES1_0 OMAP343X_CLASS
Paul Walmsley057673d2011-09-13 19:52:15 -0600484#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
485#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
486#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
487#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
488#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
Russell Kinga09e64f2008-08-05 16:14:15 +0100489
Sanjeev Premi76abab22010-10-01 16:35:24 -0700490#define OMAP363X_CLASS 0x36300034
491#define OMAP3630_REV_ES1_0 OMAP363X_CLASS
Paul Walmsley057673d2011-09-13 19:52:15 -0600492#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
493#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
Nishanth Menon2456a102009-11-22 10:10:56 -0800494
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800495#define TI816X_CLASS 0x81600034
496#define TI8168_REV_ES1_0 TI816X_CLASS
Paul Walmsley057673d2011-09-13 19:52:15 -0600497#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800498
Hemant Pedanekar4390f5b2011-12-13 10:46:45 -0800499#define TI814X_CLASS 0x81400034
500#define TI8148_REV_ES1_0 TI814X_CLASS
501#define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
502#define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
503
Kevin Hilman68a88b92012-04-30 16:37:10 -0700504#define AM35XX_CLASS 0x35170034
505#define AM35XX_REV_ES1_0 AM35XX_CLASS
506#define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
507
Vaibhav Hiremath1c213ba2012-07-05 08:05:15 -0700508#define AM335X_CLASS 0x33500033
Afzal Mohammed99541192011-12-13 10:46:43 -0800509#define AM335X_REV_ES1_0 AM335X_CLASS
510
Santosh Shilimkarb570e0e2009-12-11 16:16:34 -0800511#define OMAP443X_CLASS 0x44300044
Nishant Kamate49c4d22011-02-17 09:55:03 -0800512#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
513#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
514#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
515#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
David Anders55035c12011-12-13 10:46:44 -0800516#define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
Santosh Shilimkar44169072009-05-28 14:16:04 -0700517
Aneesh Vfa54dcc2011-07-02 08:00:21 +0530518#define OMAP446X_CLASS 0x44600044
519#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
Chris Lalancette33ee0db2012-05-09 09:45:02 -0700520#define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
Aneesh Vfa54dcc2011-07-02 08:00:21 +0530521
Leonid Iziumtsevec023e42011-12-13 10:46:44 -0800522#define OMAP447X_CLASS 0x44700044
523#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
524
R Sricharanb13e80a2012-04-19 17:42:19 +0530525#define OMAP54XX_CLASS 0x54000054
526#define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
527#define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
528
Vaibhav Hiremath4de34f32011-12-19 15:50:15 +0530529void omap2xxx_check_revision(void);
530void omap3xxx_check_revision(void);
531void omap4xxx_check_revision(void);
R Sricharanb13e80a2012-04-19 17:42:19 +0530532void omap5xxx_check_revision(void);
Vaibhav Hiremath4de34f32011-12-19 15:50:15 +0530533void omap3xxx_check_features(void);
534void ti81xx_check_features(void);
535void omap4xxx_check_features(void);
Tony Lindgrena9f82d12009-10-05 13:31:43 -0700536
Sanjeev Premi8384ce02009-11-22 10:10:53 -0800537/*
538 * Runtime detection of OMAP3 features
Paul Walmsleyb02b9172011-10-06 17:18:45 -0600539 *
540 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
541 * family have OS-level control over the I/O chain clock. This is
542 * to avoid a window during which wakeups could potentially be lost
543 * during powerdomain transitions. If this bit is set, it
544 * indicates that the chip does support OS-level control of this
545 * feature.
Sanjeev Premi8384ce02009-11-22 10:10:53 -0800546 */
Aneesh Vcc0170b2011-07-02 08:00:22 +0530547extern u32 omap_features;
Sanjeev Premi8384ce02009-11-22 10:10:53 -0800548
549#define OMAP3_HAS_L2CACHE BIT(0)
550#define OMAP3_HAS_IVA BIT(1)
551#define OMAP3_HAS_SGX BIT(2)
552#define OMAP3_HAS_NEON BIT(3)
553#define OMAP3_HAS_ISP BIT(4)
Vishwanath BS7356f0b2010-02-22 22:09:10 -0700554#define OMAP3_HAS_192MHZ_CLK BIT(5)
stanley.miaoad0c63f2010-08-02 14:21:40 +0300555#define OMAP3_HAS_IO_WAKEUP BIT(6)
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800556#define OMAP3_HAS_SDRC BIT(7)
Paul Walmsleyb02b9172011-10-06 17:18:45 -0600557#define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
558#define OMAP4_HAS_MPU_1GHZ BIT(9)
559#define OMAP4_HAS_MPU_1_2GHZ BIT(10)
560#define OMAP4_HAS_MPU_1_5GHZ BIT(11)
Aneesh Vcc0170b2011-07-02 08:00:22 +0530561
Sanjeev Premi8384ce02009-11-22 10:10:53 -0800562
563#define OMAP3_HAS_FEATURE(feat,flag) \
564static inline unsigned int omap3_has_ ##feat(void) \
565{ \
Aneesh Vcc0170b2011-07-02 08:00:22 +0530566 return omap_features & OMAP3_HAS_ ##flag; \
Sanjeev Premi8384ce02009-11-22 10:10:53 -0800567} \
568
569OMAP3_HAS_FEATURE(l2cache, L2CACHE)
570OMAP3_HAS_FEATURE(sgx, SGX)
571OMAP3_HAS_FEATURE(iva, IVA)
572OMAP3_HAS_FEATURE(neon, NEON)
573OMAP3_HAS_FEATURE(isp, ISP)
Vishwanath BS7356f0b2010-02-22 22:09:10 -0700574OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
stanley.miaoad0c63f2010-08-02 14:21:40 +0300575OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -0800576OMAP3_HAS_FEATURE(sdrc, SDRC)
Paul Walmsleyb02b9172011-10-06 17:18:45 -0600577OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
Sanjeev Premi8384ce02009-11-22 10:10:53 -0800578
Aneesh Vcc0170b2011-07-02 08:00:22 +0530579/*
580 * Runtime detection of OMAP4 features
581 */
Aneesh Vcc0170b2011-07-02 08:00:22 +0530582#define OMAP4_HAS_FEATURE(feat, flag) \
583static inline unsigned int omap4_has_ ##feat(void) \
584{ \
585 return omap_features & OMAP4_HAS_ ##flag; \
586} \
587
588OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
589OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
590OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
591
Tony Lindgrendbc04162012-08-31 10:59:07 -0700592#endif /* __ASSEMBLY__ */
Tony Lindgrena9f82d12009-10-05 13:31:43 -0700593#endif