repo init
[linux-rt-nao.git] / arch / arm / plat-omap / include / mach / cpu.h
bloba8e1178a946877e73df2f52f978c22cf79a30786
1 /*
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
29 struct omap_chip_id {
30 u8 oc;
31 u8 type;
34 #define OMAP_CHIP_INIT(x) { .oc = x }
37 * omap_rev bits:
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
47 #undef MULTI_OMAP1
48 #undef MULTI_OMAP2
49 #undef OMAP_NAME
51 #ifdef CONFIG_ARCH_OMAP730
52 # ifdef OMAP_NAME
53 # undef MULTI_OMAP1
54 # define MULTI_OMAP1
55 # else
56 # define OMAP_NAME omap730
57 # endif
58 #endif
59 #ifdef CONFIG_ARCH_OMAP15XX
60 # ifdef OMAP_NAME
61 # undef MULTI_OMAP1
62 # define MULTI_OMAP1
63 # else
64 # define OMAP_NAME omap1510
65 # endif
66 #endif
67 #ifdef CONFIG_ARCH_OMAP16XX
68 # ifdef OMAP_NAME
69 # undef MULTI_OMAP1
70 # define MULTI_OMAP1
71 # else
72 # define OMAP_NAME omap16xx
73 # endif
74 #endif
75 #if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX))
76 # if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
77 # error "OMAP1 and OMAP2 can't be selected at the same time"
78 # endif
79 #endif
80 #ifdef CONFIG_ARCH_OMAP2420
81 # ifdef OMAP_NAME
82 # undef MULTI_OMAP2
83 # define MULTI_OMAP2
84 # else
85 # define OMAP_NAME omap2420
86 # endif
87 #endif
88 #ifdef CONFIG_ARCH_OMAP2430
89 # ifdef OMAP_NAME
90 # undef MULTI_OMAP2
91 # define MULTI_OMAP2
92 # else
93 # define OMAP_NAME omap2430
94 # endif
95 #endif
96 #ifdef CONFIG_ARCH_OMAP3430
97 # ifdef OMAP_NAME
98 # undef MULTI_OMAP2
99 # define MULTI_OMAP2
100 # else
101 # define OMAP_NAME omap3430
102 # endif
103 #endif
106 * Macros to group OMAP into cpu classes.
107 * These can be used in most places.
108 * cpu_is_omap7xx(): True for OMAP730
109 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
110 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
111 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
112 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
113 * cpu_is_omap243x(): True for OMAP2430
114 * cpu_is_omap343x(): True for OMAP3430
116 #define GET_OMAP_CLASS (omap_rev() & 0xff)
118 #define IS_OMAP_CLASS(class, id) \
119 static inline int is_omap ##class (void) \
121 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
124 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
126 #define IS_OMAP_SUBCLASS(subclass, id) \
127 static inline int is_omap ##subclass (void) \
129 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
132 IS_OMAP_CLASS(7xx, 0x07)
133 IS_OMAP_CLASS(15xx, 0x15)
134 IS_OMAP_CLASS(16xx, 0x16)
135 IS_OMAP_CLASS(24xx, 0x24)
136 IS_OMAP_CLASS(34xx, 0x34)
138 IS_OMAP_SUBCLASS(242x, 0x242)
139 IS_OMAP_SUBCLASS(243x, 0x243)
140 IS_OMAP_SUBCLASS(343x, 0x343)
142 #define cpu_is_omap7xx() 0
143 #define cpu_is_omap15xx() 0
144 #define cpu_is_omap16xx() 0
145 #define cpu_is_omap24xx() 0
146 #define cpu_is_omap242x() 0
147 #define cpu_is_omap243x() 0
148 #define cpu_is_omap34xx() 0
149 #define cpu_is_omap343x() 0
151 #if defined(MULTI_OMAP1)
152 # if defined(CONFIG_ARCH_OMAP730)
153 # undef cpu_is_omap7xx
154 # define cpu_is_omap7xx() is_omap7xx()
155 # endif
156 # if defined(CONFIG_ARCH_OMAP15XX)
157 # undef cpu_is_omap15xx
158 # define cpu_is_omap15xx() is_omap15xx()
159 # endif
160 # if defined(CONFIG_ARCH_OMAP16XX)
161 # undef cpu_is_omap16xx
162 # define cpu_is_omap16xx() is_omap16xx()
163 # endif
164 #else
165 # if defined(CONFIG_ARCH_OMAP730)
166 # undef cpu_is_omap7xx
167 # define cpu_is_omap7xx() 1
168 # endif
169 # if defined(CONFIG_ARCH_OMAP15XX)
170 # undef cpu_is_omap15xx
171 # define cpu_is_omap15xx() 1
172 # endif
173 # if defined(CONFIG_ARCH_OMAP16XX)
174 # undef cpu_is_omap16xx
175 # define cpu_is_omap16xx() 1
176 # endif
177 #endif
179 #if defined(MULTI_OMAP2)
180 # if defined(CONFIG_ARCH_OMAP24XX)
181 # undef cpu_is_omap24xx
182 # undef cpu_is_omap242x
183 # undef cpu_is_omap243x
184 # define cpu_is_omap24xx() is_omap24xx()
185 # define cpu_is_omap242x() is_omap242x()
186 # define cpu_is_omap243x() is_omap243x()
187 # endif
188 # if defined(CONFIG_ARCH_OMAP34XX)
189 # undef cpu_is_omap34xx
190 # undef cpu_is_omap343x
191 # define cpu_is_omap34xx() is_omap34xx()
192 # define cpu_is_omap343x() is_omap343x()
193 # endif
194 #else
195 # if defined(CONFIG_ARCH_OMAP24XX)
196 # undef cpu_is_omap24xx
197 # define cpu_is_omap24xx() 1
198 # endif
199 # if defined(CONFIG_ARCH_OMAP2420)
200 # undef cpu_is_omap242x
201 # define cpu_is_omap242x() 1
202 # endif
203 # if defined(CONFIG_ARCH_OMAP2430)
204 # undef cpu_is_omap243x
205 # define cpu_is_omap243x() 1
206 # endif
207 # if defined(CONFIG_ARCH_OMAP34XX)
208 # undef cpu_is_omap34xx
209 # define cpu_is_omap34xx() 1
210 # endif
211 # if defined(CONFIG_ARCH_OMAP3430)
212 # undef cpu_is_omap343x
213 # define cpu_is_omap343x() 1
214 # endif
215 #endif
218 * Macros to detect individual cpu types.
219 * These are only rarely needed.
220 * cpu_is_omap330(): True for OMAP330
221 * cpu_is_omap730(): True for OMAP730
222 * cpu_is_omap1510(): True for OMAP1510
223 * cpu_is_omap1610(): True for OMAP1610
224 * cpu_is_omap1611(): True for OMAP1611
225 * cpu_is_omap5912(): True for OMAP5912
226 * cpu_is_omap1621(): True for OMAP1621
227 * cpu_is_omap1710(): True for OMAP1710
228 * cpu_is_omap2420(): True for OMAP2420
229 * cpu_is_omap2422(): True for OMAP2422
230 * cpu_is_omap2423(): True for OMAP2423
231 * cpu_is_omap2430(): True for OMAP2430
232 * cpu_is_omap3430(): True for OMAP3430
234 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
236 #define IS_OMAP_TYPE(type, id) \
237 static inline int is_omap ##type (void) \
239 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
242 IS_OMAP_TYPE(310, 0x0310)
243 IS_OMAP_TYPE(730, 0x0730)
244 IS_OMAP_TYPE(1510, 0x1510)
245 IS_OMAP_TYPE(1610, 0x1610)
246 IS_OMAP_TYPE(1611, 0x1611)
247 IS_OMAP_TYPE(5912, 0x1611)
248 IS_OMAP_TYPE(1621, 0x1621)
249 IS_OMAP_TYPE(1710, 0x1710)
250 IS_OMAP_TYPE(2420, 0x2420)
251 IS_OMAP_TYPE(2422, 0x2422)
252 IS_OMAP_TYPE(2423, 0x2423)
253 IS_OMAP_TYPE(2430, 0x2430)
254 IS_OMAP_TYPE(3430, 0x3430)
256 #define cpu_is_omap310() 0
257 #define cpu_is_omap730() 0
258 #define cpu_is_omap1510() 0
259 #define cpu_is_omap1610() 0
260 #define cpu_is_omap5912() 0
261 #define cpu_is_omap1611() 0
262 #define cpu_is_omap1621() 0
263 #define cpu_is_omap1710() 0
264 #define cpu_is_omap2420() 0
265 #define cpu_is_omap2422() 0
266 #define cpu_is_omap2423() 0
267 #define cpu_is_omap2430() 0
268 #define cpu_is_omap3430() 0
270 #if defined(MULTI_OMAP1)
271 # if defined(CONFIG_ARCH_OMAP730)
272 # undef cpu_is_omap730
273 # define cpu_is_omap730() is_omap730()
274 # endif
275 #else
276 # if defined(CONFIG_ARCH_OMAP730)
277 # undef cpu_is_omap730
278 # define cpu_is_omap730() 1
279 # endif
280 #endif
283 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
284 * between 330 vs. 1510 and 1611B/5912 vs. 1710.
286 #if defined(CONFIG_ARCH_OMAP15XX)
287 # undef cpu_is_omap310
288 # undef cpu_is_omap1510
289 # define cpu_is_omap310() is_omap310()
290 # define cpu_is_omap1510() is_omap1510()
291 #endif
293 #if defined(CONFIG_ARCH_OMAP16XX)
294 # undef cpu_is_omap1610
295 # undef cpu_is_omap1611
296 # undef cpu_is_omap5912
297 # undef cpu_is_omap1621
298 # undef cpu_is_omap1710
299 # define cpu_is_omap1610() is_omap1610()
300 # define cpu_is_omap1611() is_omap1611()
301 # define cpu_is_omap5912() is_omap5912()
302 # define cpu_is_omap1621() is_omap1621()
303 # define cpu_is_omap1710() is_omap1710()
304 #endif
306 #if defined(CONFIG_ARCH_OMAP24XX)
307 # undef cpu_is_omap2420
308 # undef cpu_is_omap2422
309 # undef cpu_is_omap2423
310 # undef cpu_is_omap2430
311 # define cpu_is_omap2420() is_omap2420()
312 # define cpu_is_omap2422() is_omap2422()
313 # define cpu_is_omap2423() is_omap2423()
314 # define cpu_is_omap2430() is_omap2430()
315 #endif
317 #if defined(CONFIG_ARCH_OMAP34XX)
318 # undef cpu_is_omap3430
319 # define cpu_is_omap3430() is_omap3430()
320 #endif
322 /* Macros to detect if we have OMAP1 or OMAP2 */
323 #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \
324 cpu_is_omap16xx())
325 #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx())
327 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
329 /* Various silicon revisions for omap2 */
330 #define OMAP242X_CLASS 0x24200024
331 #define OMAP2420_REV_ES1_0 0x24200024
332 #define OMAP2420_REV_ES2_0 0x24201024
334 #define OMAP243X_CLASS 0x24300024
335 #define OMAP2430_REV_ES1_0 0x24300024
337 #define OMAP343X_CLASS 0x34300034
338 #define OMAP3430_REV_ES1_0 0x34300034
339 #define OMAP3430_REV_ES2_0 0x34301034
340 #define OMAP3430_REV_ES2_1 0x34302034
341 #define OMAP3430_REV_ES3_0 0x34303034
342 #define OMAP3430_REV_ES3_1 0x34304034
345 * omap_chip bits
347 * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
348 * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
349 * something that is only valid on that particular ES revision.
351 * These bits may be ORed together to indicate structures that are
352 * available on multiple chip types.
354 * To test whether a particular structure matches the current OMAP chip type,
355 * use omap_chip_is().
358 #define CHIP_IS_OMAP2420 (1 << 0)
359 #define CHIP_IS_OMAP2430 (1 << 1)
360 #define CHIP_IS_OMAP3430 (1 << 2)
361 #define CHIP_IS_OMAP3430ES1 (1 << 3)
362 #define CHIP_IS_OMAP3430ES2 (1 << 4)
364 #define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
366 int omap_chip_is(struct omap_chip_id oci);
367 int omap_type(void);
370 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
372 #define OMAP2_DEVICE_TYPE_TEST 0
373 #define OMAP2_DEVICE_TYPE_EMU 1
374 #define OMAP2_DEVICE_TYPE_SEC 2
375 #define OMAP2_DEVICE_TYPE_GP 3
376 #define OMAP2_DEVICE_TYPE_BAD 4
378 void omap2_check_revision(void);
380 #endif /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */
382 #endif