blob: fc60c4ebcc28af1d0d1fa80d583b7f35cf00feaf [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 *
Santosh Shilimkar44169072009-05-28 14:16:04 -07008 * Copyright (C) 2009 Texas Instruments.
9 *
Russell Kinga09e64f2008-08-05 16:14:15 +010010 * Written by Tony Lindgren <tony.lindgren@nokia.com>
11 *
Santosh Shilimkar44169072009-05-28 14:16:04 -070012 * Added OMAP4 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
13 *
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
33struct omap_chip_id {
34 u8 oc;
Tony Lindgrena8823142008-12-10 17:36:30 -080035 u8 type;
Russell Kinga09e64f2008-08-05 16:14:15 +010036};
37
38#define OMAP_CHIP_INIT(x) { .oc = x }
39
Tony Lindgrena8823142008-12-10 17:36:30 -080040/*
Lauri Leukkunen84a34342008-12-10 17:36:31 -080041 * omap_rev bits:
Tony Lindgrena8823142008-12-10 17:36:30 -080042 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
43 * CPU revision (See _REV_ defined in cpu.h) [15:08]
44 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
45 */
Lauri Leukkunen84a34342008-12-10 17:36:31 -080046unsigned int omap_rev(void);
Russell Kinga09e64f2008-08-05 16:14:15 +010047
Russell Kinga09e64f2008-08-05 16:14:15 +010048/*
49 * Test if multicore OMAP support is needed
50 */
51#undef MULTI_OMAP1
52#undef MULTI_OMAP2
53#undef OMAP_NAME
54
55#ifdef CONFIG_ARCH_OMAP730
56# ifdef OMAP_NAME
57# undef MULTI_OMAP1
58# define MULTI_OMAP1
59# else
60# define OMAP_NAME omap730
61# endif
62#endif
Zebediah C. McClureae302f42009-03-23 18:07:39 -070063#ifdef CONFIG_ARCH_OMAP850
64# ifdef OMAP_NAME
65# undef MULTI_OMAP1
66# define MULTI_OMAP1
67# else
68# define OMAP_NAME omap850
69# endif
70#endif
Russell Kinga09e64f2008-08-05 16:14:15 +010071#ifdef CONFIG_ARCH_OMAP15XX
72# ifdef OMAP_NAME
73# undef MULTI_OMAP1
74# define MULTI_OMAP1
75# else
76# define OMAP_NAME omap1510
77# endif
78#endif
79#ifdef CONFIG_ARCH_OMAP16XX
80# ifdef OMAP_NAME
81# undef MULTI_OMAP1
82# define MULTI_OMAP1
83# else
84# define OMAP_NAME omap16xx
85# endif
86#endif
87#if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX))
88# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
89# error "OMAP1 and OMAP2 can't be selected at the same time"
90# endif
91#endif
92#ifdef CONFIG_ARCH_OMAP2420
93# ifdef OMAP_NAME
94# undef MULTI_OMAP2
95# define MULTI_OMAP2
96# else
97# define OMAP_NAME omap2420
98# endif
99#endif
100#ifdef CONFIG_ARCH_OMAP2430
101# ifdef OMAP_NAME
102# undef MULTI_OMAP2
103# define MULTI_OMAP2
104# else
105# define OMAP_NAME omap2430
106# endif
107#endif
108#ifdef CONFIG_ARCH_OMAP3430
109# ifdef OMAP_NAME
110# undef MULTI_OMAP2
111# define MULTI_OMAP2
112# else
113# define OMAP_NAME omap3430
114# endif
115#endif
116
117/*
118 * Macros to group OMAP into cpu classes.
119 * These can be used in most places.
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700120 * cpu_is_omap7xx(): True for OMAP730, OMAP850
Russell Kinga09e64f2008-08-05 16:14:15 +0100121 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
122 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
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 */
Lauri Leukkunen84a34342008-12-10 17:36:31 -0800128#define GET_OMAP_CLASS (omap_rev() & 0xff)
Russell Kinga09e64f2008-08-05 16:14:15 +0100129
130#define IS_OMAP_CLASS(class, id) \
131static inline int is_omap ##class (void) \
132{ \
133 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
134}
135
Lauri Leukkunen84a34342008-12-10 17:36:31 -0800136#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
Russell Kinga09e64f2008-08-05 16:14:15 +0100137
138#define IS_OMAP_SUBCLASS(subclass, id) \
139static inline int is_omap ##subclass (void) \
140{ \
141 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
142}
143
144IS_OMAP_CLASS(7xx, 0x07)
145IS_OMAP_CLASS(15xx, 0x15)
146IS_OMAP_CLASS(16xx, 0x16)
147IS_OMAP_CLASS(24xx, 0x24)
148IS_OMAP_CLASS(34xx, 0x34)
149
150IS_OMAP_SUBCLASS(242x, 0x242)
151IS_OMAP_SUBCLASS(243x, 0x243)
152IS_OMAP_SUBCLASS(343x, 0x343)
153
154#define cpu_is_omap7xx() 0
155#define cpu_is_omap15xx() 0
156#define cpu_is_omap16xx() 0
157#define cpu_is_omap24xx() 0
158#define cpu_is_omap242x() 0
159#define cpu_is_omap243x() 0
160#define cpu_is_omap34xx() 0
161#define cpu_is_omap343x() 0
Santosh Shilimkar44169072009-05-28 14:16:04 -0700162#define cpu_is_omap44xx() 0
163#define cpu_is_omap443x() 0
Russell Kinga09e64f2008-08-05 16:14:15 +0100164
165#if defined(MULTI_OMAP1)
166# if defined(CONFIG_ARCH_OMAP730)
167# undef cpu_is_omap7xx
168# define cpu_is_omap7xx() is_omap7xx()
169# endif
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700170# if defined(CONFIG_ARCH_OMAP850)
171# undef cpu_is_omap7xx
172# define cpu_is_omap7xx() is_omap7xx()
173# endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100174# if defined(CONFIG_ARCH_OMAP15XX)
175# undef cpu_is_omap15xx
176# define cpu_is_omap15xx() is_omap15xx()
177# endif
178# if defined(CONFIG_ARCH_OMAP16XX)
179# undef cpu_is_omap16xx
180# define cpu_is_omap16xx() is_omap16xx()
181# endif
182#else
183# if defined(CONFIG_ARCH_OMAP730)
184# undef cpu_is_omap7xx
185# define cpu_is_omap7xx() 1
186# endif
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700187# if defined(CONFIG_ARCH_OMAP850)
188# undef cpu_is_omap7xx
189# define cpu_is_omap7xx() 1
190# endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100191# if defined(CONFIG_ARCH_OMAP15XX)
192# undef cpu_is_omap15xx
193# define cpu_is_omap15xx() 1
194# endif
195# if defined(CONFIG_ARCH_OMAP16XX)
196# undef cpu_is_omap16xx
197# define cpu_is_omap16xx() 1
198# endif
199#endif
200
201#if defined(MULTI_OMAP2)
202# if defined(CONFIG_ARCH_OMAP24XX)
203# undef cpu_is_omap24xx
204# undef cpu_is_omap242x
205# undef cpu_is_omap243x
206# define cpu_is_omap24xx() is_omap24xx()
207# define cpu_is_omap242x() is_omap242x()
208# define cpu_is_omap243x() is_omap243x()
209# endif
210# if defined(CONFIG_ARCH_OMAP34XX)
211# undef cpu_is_omap34xx
212# undef cpu_is_omap343x
213# define cpu_is_omap34xx() is_omap34xx()
214# define cpu_is_omap343x() is_omap343x()
215# endif
216#else
217# if defined(CONFIG_ARCH_OMAP24XX)
218# undef cpu_is_omap24xx
219# define cpu_is_omap24xx() 1
220# endif
221# if defined(CONFIG_ARCH_OMAP2420)
222# undef cpu_is_omap242x
223# define cpu_is_omap242x() 1
224# endif
225# if defined(CONFIG_ARCH_OMAP2430)
226# undef cpu_is_omap243x
227# define cpu_is_omap243x() 1
228# endif
229# if defined(CONFIG_ARCH_OMAP34XX)
230# undef cpu_is_omap34xx
231# define cpu_is_omap34xx() 1
232# endif
233# if defined(CONFIG_ARCH_OMAP3430)
234# undef cpu_is_omap343x
235# define cpu_is_omap343x() 1
236# endif
237#endif
238
239/*
240 * Macros to detect individual cpu types.
241 * These are only rarely needed.
242 * cpu_is_omap330(): True for OMAP330
243 * cpu_is_omap730(): True for OMAP730
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700244 * cpu_is_omap850(): True for OMAP850
Russell Kinga09e64f2008-08-05 16:14:15 +0100245 * cpu_is_omap1510(): True for OMAP1510
246 * cpu_is_omap1610(): True for OMAP1610
247 * cpu_is_omap1611(): True for OMAP1611
248 * cpu_is_omap5912(): True for OMAP5912
249 * cpu_is_omap1621(): True for OMAP1621
250 * cpu_is_omap1710(): True for OMAP1710
251 * cpu_is_omap2420(): True for OMAP2420
252 * cpu_is_omap2422(): True for OMAP2422
253 * cpu_is_omap2423(): True for OMAP2423
254 * cpu_is_omap2430(): True for OMAP2430
255 * cpu_is_omap3430(): True for OMAP3430
256 */
Lauri Leukkunen84a34342008-12-10 17:36:31 -0800257#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
Russell Kinga09e64f2008-08-05 16:14:15 +0100258
259#define IS_OMAP_TYPE(type, id) \
260static inline int is_omap ##type (void) \
261{ \
262 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
263}
264
265IS_OMAP_TYPE(310, 0x0310)
266IS_OMAP_TYPE(730, 0x0730)
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700267IS_OMAP_TYPE(850, 0x0850)
Russell Kinga09e64f2008-08-05 16:14:15 +0100268IS_OMAP_TYPE(1510, 0x1510)
269IS_OMAP_TYPE(1610, 0x1610)
270IS_OMAP_TYPE(1611, 0x1611)
271IS_OMAP_TYPE(5912, 0x1611)
272IS_OMAP_TYPE(1621, 0x1621)
273IS_OMAP_TYPE(1710, 0x1710)
274IS_OMAP_TYPE(2420, 0x2420)
275IS_OMAP_TYPE(2422, 0x2422)
276IS_OMAP_TYPE(2423, 0x2423)
277IS_OMAP_TYPE(2430, 0x2430)
278IS_OMAP_TYPE(3430, 0x3430)
279
280#define cpu_is_omap310() 0
281#define cpu_is_omap730() 0
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700282#define cpu_is_omap850() 0
Russell Kinga09e64f2008-08-05 16:14:15 +0100283#define cpu_is_omap1510() 0
284#define cpu_is_omap1610() 0
285#define cpu_is_omap5912() 0
286#define cpu_is_omap1611() 0
287#define cpu_is_omap1621() 0
288#define cpu_is_omap1710() 0
289#define cpu_is_omap2420() 0
290#define cpu_is_omap2422() 0
291#define cpu_is_omap2423() 0
292#define cpu_is_omap2430() 0
293#define cpu_is_omap3430() 0
294
295#if defined(MULTI_OMAP1)
296# if defined(CONFIG_ARCH_OMAP730)
297# undef cpu_is_omap730
298# define cpu_is_omap730() is_omap730()
299# endif
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700300# if defined(CONFIG_ARCH_OMAP850)
301# undef cpu_is_omap850
302# define cpu_is_omap850() is_omap850()
303# endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100304#else
305# if defined(CONFIG_ARCH_OMAP730)
306# undef cpu_is_omap730
307# define cpu_is_omap730() 1
308# endif
309#endif
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700310#else
311# if defined(CONFIG_ARCH_OMAP850)
312# undef cpu_is_omap850
313# define cpu_is_omap850() 1
314# endif
315#endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100316
317/*
318 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
319 * between 330 vs. 1510 and 1611B/5912 vs. 1710.
320 */
321#if defined(CONFIG_ARCH_OMAP15XX)
322# undef cpu_is_omap310
323# undef cpu_is_omap1510
324# define cpu_is_omap310() is_omap310()
325# define cpu_is_omap1510() is_omap1510()
326#endif
327
328#if defined(CONFIG_ARCH_OMAP16XX)
329# undef cpu_is_omap1610
330# undef cpu_is_omap1611
331# undef cpu_is_omap5912
332# undef cpu_is_omap1621
333# undef cpu_is_omap1710
334# define cpu_is_omap1610() is_omap1610()
335# define cpu_is_omap1611() is_omap1611()
336# define cpu_is_omap5912() is_omap5912()
337# define cpu_is_omap1621() is_omap1621()
338# define cpu_is_omap1710() is_omap1710()
339#endif
340
341#if defined(CONFIG_ARCH_OMAP24XX)
342# undef cpu_is_omap2420
343# undef cpu_is_omap2422
344# undef cpu_is_omap2423
345# undef cpu_is_omap2430
346# define cpu_is_omap2420() is_omap2420()
347# define cpu_is_omap2422() is_omap2422()
348# define cpu_is_omap2423() is_omap2423()
349# define cpu_is_omap2430() is_omap2430()
350#endif
351
352#if defined(CONFIG_ARCH_OMAP34XX)
353# undef cpu_is_omap3430
354# define cpu_is_omap3430() is_omap3430()
355#endif
356
Santosh Shilimkar44169072009-05-28 14:16:04 -0700357# if defined(CONFIG_ARCH_OMAP4)
358# undef cpu_is_omap44xx
359# undef cpu_is_omap443x
360# define cpu_is_omap44xx() 1
361# define cpu_is_omap443x() 1
362# endif
363
Russell Kinga09e64f2008-08-05 16:14:15 +0100364/* Macros to detect if we have OMAP1 or OMAP2 */
Zebediah C. McClureae302f42009-03-23 18:07:39 -0700365#define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
Russell Kinga09e64f2008-08-05 16:14:15 +0100366 cpu_is_omap16xx())
Santosh Shilimkar44169072009-05-28 14:16:04 -0700367#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
368 cpu_is_omap44xx())
Russell Kinga09e64f2008-08-05 16:14:15 +0100369
Santosh Shilimkar44169072009-05-28 14:16:04 -0700370#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
371 defined(CONFIG_ARCH_OMAP4)
Russell Kinga09e64f2008-08-05 16:14:15 +0100372
Tony Lindgrena8823142008-12-10 17:36:30 -0800373/* Various silicon revisions for omap2 */
374#define OMAP242X_CLASS 0x24200024
375#define OMAP2420_REV_ES1_0 0x24200024
376#define OMAP2420_REV_ES2_0 0x24201024
Russell Kinga09e64f2008-08-05 16:14:15 +0100377
Tony Lindgrena8823142008-12-10 17:36:30 -0800378#define OMAP243X_CLASS 0x24300024
379#define OMAP2430_REV_ES1_0 0x24300024
Russell Kinga09e64f2008-08-05 16:14:15 +0100380
Tony Lindgrena8823142008-12-10 17:36:30 -0800381#define OMAP343X_CLASS 0x34300034
382#define OMAP3430_REV_ES1_0 0x34300034
383#define OMAP3430_REV_ES2_0 0x34301034
384#define OMAP3430_REV_ES2_1 0x34302034
385#define OMAP3430_REV_ES3_0 0x34303034
Tony Lindgren187e6882009-01-29 08:57:16 -0800386#define OMAP3430_REV_ES3_1 0x34304034
Russell Kinga09e64f2008-08-05 16:14:15 +0100387
Santosh Shilimkar44169072009-05-28 14:16:04 -0700388#define OMAP443X_CLASS 0x44300034
389
Russell Kinga09e64f2008-08-05 16:14:15 +0100390/*
391 * omap_chip bits
392 *
393 * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
394 * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
395 * something that is only valid on that particular ES revision.
396 *
397 * These bits may be ORed together to indicate structures that are
398 * available on multiple chip types.
399 *
400 * To test whether a particular structure matches the current OMAP chip type,
401 * use omap_chip_is().
402 *
403 */
Paul Walmsleyd41ad522009-02-05 20:45:25 -0700404#define CHIP_IS_OMAP2420 (1 << 0)
405#define CHIP_IS_OMAP2430 (1 << 1)
406#define CHIP_IS_OMAP3430 (1 << 2)
407#define CHIP_IS_OMAP3430ES1 (1 << 3)
408#define CHIP_IS_OMAP3430ES2 (1 << 4)
409#define CHIP_IS_OMAP3430ES3_0 (1 << 5)
410#define CHIP_IS_OMAP3430ES3_1 (1 << 6)
Russell Kinga09e64f2008-08-05 16:14:15 +0100411
Paul Walmsleyd41ad522009-02-05 20:45:25 -0700412#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
413
414/*
415 * "GE" here represents "greater than or equal to" in terms of ES
416 * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430
417 * chips at ES2 and beyond, but not, for example, any OMAP lines after
418 * OMAP3.
419 */
420#define CHIP_GE_OMAP3430ES2 (CHIP_IS_OMAP3430ES2 | \
421 CHIP_IS_OMAP3430ES3_0 | \
422 CHIP_IS_OMAP3430ES3_1)
423#define CHIP_GE_OMAP3430ES3_1 (CHIP_IS_OMAP3430ES3_1)
424
Russell Kinga09e64f2008-08-05 16:14:15 +0100425
426int omap_chip_is(struct omap_chip_id oci);
Tony Lindgrena8823142008-12-10 17:36:30 -0800427int omap_type(void);
Russell Kinga09e64f2008-08-05 16:14:15 +0100428
429/*
430 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
431 */
Tony Lindgrena8823142008-12-10 17:36:30 -0800432#define OMAP2_DEVICE_TYPE_TEST 0
433#define OMAP2_DEVICE_TYPE_EMU 1
434#define OMAP2_DEVICE_TYPE_SEC 2
435#define OMAP2_DEVICE_TYPE_GP 3
436#define OMAP2_DEVICE_TYPE_BAD 4
Russell Kinga09e64f2008-08-05 16:14:15 +0100437
438void omap2_check_revision(void);
439
440#endif /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */