]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/arm/plat-omap/include/mach/cpu.h
omap: headers: Create headers necessary for compile under mach-omap1 and mach-omap2
[mirror_ubuntu-jammy-kernel.git] / arch / arm / plat-omap / include / mach / cpu.h
CommitLineData
1da177e4 1/*
a09e64fb 2 * arch/arm/plat-omap/include/mach/cpu.h
1da177e4
LT
3 *
4 * OMAP cpu type detection
5 *
097c584c 6 * Copyright (C) 2004, 2008 Nokia Corporation
1da177e4 7 *
44169075
SS
8 * Copyright (C) 2009 Texas Instruments.
9 *
1da177e4
LT
10 * Written by Tony Lindgren <tony.lindgren@nokia.com>
11 *
44169075
SS
12 * Added OMAP4 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
13 *
1da177e4
LT
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.
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
8e25ad96
KH
33/*
34 * Omap device type i.e. EMU/HS/TST/GP/BAD
35 */
36#define OMAP2_DEVICE_TYPE_TEST 0
37#define OMAP2_DEVICE_TYPE_EMU 1
38#define OMAP2_DEVICE_TYPE_SEC 2
39#define OMAP2_DEVICE_TYPE_GP 3
40#define OMAP2_DEVICE_TYPE_BAD 4
41
42int omap_type(void);
43
097c584c
PW
44struct omap_chip_id {
45 u8 oc;
a8823143 46 u8 type;
097c584c
PW
47};
48
49#define OMAP_CHIP_INIT(x) { .oc = x }
50
a8823143 51/*
84a34344 52 * omap_rev bits:
a8823143
TL
53 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
54 * CPU revision (See _REV_ defined in cpu.h) [15:08]
55 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
56 */
84a34344 57unsigned int omap_rev(void);
1da177e4 58
1da177e4
LT
59/*
60 * Test if multicore OMAP support is needed
61 */
9839c6b8
TL
62#undef MULTI_OMAP1
63#undef MULTI_OMAP2
1da177e4
LT
64#undef OMAP_NAME
65
66#ifdef CONFIG_ARCH_OMAP730
67# ifdef OMAP_NAME
9839c6b8
TL
68# undef MULTI_OMAP1
69# define MULTI_OMAP1
1da177e4
LT
70# else
71# define OMAP_NAME omap730
72# endif
73#endif
ae302f40
ZM
74#ifdef CONFIG_ARCH_OMAP850
75# ifdef OMAP_NAME
76# undef MULTI_OMAP1
77# define MULTI_OMAP1
78# else
79# define OMAP_NAME omap850
80# endif
81#endif
9ad5897c 82#ifdef CONFIG_ARCH_OMAP15XX
1da177e4 83# ifdef OMAP_NAME
9839c6b8
TL
84# undef MULTI_OMAP1
85# define MULTI_OMAP1
1da177e4
LT
86# else
87# define OMAP_NAME omap1510
88# endif
89#endif
90#ifdef CONFIG_ARCH_OMAP16XX
91# ifdef OMAP_NAME
9839c6b8
TL
92# undef MULTI_OMAP1
93# define MULTI_OMAP1
1da177e4 94# else
9839c6b8 95# define OMAP_NAME omap16xx
1da177e4
LT
96# endif
97#endif
2c17f615 98#if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX))
9839c6b8
TL
99# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
100# error "OMAP1 and OMAP2 can't be selected at the same time"
2c17f615
SMK
101# endif
102#endif
103#ifdef CONFIG_ARCH_OMAP2420
104# ifdef OMAP_NAME
105# undef MULTI_OMAP2
106# define MULTI_OMAP2
1da177e4 107# else
2c17f615
SMK
108# define OMAP_NAME omap2420
109# endif
110#endif
111#ifdef CONFIG_ARCH_OMAP2430
112# ifdef OMAP_NAME
113# undef MULTI_OMAP2
114# define MULTI_OMAP2
115# else
116# define OMAP_NAME omap2430
117# endif
118#endif
119#ifdef CONFIG_ARCH_OMAP3430
120# ifdef OMAP_NAME
9839c6b8 121# undef MULTI_OMAP2
2c17f615
SMK
122# define MULTI_OMAP2
123# else
124# define OMAP_NAME omap3430
1da177e4
LT
125# endif
126#endif
127
128/*
9839c6b8
TL
129 * Macros to group OMAP into cpu classes.
130 * These can be used in most places.
ae302f40 131 * cpu_is_omap7xx(): True for OMAP730, OMAP850
9ad5897c 132 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
9839c6b8 133 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
9ad5897c
TL
134 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
135 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
136 * cpu_is_omap243x(): True for OMAP2430
2c17f615 137 * cpu_is_omap343x(): True for OMAP3430
1da177e4 138 */
84a34344 139#define GET_OMAP_CLASS (omap_rev() & 0xff)
1da177e4 140
1da177e4
LT
141#define IS_OMAP_CLASS(class, id) \
142static inline int is_omap ##class (void) \
143{ \
144 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
145}
146
84a34344 147#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
9ad5897c
TL
148
149#define IS_OMAP_SUBCLASS(subclass, id) \
150static inline int is_omap ##subclass (void) \
151{ \
152 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
153}
154
1da177e4
LT
155IS_OMAP_CLASS(7xx, 0x07)
156IS_OMAP_CLASS(15xx, 0x15)
157IS_OMAP_CLASS(16xx, 0x16)
158IS_OMAP_CLASS(24xx, 0x24)
2c17f615 159IS_OMAP_CLASS(34xx, 0x34)
1da177e4 160
9ad5897c
TL
161IS_OMAP_SUBCLASS(242x, 0x242)
162IS_OMAP_SUBCLASS(243x, 0x243)
2c17f615 163IS_OMAP_SUBCLASS(343x, 0x343)
9ad5897c 164
9839c6b8
TL
165#define cpu_is_omap7xx() 0
166#define cpu_is_omap15xx() 0
167#define cpu_is_omap16xx() 0
168#define cpu_is_omap24xx() 0
9ad5897c
TL
169#define cpu_is_omap242x() 0
170#define cpu_is_omap243x() 0
2c17f615
SMK
171#define cpu_is_omap34xx() 0
172#define cpu_is_omap343x() 0
44169075
SS
173#define cpu_is_omap44xx() 0
174#define cpu_is_omap443x() 0
9839c6b8
TL
175
176#if defined(MULTI_OMAP1)
177# if defined(CONFIG_ARCH_OMAP730)
178# undef cpu_is_omap7xx
179# define cpu_is_omap7xx() is_omap7xx()
180# endif
ae302f40
ZM
181# if defined(CONFIG_ARCH_OMAP850)
182# undef cpu_is_omap7xx
183# define cpu_is_omap7xx() is_omap7xx()
184# endif
9ad5897c 185# if defined(CONFIG_ARCH_OMAP15XX)
9839c6b8
TL
186# undef cpu_is_omap15xx
187# define cpu_is_omap15xx() is_omap15xx()
188# endif
189# if defined(CONFIG_ARCH_OMAP16XX)
190# undef cpu_is_omap16xx
1da177e4
LT
191# define cpu_is_omap16xx() is_omap16xx()
192# endif
193#else
194# if defined(CONFIG_ARCH_OMAP730)
9839c6b8 195# undef cpu_is_omap7xx
1da177e4 196# define cpu_is_omap7xx() 1
1da177e4 197# endif
ae302f40
ZM
198# if defined(CONFIG_ARCH_OMAP850)
199# undef cpu_is_omap7xx
200# define cpu_is_omap7xx() 1
201# endif
9ad5897c 202# if defined(CONFIG_ARCH_OMAP15XX)
9839c6b8 203# undef cpu_is_omap15xx
1da177e4 204# define cpu_is_omap15xx() 1
1da177e4
LT
205# endif
206# if defined(CONFIG_ARCH_OMAP16XX)
9839c6b8 207# undef cpu_is_omap16xx
1da177e4 208# define cpu_is_omap16xx() 1
9839c6b8 209# endif
2c17f615
SMK
210#endif
211
212#if defined(MULTI_OMAP2)
9839c6b8
TL
213# if defined(CONFIG_ARCH_OMAP24XX)
214# undef cpu_is_omap24xx
9ad5897c
TL
215# undef cpu_is_omap242x
216# undef cpu_is_omap243x
2c17f615 217# define cpu_is_omap24xx() is_omap24xx()
9ad5897c
TL
218# define cpu_is_omap242x() is_omap242x()
219# define cpu_is_omap243x() is_omap243x()
1da177e4 220# endif
2c17f615
SMK
221# if defined(CONFIG_ARCH_OMAP34XX)
222# undef cpu_is_omap34xx
223# undef cpu_is_omap343x
224# define cpu_is_omap34xx() is_omap34xx()
225# define cpu_is_omap343x() is_omap343x()
226# endif
227#else
228# if defined(CONFIG_ARCH_OMAP24XX)
229# undef cpu_is_omap24xx
230# define cpu_is_omap24xx() 1
231# endif
232# if defined(CONFIG_ARCH_OMAP2420)
233# undef cpu_is_omap242x
234# define cpu_is_omap242x() 1
235# endif
236# if defined(CONFIG_ARCH_OMAP2430)
237# undef cpu_is_omap243x
238# define cpu_is_omap243x() 1
239# endif
240# if defined(CONFIG_ARCH_OMAP34XX)
241# undef cpu_is_omap34xx
242# define cpu_is_omap34xx() 1
243# endif
244# if defined(CONFIG_ARCH_OMAP3430)
245# undef cpu_is_omap343x
246# define cpu_is_omap343x() 1
247# endif
1da177e4
LT
248#endif
249
9839c6b8
TL
250/*
251 * Macros to detect individual cpu types.
252 * These are only rarely needed.
9ad5897c 253 * cpu_is_omap330(): True for OMAP330
9839c6b8 254 * cpu_is_omap730(): True for OMAP730
ae302f40 255 * cpu_is_omap850(): True for OMAP850
9839c6b8
TL
256 * cpu_is_omap1510(): True for OMAP1510
257 * cpu_is_omap1610(): True for OMAP1610
258 * cpu_is_omap1611(): True for OMAP1611
259 * cpu_is_omap5912(): True for OMAP5912
260 * cpu_is_omap1621(): True for OMAP1621
261 * cpu_is_omap1710(): True for OMAP1710
262 * cpu_is_omap2420(): True for OMAP2420
9ad5897c
TL
263 * cpu_is_omap2422(): True for OMAP2422
264 * cpu_is_omap2423(): True for OMAP2423
265 * cpu_is_omap2430(): True for OMAP2430
2c17f615 266 * cpu_is_omap3430(): True for OMAP3430
9839c6b8 267 */
84a34344 268#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
9839c6b8
TL
269
270#define IS_OMAP_TYPE(type, id) \
271static inline int is_omap ##type (void) \
272{ \
273 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
274}
275
9ad5897c 276IS_OMAP_TYPE(310, 0x0310)
9839c6b8 277IS_OMAP_TYPE(730, 0x0730)
ae302f40 278IS_OMAP_TYPE(850, 0x0850)
9839c6b8
TL
279IS_OMAP_TYPE(1510, 0x1510)
280IS_OMAP_TYPE(1610, 0x1610)
281IS_OMAP_TYPE(1611, 0x1611)
282IS_OMAP_TYPE(5912, 0x1611)
283IS_OMAP_TYPE(1621, 0x1621)
284IS_OMAP_TYPE(1710, 0x1710)
285IS_OMAP_TYPE(2420, 0x2420)
9ad5897c
TL
286IS_OMAP_TYPE(2422, 0x2422)
287IS_OMAP_TYPE(2423, 0x2423)
288IS_OMAP_TYPE(2430, 0x2430)
2c17f615 289IS_OMAP_TYPE(3430, 0x3430)
9839c6b8 290
9ad5897c 291#define cpu_is_omap310() 0
9839c6b8 292#define cpu_is_omap730() 0
ae302f40 293#define cpu_is_omap850() 0
9839c6b8
TL
294#define cpu_is_omap1510() 0
295#define cpu_is_omap1610() 0
296#define cpu_is_omap5912() 0
297#define cpu_is_omap1611() 0
298#define cpu_is_omap1621() 0
299#define cpu_is_omap1710() 0
300#define cpu_is_omap2420() 0
9ad5897c
TL
301#define cpu_is_omap2422() 0
302#define cpu_is_omap2423() 0
303#define cpu_is_omap2430() 0
2c17f615 304#define cpu_is_omap3430() 0
9839c6b8 305
9839c6b8
TL
306/*
307 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
a9f82d10 308 * between 730 vs 850, 330 vs. 1510 and 1611B/5912 vs. 1710.
9839c6b8 309 */
a9f82d10
TL
310
311#if defined(CONFIG_ARCH_OMAP730)
312# undef cpu_is_omap730
313# define cpu_is_omap730() is_omap730()
314#endif
315
316#if defined(CONFIG_ARCH_OMAP850)
317# undef cpu_is_omap850
318# define cpu_is_omap850() is_omap850()
319#endif
320
9ad5897c
TL
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
9839c6b8
TL
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
1da177e4 334# define cpu_is_omap1610() is_omap1610()
9839c6b8 335# define cpu_is_omap1611() is_omap1611()
1da177e4 336# define cpu_is_omap5912() is_omap5912()
9839c6b8 337# define cpu_is_omap1621() is_omap1621()
1da177e4 338# define cpu_is_omap1710() is_omap1710()
9839c6b8
TL
339#endif
340
9ad5897c
TL
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()
1da177e4
LT
350#endif
351
2c17f615
SMK
352#if defined(CONFIG_ARCH_OMAP34XX)
353# undef cpu_is_omap3430
354# define cpu_is_omap3430() is_omap3430()
355#endif
356
44169075
SS
357# 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
9ad5897c 364/* Macros to detect if we have OMAP1 or OMAP2 */
ae302f40 365#define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
9ad5897c 366 cpu_is_omap16xx())
44169075
SS
367#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
368 cpu_is_omap44xx())
2c17f615 369
a8823143
TL
370/* Various silicon revisions for omap2 */
371#define OMAP242X_CLASS 0x24200024
372#define OMAP2420_REV_ES1_0 0x24200024
373#define OMAP2420_REV_ES2_0 0x24201024
2c17f615 374
a8823143
TL
375#define OMAP243X_CLASS 0x24300024
376#define OMAP2430_REV_ES1_0 0x24300024
2c17f615 377
a8823143
TL
378#define OMAP343X_CLASS 0x34300034
379#define OMAP3430_REV_ES1_0 0x34300034
380#define OMAP3430_REV_ES2_0 0x34301034
381#define OMAP3430_REV_ES2_1 0x34302034
382#define OMAP3430_REV_ES3_0 0x34303034
187e688d 383#define OMAP3430_REV_ES3_1 0x34304034
097c584c 384
44169075
SS
385#define OMAP443X_CLASS 0x44300034
386
097c584c
PW
387/*
388 * omap_chip bits
389 *
390 * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
391 * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
392 * something that is only valid on that particular ES revision.
393 *
394 * These bits may be ORed together to indicate structures that are
395 * available on multiple chip types.
396 *
397 * To test whether a particular structure matches the current OMAP chip type,
398 * use omap_chip_is().
399 *
400 */
d41ad520
PW
401#define CHIP_IS_OMAP2420 (1 << 0)
402#define CHIP_IS_OMAP2430 (1 << 1)
403#define CHIP_IS_OMAP3430 (1 << 2)
404#define CHIP_IS_OMAP3430ES1 (1 << 3)
405#define CHIP_IS_OMAP3430ES2 (1 << 4)
406#define CHIP_IS_OMAP3430ES3_0 (1 << 5)
407#define CHIP_IS_OMAP3430ES3_1 (1 << 6)
408
409#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
410
411/*
412 * "GE" here represents "greater than or equal to" in terms of ES
413 * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430
414 * chips at ES2 and beyond, but not, for example, any OMAP lines after
415 * OMAP3.
416 */
417#define CHIP_GE_OMAP3430ES2 (CHIP_IS_OMAP3430ES2 | \
418 CHIP_IS_OMAP3430ES3_0 | \
419 CHIP_IS_OMAP3430ES3_1)
420#define CHIP_GE_OMAP3430ES3_1 (CHIP_IS_OMAP3430ES3_1)
097c584c 421
097c584c
PW
422
423int omap_chip_is(struct omap_chip_id oci);
097c584c 424void omap2_check_revision(void);
a9f82d10
TL
425
426#endif