2 * arch/arm/plat-omap/include/mach/cpu.h
4 * OMAP cpu type detection
6 * Copyright (C) 2004, 2008 Nokia Corporation
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #ifndef __ASM_ARCH_OMAP_CPU_H
27 #define __ASM_ARCH_OMAP_CPU_H
34 #define OMAP_CHIP_INIT(x) { .oc = x }
38 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
39 * CPU revision (See _REV_ defined in cpu.h) [15:08]
40 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
42 unsigned int omap_rev(void);
45 * Test if multicore OMAP support is needed
51 #ifdef CONFIG_ARCH_OMAP730
56 # define OMAP_NAME omap730
59 #ifdef CONFIG_ARCH_OMAP850
64 # define OMAP_NAME omap850
67 #ifdef CONFIG_ARCH_OMAP15XX
72 # define OMAP_NAME omap1510
75 #ifdef CONFIG_ARCH_OMAP16XX
80 # define OMAP_NAME omap16xx
83 #if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX))
84 # if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
85 # error "OMAP1 and OMAP2 can't be selected at the same time"
88 #ifdef CONFIG_ARCH_OMAP2420
93 # define OMAP_NAME omap2420
96 #ifdef CONFIG_ARCH_OMAP2430
101 # define OMAP_NAME omap2430
104 #ifdef CONFIG_ARCH_OMAP3430
109 # define OMAP_NAME omap3430
114 * Macros to group OMAP into cpu classes.
115 * These can be used in most places.
116 * cpu_is_omap7xx(): True for OMAP730, OMAP850
117 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
118 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
119 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
120 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
121 * cpu_is_omap243x(): True for OMAP2430
122 * cpu_is_omap343x(): True for OMAP3430
124 #define GET_OMAP_CLASS (omap_rev() & 0xff)
126 #define IS_OMAP_CLASS(class, id) \
127 static inline int is_omap ##class (void) \
129 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
132 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
134 #define IS_OMAP_SUBCLASS(subclass, id) \
135 static inline int is_omap ##subclass (void) \
137 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
140 IS_OMAP_CLASS(7xx, 0x07)
141 IS_OMAP_CLASS(15xx, 0x15)
142 IS_OMAP_CLASS(16xx, 0x16)
143 IS_OMAP_CLASS(24xx, 0x24)
144 IS_OMAP_CLASS(34xx, 0x34)
146 IS_OMAP_SUBCLASS(242x, 0x242)
147 IS_OMAP_SUBCLASS(243x, 0x243)
148 IS_OMAP_SUBCLASS(343x, 0x343)
150 #define cpu_is_omap7xx() 0
151 #define cpu_is_omap15xx() 0
152 #define cpu_is_omap16xx() 0
153 #define cpu_is_omap24xx() 0
154 #define cpu_is_omap242x() 0
155 #define cpu_is_omap243x() 0
156 #define cpu_is_omap34xx() 0
157 #define cpu_is_omap343x() 0
159 #if defined(MULTI_OMAP1)
160 # if defined(CONFIG_ARCH_OMAP730)
161 # undef cpu_is_omap7xx
162 # define cpu_is_omap7xx() is_omap7xx()
164 # if defined(CONFIG_ARCH_OMAP850)
165 # undef cpu_is_omap7xx
166 # define cpu_is_omap7xx() is_omap7xx()
168 # if defined(CONFIG_ARCH_OMAP15XX)
169 # undef cpu_is_omap15xx
170 # define cpu_is_omap15xx() is_omap15xx()
172 # if defined(CONFIG_ARCH_OMAP16XX)
173 # undef cpu_is_omap16xx
174 # define cpu_is_omap16xx() is_omap16xx()
177 # if defined(CONFIG_ARCH_OMAP730)
178 # undef cpu_is_omap7xx
179 # define cpu_is_omap7xx() 1
181 # if defined(CONFIG_ARCH_OMAP850)
182 # undef cpu_is_omap7xx
183 # define cpu_is_omap7xx() 1
185 # if defined(CONFIG_ARCH_OMAP15XX)
186 # undef cpu_is_omap15xx
187 # define cpu_is_omap15xx() 1
189 # if defined(CONFIG_ARCH_OMAP16XX)
190 # undef cpu_is_omap16xx
191 # define cpu_is_omap16xx() 1
195 #if defined(MULTI_OMAP2)
196 # if defined(CONFIG_ARCH_OMAP24XX)
197 # undef cpu_is_omap24xx
198 # undef cpu_is_omap242x
199 # undef cpu_is_omap243x
200 # define cpu_is_omap24xx() is_omap24xx()
201 # define cpu_is_omap242x() is_omap242x()
202 # define cpu_is_omap243x() is_omap243x()
204 # if defined(CONFIG_ARCH_OMAP34XX)
205 # undef cpu_is_omap34xx
206 # undef cpu_is_omap343x
207 # define cpu_is_omap34xx() is_omap34xx()
208 # define cpu_is_omap343x() is_omap343x()
211 # if defined(CONFIG_ARCH_OMAP24XX)
212 # undef cpu_is_omap24xx
213 # define cpu_is_omap24xx() 1
215 # if defined(CONFIG_ARCH_OMAP2420)
216 # undef cpu_is_omap242x
217 # define cpu_is_omap242x() 1
219 # if defined(CONFIG_ARCH_OMAP2430)
220 # undef cpu_is_omap243x
221 # define cpu_is_omap243x() 1
223 # if defined(CONFIG_ARCH_OMAP34XX)
224 # undef cpu_is_omap34xx
225 # define cpu_is_omap34xx() 1
227 # if defined(CONFIG_ARCH_OMAP3430)
228 # undef cpu_is_omap343x
229 # define cpu_is_omap343x() 1
234 * Macros to detect individual cpu types.
235 * These are only rarely needed.
236 * cpu_is_omap330(): True for OMAP330
237 * cpu_is_omap730(): True for OMAP730
238 * cpu_is_omap850(): True for OMAP850
239 * cpu_is_omap1510(): True for OMAP1510
240 * cpu_is_omap1610(): True for OMAP1610
241 * cpu_is_omap1611(): True for OMAP1611
242 * cpu_is_omap5912(): True for OMAP5912
243 * cpu_is_omap1621(): True for OMAP1621
244 * cpu_is_omap1710(): True for OMAP1710
245 * cpu_is_omap2420(): True for OMAP2420
246 * cpu_is_omap2422(): True for OMAP2422
247 * cpu_is_omap2423(): True for OMAP2423
248 * cpu_is_omap2430(): True for OMAP2430
249 * cpu_is_omap3430(): True for OMAP3430
251 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
253 #define IS_OMAP_TYPE(type, id) \
254 static inline int is_omap ##type (void) \
256 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
259 IS_OMAP_TYPE(310, 0x0310)
260 IS_OMAP_TYPE(730, 0x0730)
261 IS_OMAP_TYPE(850, 0x0850)
262 IS_OMAP_TYPE(1510, 0x1510)
263 IS_OMAP_TYPE(1610, 0x1610)
264 IS_OMAP_TYPE(1611, 0x1611)
265 IS_OMAP_TYPE(5912, 0x1611)
266 IS_OMAP_TYPE(1621, 0x1621)
267 IS_OMAP_TYPE(1710, 0x1710)
268 IS_OMAP_TYPE(2420, 0x2420)
269 IS_OMAP_TYPE(2422, 0x2422)
270 IS_OMAP_TYPE(2423, 0x2423)
271 IS_OMAP_TYPE(2430, 0x2430)
272 IS_OMAP_TYPE(3430, 0x3430)
274 #define cpu_is_omap310() 0
275 #define cpu_is_omap730() 0
276 #define cpu_is_omap850() 0
277 #define cpu_is_omap1510() 0
278 #define cpu_is_omap1610() 0
279 #define cpu_is_omap5912() 0
280 #define cpu_is_omap1611() 0
281 #define cpu_is_omap1621() 0
282 #define cpu_is_omap1710() 0
283 #define cpu_is_omap2420() 0
284 #define cpu_is_omap2422() 0
285 #define cpu_is_omap2423() 0
286 #define cpu_is_omap2430() 0
287 #define cpu_is_omap3430() 0
289 #if defined(MULTI_OMAP1)
290 # if defined(CONFIG_ARCH_OMAP730)
291 # undef cpu_is_omap730
292 # define cpu_is_omap730() is_omap730()
294 # if defined(CONFIG_ARCH_OMAP850)
295 # undef cpu_is_omap850
296 # define cpu_is_omap850() is_omap850()
299 # if defined(CONFIG_ARCH_OMAP730)
300 # undef cpu_is_omap730
301 # define cpu_is_omap730() 1
305 # if defined(CONFIG_ARCH_OMAP850)
306 # undef cpu_is_omap850
307 # define cpu_is_omap850() 1
312 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
313 * between 330 vs. 1510 and 1611B/5912 vs. 1710.
315 #if defined(CONFIG_ARCH_OMAP15XX)
316 # undef cpu_is_omap310
317 # undef cpu_is_omap1510
318 # define cpu_is_omap310() is_omap310()
319 # define cpu_is_omap1510() is_omap1510()
322 #if defined(CONFIG_ARCH_OMAP16XX)
323 # undef cpu_is_omap1610
324 # undef cpu_is_omap1611
325 # undef cpu_is_omap5912
326 # undef cpu_is_omap1621
327 # undef cpu_is_omap1710
328 # define cpu_is_omap1610() is_omap1610()
329 # define cpu_is_omap1611() is_omap1611()
330 # define cpu_is_omap5912() is_omap5912()
331 # define cpu_is_omap1621() is_omap1621()
332 # define cpu_is_omap1710() is_omap1710()
335 #if defined(CONFIG_ARCH_OMAP24XX)
336 # undef cpu_is_omap2420
337 # undef cpu_is_omap2422
338 # undef cpu_is_omap2423
339 # undef cpu_is_omap2430
340 # define cpu_is_omap2420() is_omap2420()
341 # define cpu_is_omap2422() is_omap2422()
342 # define cpu_is_omap2423() is_omap2423()
343 # define cpu_is_omap2430() is_omap2430()
346 #if defined(CONFIG_ARCH_OMAP34XX)
347 # undef cpu_is_omap3430
348 # define cpu_is_omap3430() is_omap3430()
351 /* Macros to detect if we have OMAP1 or OMAP2 */
352 #define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
354 #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx())
356 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
358 /* Various silicon revisions for omap2 */
359 #define OMAP242X_CLASS 0x24200024
360 #define OMAP2420_REV_ES1_0 0x24200024
361 #define OMAP2420_REV_ES2_0 0x24201024
363 #define OMAP243X_CLASS 0x24300024
364 #define OMAP2430_REV_ES1_0 0x24300024
366 #define OMAP343X_CLASS 0x34300034
367 #define OMAP3430_REV_ES1_0 0x34300034
368 #define OMAP3430_REV_ES2_0 0x34301034
369 #define OMAP3430_REV_ES2_1 0x34302034
370 #define OMAP3430_REV_ES3_0 0x34303034
371 #define OMAP3430_REV_ES3_1 0x34304034
376 * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
377 * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
378 * something that is only valid on that particular ES revision.
380 * These bits may be ORed together to indicate structures that are
381 * available on multiple chip types.
383 * To test whether a particular structure matches the current OMAP chip type,
384 * use omap_chip_is().
387 #define CHIP_IS_OMAP2420 (1 << 0)
388 #define CHIP_IS_OMAP2430 (1 << 1)
389 #define CHIP_IS_OMAP3430 (1 << 2)
390 #define CHIP_IS_OMAP3430ES1 (1 << 3)
391 #define CHIP_IS_OMAP3430ES2 (1 << 4)
392 #define CHIP_IS_OMAP3430ES3_0 (1 << 5)
393 #define CHIP_IS_OMAP3430ES3_1 (1 << 6)
395 #define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
398 * "GE" here represents "greater than or equal to" in terms of ES
399 * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430
400 * chips at ES2 and beyond, but not, for example, any OMAP lines after
403 #define CHIP_GE_OMAP3430ES2 (CHIP_IS_OMAP3430ES2 | \
404 CHIP_IS_OMAP3430ES3_0 | \
405 CHIP_IS_OMAP3430ES3_1)
406 #define CHIP_GE_OMAP3430ES3_1 (CHIP_IS_OMAP3430ES3_1)
409 int omap_chip_is(struct omap_chip_id oci);
413 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
415 #define OMAP2_DEVICE_TYPE_TEST 0
416 #define OMAP2_DEVICE_TYPE_EMU 1
417 #define OMAP2_DEVICE_TYPE_SEC 2
418 #define OMAP2_DEVICE_TYPE_GP 3
419 #define OMAP2_DEVICE_TYPE_BAD 4
421 void omap2_check_revision(void);
423 #endif /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */