diff options
author | Syed Mohammed Khasim <x0khasim@ti.com> | 2007-12-04 18:38:13 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-02-08 13:37:58 -0500 |
commit | 2c17f61599987ca7c54c2fef57de3bb8c32e3599 (patch) | |
tree | b65ec883f7fc81016d1a6dd058604ae3ff75fb27 | |
parent | 1cccd2a728673da00a05fe19c5ba4897257d6b8a (diff) |
ARM: OMAP: Add 3430 CPU identification macros
This patch adds omap3430 CPU identification macros.
Silicon revision check macros added by Girish S G <girishsg@ti.com>.
CPU identification macro and silicon revision check macros
cleaned up by Paul Walmsley <paul@pwsan.com>.
Signed-off-by: Syed Mohammed Khasim <x0khasim@ti.com>
Signed-off-by: Girish S G <girishsg@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | include/asm-arm/arch-omap/cpu.h | 127 |
1 files changed, 121 insertions, 6 deletions
diff --git a/include/asm-arm/arch-omap/cpu.h b/include/asm-arm/arch-omap/cpu.h index ec7eb675d922..e8a4cf52778b 100644 --- a/include/asm-arm/arch-omap/cpu.h +++ b/include/asm-arm/arch-omap/cpu.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | extern unsigned int system_rev; | 29 | extern unsigned int system_rev; |
30 | 30 | ||
31 | #define omap2_cpu_rev() ((system_rev >> 8) & 0x0f) | 31 | #define omap2_cpu_rev() ((system_rev >> 12) & 0x0f) |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * Test if multicore OMAP support is needed | 34 | * Test if multicore OMAP support is needed |
@@ -61,12 +61,33 @@ extern unsigned int system_rev; | |||
61 | # define OMAP_NAME omap16xx | 61 | # define OMAP_NAME omap16xx |
62 | # endif | 62 | # endif |
63 | #endif | 63 | #endif |
64 | #ifdef CONFIG_ARCH_OMAP24XX | 64 | #if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)) |
65 | # if (defined(OMAP_NAME) || defined(MULTI_OMAP1)) | 65 | # if (defined(OMAP_NAME) || defined(MULTI_OMAP1)) |
66 | # error "OMAP1 and OMAP2 can't be selected at the same time" | 66 | # error "OMAP1 and OMAP2 can't be selected at the same time" |
67 | # endif | ||
68 | #endif | ||
69 | #ifdef CONFIG_ARCH_OMAP2420 | ||
70 | # ifdef OMAP_NAME | ||
71 | # undef MULTI_OMAP2 | ||
72 | # define MULTI_OMAP2 | ||
67 | # else | 73 | # else |
74 | # define OMAP_NAME omap2420 | ||
75 | # endif | ||
76 | #endif | ||
77 | #ifdef CONFIG_ARCH_OMAP2430 | ||
78 | # ifdef OMAP_NAME | ||
79 | # undef MULTI_OMAP2 | ||
80 | # define MULTI_OMAP2 | ||
81 | # else | ||
82 | # define OMAP_NAME omap2430 | ||
83 | # endif | ||
84 | #endif | ||
85 | #ifdef CONFIG_ARCH_OMAP3430 | ||
86 | # ifdef OMAP_NAME | ||
68 | # undef MULTI_OMAP2 | 87 | # undef MULTI_OMAP2 |
69 | # define OMAP_NAME omap24xx | 88 | # define MULTI_OMAP2 |
89 | # else | ||
90 | # define OMAP_NAME omap3430 | ||
70 | # endif | 91 | # endif |
71 | #endif | 92 | #endif |
72 | 93 | ||
@@ -79,8 +100,9 @@ extern unsigned int system_rev; | |||
79 | * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 | 100 | * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 |
80 | * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 | 101 | * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 |
81 | * cpu_is_omap243x(): True for OMAP2430 | 102 | * cpu_is_omap243x(): True for OMAP2430 |
103 | * cpu_is_omap343x(): True for OMAP3430 | ||
82 | */ | 104 | */ |
83 | #define GET_OMAP_CLASS (system_rev & 0xff) | 105 | #define GET_OMAP_CLASS ((system_rev >> 24) & 0xff) |
84 | 106 | ||
85 | #define IS_OMAP_CLASS(class, id) \ | 107 | #define IS_OMAP_CLASS(class, id) \ |
86 | static inline int is_omap ##class (void) \ | 108 | static inline int is_omap ##class (void) \ |
@@ -100,9 +122,11 @@ IS_OMAP_CLASS(7xx, 0x07) | |||
100 | IS_OMAP_CLASS(15xx, 0x15) | 122 | IS_OMAP_CLASS(15xx, 0x15) |
101 | IS_OMAP_CLASS(16xx, 0x16) | 123 | IS_OMAP_CLASS(16xx, 0x16) |
102 | IS_OMAP_CLASS(24xx, 0x24) | 124 | IS_OMAP_CLASS(24xx, 0x24) |
125 | IS_OMAP_CLASS(34xx, 0x34) | ||
103 | 126 | ||
104 | IS_OMAP_SUBCLASS(242x, 0x242) | 127 | IS_OMAP_SUBCLASS(242x, 0x242) |
105 | IS_OMAP_SUBCLASS(243x, 0x243) | 128 | IS_OMAP_SUBCLASS(243x, 0x243) |
129 | IS_OMAP_SUBCLASS(343x, 0x343) | ||
106 | 130 | ||
107 | #define cpu_is_omap7xx() 0 | 131 | #define cpu_is_omap7xx() 0 |
108 | #define cpu_is_omap15xx() 0 | 132 | #define cpu_is_omap15xx() 0 |
@@ -110,6 +134,8 @@ IS_OMAP_SUBCLASS(243x, 0x243) | |||
110 | #define cpu_is_omap24xx() 0 | 134 | #define cpu_is_omap24xx() 0 |
111 | #define cpu_is_omap242x() 0 | 135 | #define cpu_is_omap242x() 0 |
112 | #define cpu_is_omap243x() 0 | 136 | #define cpu_is_omap243x() 0 |
137 | #define cpu_is_omap34xx() 0 | ||
138 | #define cpu_is_omap343x() 0 | ||
113 | 139 | ||
114 | #if defined(MULTI_OMAP1) | 140 | #if defined(MULTI_OMAP1) |
115 | # if defined(CONFIG_ARCH_OMAP730) | 141 | # if defined(CONFIG_ARCH_OMAP730) |
@@ -137,14 +163,44 @@ IS_OMAP_SUBCLASS(243x, 0x243) | |||
137 | # undef cpu_is_omap16xx | 163 | # undef cpu_is_omap16xx |
138 | # define cpu_is_omap16xx() 1 | 164 | # define cpu_is_omap16xx() 1 |
139 | # endif | 165 | # endif |
166 | #endif | ||
167 | |||
168 | #if defined(MULTI_OMAP2) | ||
140 | # if defined(CONFIG_ARCH_OMAP24XX) | 169 | # if defined(CONFIG_ARCH_OMAP24XX) |
141 | # undef cpu_is_omap24xx | 170 | # undef cpu_is_omap24xx |
142 | # undef cpu_is_omap242x | 171 | # undef cpu_is_omap242x |
143 | # undef cpu_is_omap243x | 172 | # undef cpu_is_omap243x |
144 | # define cpu_is_omap24xx() 1 | 173 | # define cpu_is_omap24xx() is_omap24xx() |
145 | # define cpu_is_omap242x() is_omap242x() | 174 | # define cpu_is_omap242x() is_omap242x() |
146 | # define cpu_is_omap243x() is_omap243x() | 175 | # define cpu_is_omap243x() is_omap243x() |
147 | # endif | 176 | # endif |
177 | # if defined(CONFIG_ARCH_OMAP34XX) | ||
178 | # undef cpu_is_omap34xx | ||
179 | # undef cpu_is_omap343x | ||
180 | # define cpu_is_omap34xx() is_omap34xx() | ||
181 | # define cpu_is_omap343x() is_omap343x() | ||
182 | # endif | ||
183 | #else | ||
184 | # if defined(CONFIG_ARCH_OMAP24XX) | ||
185 | # undef cpu_is_omap24xx | ||
186 | # define cpu_is_omap24xx() 1 | ||
187 | # endif | ||
188 | # if defined(CONFIG_ARCH_OMAP2420) | ||
189 | # undef cpu_is_omap242x | ||
190 | # define cpu_is_omap242x() 1 | ||
191 | # endif | ||
192 | # if defined(CONFIG_ARCH_OMAP2430) | ||
193 | # undef cpu_is_omap243x | ||
194 | # define cpu_is_omap243x() 1 | ||
195 | # endif | ||
196 | # if defined(CONFIG_ARCH_OMAP34XX) | ||
197 | # undef cpu_is_omap34xx | ||
198 | # define cpu_is_omap34xx() 1 | ||
199 | # endif | ||
200 | # if defined(CONFIG_ARCH_OMAP3430) | ||
201 | # undef cpu_is_omap343x | ||
202 | # define cpu_is_omap343x() 1 | ||
203 | # endif | ||
148 | #endif | 204 | #endif |
149 | 205 | ||
150 | /* | 206 | /* |
@@ -162,6 +218,7 @@ IS_OMAP_SUBCLASS(243x, 0x243) | |||
162 | * cpu_is_omap2422(): True for OMAP2422 | 218 | * cpu_is_omap2422(): True for OMAP2422 |
163 | * cpu_is_omap2423(): True for OMAP2423 | 219 | * cpu_is_omap2423(): True for OMAP2423 |
164 | * cpu_is_omap2430(): True for OMAP2430 | 220 | * cpu_is_omap2430(): True for OMAP2430 |
221 | * cpu_is_omap3430(): True for OMAP3430 | ||
165 | */ | 222 | */ |
166 | #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) | 223 | #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) |
167 | 224 | ||
@@ -183,6 +240,7 @@ IS_OMAP_TYPE(2420, 0x2420) | |||
183 | IS_OMAP_TYPE(2422, 0x2422) | 240 | IS_OMAP_TYPE(2422, 0x2422) |
184 | IS_OMAP_TYPE(2423, 0x2423) | 241 | IS_OMAP_TYPE(2423, 0x2423) |
185 | IS_OMAP_TYPE(2430, 0x2430) | 242 | IS_OMAP_TYPE(2430, 0x2430) |
243 | IS_OMAP_TYPE(3430, 0x3430) | ||
186 | 244 | ||
187 | #define cpu_is_omap310() 0 | 245 | #define cpu_is_omap310() 0 |
188 | #define cpu_is_omap730() 0 | 246 | #define cpu_is_omap730() 0 |
@@ -196,6 +254,7 @@ IS_OMAP_TYPE(2430, 0x2430) | |||
196 | #define cpu_is_omap2422() 0 | 254 | #define cpu_is_omap2422() 0 |
197 | #define cpu_is_omap2423() 0 | 255 | #define cpu_is_omap2423() 0 |
198 | #define cpu_is_omap2430() 0 | 256 | #define cpu_is_omap2430() 0 |
257 | #define cpu_is_omap3430() 0 | ||
199 | 258 | ||
200 | #if defined(MULTI_OMAP1) | 259 | #if defined(MULTI_OMAP1) |
201 | # if defined(CONFIG_ARCH_OMAP730) | 260 | # if defined(CONFIG_ARCH_OMAP730) |
@@ -244,9 +303,65 @@ IS_OMAP_TYPE(2430, 0x2430) | |||
244 | # define cpu_is_omap2430() is_omap2430() | 303 | # define cpu_is_omap2430() is_omap2430() |
245 | #endif | 304 | #endif |
246 | 305 | ||
306 | #if defined(CONFIG_ARCH_OMAP34XX) | ||
307 | # undef cpu_is_omap3430 | ||
308 | # define cpu_is_omap3430() is_omap3430() | ||
309 | #endif | ||
310 | |||
247 | /* Macros to detect if we have OMAP1 or OMAP2 */ | 311 | /* Macros to detect if we have OMAP1 or OMAP2 */ |
248 | #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \ | 312 | #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \ |
249 | cpu_is_omap16xx()) | 313 | cpu_is_omap16xx()) |
250 | #define cpu_class_is_omap2() cpu_is_omap24xx() | 314 | #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) |
315 | |||
316 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | ||
317 | /* | ||
318 | * Macros to detect silicon revision of OMAP2/3 processors. | ||
319 | * is_sil_rev_greater_than: true if passed cpu type & its rev is greater. | ||
320 | * is_sil_rev_lesser_than: true if passed cpu type & its rev is lesser. | ||
321 | * is_sil_rev_equal_to: true if passed cpu type & its rev is equal. | ||
322 | * get_sil_rev: return the silicon rev value. | ||
323 | */ | ||
324 | #define get_sil_omap_type(rev) ((rev & 0xffff0000) >> 16) | ||
325 | #define get_sil_revision(rev) ((rev & 0x0000f000) >> 12) | ||
326 | |||
327 | #define is_sil_rev_greater_than(rev) \ | ||
328 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ | ||
329 | (get_sil_revision(system_rev) > get_sil_revision(rev))) | ||
330 | |||
331 | #define is_sil_rev_less_than(rev) \ | ||
332 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ | ||
333 | (get_sil_revision(system_rev) < get_sil_revision(rev))) | ||
334 | |||
335 | #define is_sil_rev_equal_to(rev) \ | ||
336 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ | ||
337 | (get_sil_revision(system_rev) == get_sil_revision(rev))) | ||
338 | |||
339 | #define get_sil_rev() \ | ||
340 | get_sil_revision(system_rev) | ||
341 | |||
342 | /* Various silicon macros defined here */ | ||
343 | #define OMAP2420_REV_ES1_0 0x24200000 | ||
344 | #define OMAP2420_REV_ES2_0 0x24201000 | ||
345 | #define OMAP2430_REV_ES1_0 0x24300000 | ||
346 | #define OMAP3430_REV_ES1_0 0x34300000 | ||
347 | #define OMAP3430_REV_ES2_0 0x34301000 | ||
348 | |||
349 | /* | ||
350 | * Macro to detect device type i.e. EMU/HS/TST/GP/BAD | ||
351 | */ | ||
352 | #define DEVICE_TYPE_TEST 0 | ||
353 | #define DEVICE_TYPE_EMU 1 | ||
354 | #define DEVICE_TYPE_SEC 2 | ||
355 | #define DEVICE_TYPE_GP 3 | ||
356 | #define DEVICE_TYPE_BAD 4 | ||
357 | |||
358 | #define get_device_type() ((system_rev & 0x700) >> 8) | ||
359 | #define is_device_type_test() (get_device_type() == DEVICE_TYPE_TEST) | ||
360 | #define is_device_type_emu() (get_device_type() == DEVICE_TYPE_EMU) | ||
361 | #define is_device_type_sec() (get_device_type() == DEVICE_TYPE_SEC) | ||
362 | #define is_device_type_gp() (get_device_type() == DEVICE_TYPE_GP) | ||
363 | #define is_device_type_bad() (get_device_type() == DEVICE_TYPE_BAD) | ||
364 | |||
365 | #endif | ||
251 | 366 | ||
252 | #endif | 367 | #endif |