aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
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
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')
-rw-r--r--arch/arm/mach-omap2/id.c39
-rw-r--r--arch/arm/plat-omap/common.c4
-rw-r--r--arch/arm/plat-omap/include/mach/common.h2
-rw-r--r--arch/arm/plat-omap/include/mach/cpu.h5
4 files changed, 34 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}
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 20e8db5fe32a..e3143fe9cb29 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -248,6 +248,7 @@ static struct omap_globals *omap2_globals;
248 248
249static void __init __omap2_set_globals(void) 249static void __init __omap2_set_globals(void)
250{ 250{
251 omap2_set_globals_tap(omap2_globals);
251 omap2_set_globals_memory(omap2_globals); 252 omap2_set_globals_memory(omap2_globals);
252 omap2_set_globals_control(omap2_globals); 253 omap2_set_globals_control(omap2_globals);
253 omap2_set_globals_prcm(omap2_globals); 254 omap2_set_globals_prcm(omap2_globals);
@@ -258,6 +259,7 @@ static void __init __omap2_set_globals(void)
258#if defined(CONFIG_ARCH_OMAP2420) 259#if defined(CONFIG_ARCH_OMAP2420)
259 260
260static struct omap_globals omap242x_globals = { 261static struct omap_globals omap242x_globals = {
262 .class = OMAP242X_CLASS,
261 .tap = OMAP2_IO_ADDRESS(0x48014000), 263 .tap = OMAP2_IO_ADDRESS(0x48014000),
262 .sdrc = OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE), 264 .sdrc = OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE),
263 .sms = OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE), 265 .sms = OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE),
@@ -276,6 +278,7 @@ void __init omap2_set_globals_242x(void)
276#if defined(CONFIG_ARCH_OMAP2430) 278#if defined(CONFIG_ARCH_OMAP2430)
277 279
278static struct omap_globals omap243x_globals = { 280static struct omap_globals omap243x_globals = {
281 .class = OMAP243X_CLASS,
279 .tap = OMAP2_IO_ADDRESS(0x4900a000), 282 .tap = OMAP2_IO_ADDRESS(0x4900a000),
280 .sdrc = OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE), 283 .sdrc = OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE),
281 .sms = OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE), 284 .sms = OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE),
@@ -294,6 +297,7 @@ void __init omap2_set_globals_243x(void)
294#if defined(CONFIG_ARCH_OMAP3430) 297#if defined(CONFIG_ARCH_OMAP3430)
295 298
296static struct omap_globals omap343x_globals = { 299static struct omap_globals omap343x_globals = {
300 .class = OMAP343X_CLASS,
297 .tap = OMAP2_IO_ADDRESS(0x4830A000), 301 .tap = OMAP2_IO_ADDRESS(0x4830A000),
298 .sdrc = OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE), 302 .sdrc = OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE),
299 .sms = OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE), 303 .sms = OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE),
diff --git a/arch/arm/plat-omap/include/mach/common.h b/arch/arm/plat-omap/include/mach/common.h
index 515c6286582c..ef70e2b0f054 100644
--- a/arch/arm/plat-omap/include/mach/common.h
+++ b/arch/arm/plat-omap/include/mach/common.h
@@ -50,6 +50,7 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
50 50
51/* IO bases for various OMAP processors */ 51/* IO bases for various OMAP processors */
52struct omap_globals { 52struct omap_globals {
53 u32 class; /* OMAP class to detect */
53 void __iomem *tap; /* Control module ID code */ 54 void __iomem *tap; /* Control module ID code */
54 void __iomem *sdrc; /* SDRAM Controller */ 55 void __iomem *sdrc; /* SDRAM Controller */
55 void __iomem *sms; /* SDRAM Memory Scheduler */ 56 void __iomem *sms; /* SDRAM Memory Scheduler */
@@ -63,6 +64,7 @@ void omap2_set_globals_243x(void);
63void omap2_set_globals_343x(void); 64void omap2_set_globals_343x(void);
64 65
65/* These get called from omap2_set_globals_xxxx(), do not call these */ 66/* These get called from omap2_set_globals_xxxx(), do not call these */
67void omap2_set_globals_tap(struct omap_globals *);
66void omap2_set_globals_memory(struct omap_globals *); 68void omap2_set_globals_memory(struct omap_globals *);
67void omap2_set_globals_control(struct omap_globals *); 69void omap2_set_globals_control(struct omap_globals *);
68void omap2_set_globals_prcm(struct omap_globals *); 70void omap2_set_globals_prcm(struct omap_globals *);
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h
index 05aee0eda34f..e0464187209d 100644
--- a/arch/arm/plat-omap/include/mach/cpu.h
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -346,9 +346,14 @@ IS_OMAP_TYPE(3430, 0x3430)
346 get_sil_revision(system_rev) 346 get_sil_revision(system_rev)
347 347
348/* Various silicon macros defined here */ 348/* Various silicon macros defined here */
349#define OMAP242X_CLASS 0x24200000
349#define OMAP2420_REV_ES1_0 0x24200000 350#define OMAP2420_REV_ES1_0 0x24200000
350#define OMAP2420_REV_ES2_0 0x24201000 351#define OMAP2420_REV_ES2_0 0x24201000
352
353#define OMAP243X_CLASS 0x24300000
351#define OMAP2430_REV_ES1_0 0x24300000 354#define OMAP2430_REV_ES1_0 0x24300000
355
356#define OMAP343X_CLASS 0x34300000
352#define OMAP3430_REV_ES1_0 0x34300000 357#define OMAP3430_REV_ES1_0 0x34300000
353#define OMAP3430_REV_ES2_0 0x34301000 358#define OMAP3430_REV_ES2_0 0x34301000
354#define OMAP3430_REV_ES2_1 0x34302000 359#define OMAP3430_REV_ES2_1 0x34302000