aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/id.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-10-06 08:49:16 -0400
committerTony Lindgren <tony@atomide.com>2008-10-06 08:49:16 -0400
commit0e564848693b06b037ec05e68c9e4b266250789e (patch)
treee73546b541cd03ec6a36b2f82177fca1b171574c /arch/arm/mach-omap2/id.c
parent1835f1d720786138c43147448f4527dd380c1e33 (diff)
ARM: OMAP2: Use omap_globals for CPU detection for multi-omap
This allows to get rid of the ifdefs and will allow simpler CPU detection in the future. Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/id.c')
-rw-r--r--arch/arm/mach-omap2/id.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index e53ebe7d58be..0670c8db010a 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -17,24 +17,15 @@
17 17
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20#include <mach/common.h>
20#include <mach/control.h> 21#include <mach/control.h>
21#include <mach/cpu.h> 22#include <mach/cpu.h>
22 23
23#if defined(CONFIG_ARCH_OMAP2420) 24static u32 class;
24#define TAP_BASE IO_ADDRESS(0x48014000) 25static void __iomem *tap_base;
25#elif defined(CONFIG_ARCH_OMAP2430) 26static u16 tap_prod_id;
26#define TAP_BASE IO_ADDRESS(0x4900A000)
27#elif defined(CONFIG_ARCH_OMAP34XX)
28#define TAP_BASE IO_ADDRESS(0x4830A000)
29#endif
30 27
31#define OMAP_TAP_IDCODE 0x0204 28#define OMAP_TAP_IDCODE 0x0204
32#if defined(CONFIG_ARCH_OMAP34XX)
33#define OMAP_TAP_PROD_ID 0x0210
34#else
35#define OMAP_TAP_PROD_ID 0x0208
36#endif
37
38#define OMAP_TAP_DIE_ID_0 0x0218 29#define OMAP_TAP_DIE_ID_0 0x0218
39#define OMAP_TAP_DIE_ID_1 0x021C 30#define OMAP_TAP_DIE_ID_1 0x021C
40#define OMAP_TAP_DIE_ID_2 0x0220 31#define OMAP_TAP_DIE_ID_2 0x0220
@@ -93,18 +84,24 @@ static u32 __init read_tap_reg(int reg)
93 * it means its Cortex r0p0 which is 3430 ES1 84 * it means its Cortex r0p0 which is 3430 ES1
94 */ 85 */
95 if ((((cpuid >> 4) & 0xFFF) == 0xC08) && ((cpuid & 0xF) == 0x0)) { 86 if ((((cpuid >> 4) & 0xFFF) == 0xC08) && ((cpuid & 0xF) == 0x0)) {
87
88 if (reg == tap_prod_id) {
89 regval = 0x000F00F0;
90 goto out;
91 }
92
96 switch (reg) { 93 switch (reg) {
97 case OMAP_TAP_IDCODE : regval = 0x0B7AE02F; break; 94 case OMAP_TAP_IDCODE : regval = 0x0B7AE02F; break;
98 /* Making DevType as 0xF in ES1 to differ from ES2 */ 95 /* Making DevType as 0xF in ES1 to differ from ES2 */
99 case OMAP_TAP_PROD_ID : regval = 0x000F00F0; break;
100 case OMAP_TAP_DIE_ID_0: regval = 0x01000000; break; 96 case OMAP_TAP_DIE_ID_0: regval = 0x01000000; break;
101 case OMAP_TAP_DIE_ID_1: regval = 0x1012d687; break; 97 case OMAP_TAP_DIE_ID_1: regval = 0x1012d687; break;
102 case OMAP_TAP_DIE_ID_2: regval = 0x00000000; break; 98 case OMAP_TAP_DIE_ID_2: regval = 0x00000000; break;
103 case OMAP_TAP_DIE_ID_3: regval = 0x2d2c0000; break; 99 case OMAP_TAP_DIE_ID_3: regval = 0x2d2c0000; break;
104 } 100 }
105 } else 101 } else
106 regval = __raw_readl(TAP_BASE + reg); 102 regval = __raw_readl(tap_base + reg);
107 103
104out:
108 return regval; 105 return regval;
109 106
110} 107}
@@ -203,7 +200,7 @@ void __init omap2_check_revision(void)
203 u8 rev; 200 u8 rev;
204 201
205 idcode = read_tap_reg(OMAP_TAP_IDCODE); 202 idcode = read_tap_reg(OMAP_TAP_IDCODE);
206 prod_id = read_tap_reg(OMAP_TAP_PROD_ID); 203 prod_id = read_tap_reg(tap_prod_id);
207 hawkeye = (idcode >> 12) & 0xffff; 204 hawkeye = (idcode >> 12) & 0xffff;
208 rev = (idcode >> 28) & 0x0f; 205 rev = (idcode >> 28) & 0x0f;
209 dev_type = (prod_id >> 16) & 0x0f; 206 dev_type = (prod_id >> 16) & 0x0f;
@@ -268,3 +265,13 @@ void __init omap2_check_revision(void)
268 265
269} 266}
270 267
268void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
269{
270 class = omap2_globals->class;
271 tap_base = omap2_globals->tap;
272
273 if (class == 0x3430)
274 tap_prod_id = 0x0210;
275 else
276 tap_prod_id = 0x0208;
277}