aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/include/mach
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-12-10 20:36:30 -0500
committerTony Lindgren <tony@atomide.com>2008-12-10 20:36:30 -0500
commita88231430384f49bebf8a6ec607a9eb4f2254e34 (patch)
treea95be27edce50fece9cbc434e770806e49453ae7 /arch/arm/plat-omap/include/mach
parent5ba02dcab945dc0bcde7df0c5958329f34bd04ae (diff)
ARM: OMAP2: Fix cpu detection
At some point omap2 changed the bits for GET_OMAP_CLASS, which broke 15xx detection on 730 as noticed by Russell King. This patch fixes omap2 cpu detection to respect the original GET_OMAP_CLASS, and simplifies the detection for 34xx. Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/include/mach')
-rw-r--r--arch/arm/plat-omap/include/mach/cpu.h76
1 files changed, 25 insertions, 51 deletions
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h
index e0464187209d..4325bbc97477 100644
--- a/arch/arm/plat-omap/include/mach/cpu.h
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -28,14 +28,19 @@
28 28
29struct omap_chip_id { 29struct omap_chip_id {
30 u8 oc; 30 u8 oc;
31 u8 type;
31}; 32};
32 33
33#define OMAP_CHIP_INIT(x) { .oc = x } 34#define OMAP_CHIP_INIT(x) { .oc = x }
34 35
36/*
37 * system_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]
41 */
35extern unsigned int system_rev; 42extern unsigned int system_rev;
36 43
37#define omap2_cpu_rev() ((system_rev >> 12) & 0x0f)
38
39/* 44/*
40 * Test if multicore OMAP support is needed 45 * Test if multicore OMAP support is needed
41 */ 46 */
@@ -108,7 +113,7 @@ extern unsigned int system_rev;
108 * cpu_is_omap243x(): True for OMAP2430 113 * cpu_is_omap243x(): True for OMAP2430
109 * cpu_is_omap343x(): True for OMAP3430 114 * cpu_is_omap343x(): True for OMAP3430
110 */ 115 */
111#define GET_OMAP_CLASS ((system_rev >> 24) & 0xff) 116#define GET_OMAP_CLASS (system_rev & 0xff)
112 117
113#define IS_OMAP_CLASS(class, id) \ 118#define IS_OMAP_CLASS(class, id) \
114static inline int is_omap ##class (void) \ 119static inline int is_omap ##class (void) \
@@ -320,44 +325,20 @@ IS_OMAP_TYPE(3430, 0x3430)
320#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) 325#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx())
321 326
322#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 327#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
323/*
324 * Macros to detect silicon revision of OMAP2/3 processors.
325 * is_sil_rev_greater_than: true if passed cpu type & its rev is greater.
326 * is_sil_rev_lesser_than: true if passed cpu type & its rev is lesser.
327 * is_sil_rev_equal_to: true if passed cpu type & its rev is equal.
328 * get_sil_rev: return the silicon rev value.
329 */
330#define get_sil_omap_type(rev) ((rev & 0xffff0000) >> 16)
331#define get_sil_revision(rev) ((rev & 0x0000f000) >> 12)
332 328
333#define is_sil_rev_greater_than(rev) \ 329/* Various silicon revisions for omap2 */
334 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ 330#define OMAP242X_CLASS 0x24200024
335 (get_sil_revision(system_rev) > get_sil_revision(rev))) 331#define OMAP2420_REV_ES1_0 0x24200024
332#define OMAP2420_REV_ES2_0 0x24201024
336 333
337#define is_sil_rev_less_than(rev) \ 334#define OMAP243X_CLASS 0x24300024
338 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ 335#define OMAP2430_REV_ES1_0 0x24300024
339 (get_sil_revision(system_rev) < get_sil_revision(rev)))
340 336
341#define is_sil_rev_equal_to(rev) \ 337#define OMAP343X_CLASS 0x34300034
342 ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ 338#define OMAP3430_REV_ES1_0 0x34300034
343 (get_sil_revision(system_rev) == get_sil_revision(rev))) 339#define OMAP3430_REV_ES2_0 0x34301034
344 340#define OMAP3430_REV_ES2_1 0x34302034
345#define get_sil_rev() \ 341#define OMAP3430_REV_ES3_0 0x34303034
346 get_sil_revision(system_rev)
347
348/* Various silicon macros defined here */
349#define OMAP242X_CLASS 0x24200000
350#define OMAP2420_REV_ES1_0 0x24200000
351#define OMAP2420_REV_ES2_0 0x24201000
352
353#define OMAP243X_CLASS 0x24300000
354#define OMAP2430_REV_ES1_0 0x24300000
355
356#define OMAP343X_CLASS 0x34300000
357#define OMAP3430_REV_ES1_0 0x34300000
358#define OMAP3430_REV_ES2_0 0x34301000
359#define OMAP3430_REV_ES2_1 0x34302000
360#define OMAP3430_REV_ES2_2 0x34303000
361 342
362/* 343/*
363 * omap_chip bits 344 * omap_chip bits
@@ -382,23 +363,16 @@ IS_OMAP_TYPE(3430, 0x3430)
382#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) 363#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
383 364
384int omap_chip_is(struct omap_chip_id oci); 365int omap_chip_is(struct omap_chip_id oci);
385 366int omap_type(void);
386 367
387/* 368/*
388 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD 369 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
389 */ 370 */
390#define DEVICE_TYPE_TEST 0 371#define OMAP2_DEVICE_TYPE_TEST 0
391#define DEVICE_TYPE_EMU 1 372#define OMAP2_DEVICE_TYPE_EMU 1
392#define DEVICE_TYPE_SEC 2 373#define OMAP2_DEVICE_TYPE_SEC 2
393#define DEVICE_TYPE_GP 3 374#define OMAP2_DEVICE_TYPE_GP 3
394#define DEVICE_TYPE_BAD 4 375#define OMAP2_DEVICE_TYPE_BAD 4
395
396#define get_device_type() ((system_rev & 0x700) >> 8)
397#define is_device_type_test() (get_device_type() == DEVICE_TYPE_TEST)
398#define is_device_type_emu() (get_device_type() == DEVICE_TYPE_EMU)
399#define is_device_type_sec() (get_device_type() == DEVICE_TYPE_SEC)
400#define is_device_type_gp() (get_device_type() == DEVICE_TYPE_GP)
401#define is_device_type_bad() (get_device_type() == DEVICE_TYPE_BAD)
402 376
403void omap2_check_revision(void); 377void omap2_check_revision(void);
404 378