aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Leukkunen <lauri.leukkunen@nokia.com>2008-12-10 20:36:31 -0500
committerTony Lindgren <tony@atomide.com>2008-12-10 20:36:31 -0500
commit84a34344ea1f2f313d84a9fb4cb685b65a6ec26d (patch)
treedb657e72e0be439f4d0baab660e2d46320f02374
parenta88231430384f49bebf8a6ec607a9eb4f2254e34 (diff)
ARM: OMAP2: Use omap_rev() instead of system_rev
system_rev is meant for board revision, this patch changes all relevant instances to use the new omap_rev() function liberating system_rev to be used with ATAG_REVISION as it has been designed. Signed-off-by: Lauri Leukkunen <lauri.leukkunen@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap1/id.c50
-rw-r--r--arch/arm/mach-omap1/pm.c6
-rw-r--r--arch/arm/mach-omap2/clock34xx.c2
-rw-r--r--arch/arm/mach-omap2/id.c34
-rw-r--r--arch/arm/plat-omap/include/mach/board-apollon.h4
-rw-r--r--arch/arm/plat-omap/include/mach/cpu.h10
-rw-r--r--arch/arm/plat-omap/sram.c3
7 files changed, 66 insertions, 43 deletions
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index d6110fe04f2f..89bb8756f450 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <mach/cpu.h>
18 19
19#define OMAP_DIE_ID_0 0xfffe1800 20#define OMAP_DIE_ID_0 0xfffe1800
20#define OMAP_DIE_ID_1 0xfffe1804 21#define OMAP_DIE_ID_1 0xfffe1804
@@ -30,6 +31,8 @@ struct omap_id {
30 u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */ 31 u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */
31}; 32};
32 33
34static unsigned int omap_revision;
35
33/* Register values to detect the OMAP version */ 36/* Register values to detect the OMAP version */
34static struct omap_id omap_ids[] __initdata = { 37static struct omap_id omap_ids[] __initdata = {
35 { .jtag_id = 0xb574, .die_rev = 0x2, .omap_id = 0x03310315, .type = 0x03100000}, 38 { .jtag_id = 0xb574, .die_rev = 0x2, .omap_id = 0x03310315, .type = 0x03100000},
@@ -53,6 +56,12 @@ static struct omap_id omap_ids[] __initdata = {
53 { .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000}, 56 { .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000},
54}; 57};
55 58
59unsigned int omap_rev(void)
60{
61 return omap_revision;
62}
63EXPORT_SYMBOL(omap_rev);
64
56/* 65/*
57 * Get OMAP type from PROD_ID. 66 * Get OMAP type from PROD_ID.
58 * 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM. 67 * 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM.
@@ -121,17 +130,18 @@ void __init omap_check_revision(void)
121 omap_id = omap_readl(OMAP32_ID_0); 130 omap_id = omap_readl(OMAP32_ID_0);
122 131
123#ifdef DEBUG 132#ifdef DEBUG
124 printk("OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0)); 133 printk(KERN_DEBUG "OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0));
125 printk("OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n", 134 printk(KERN_DEBUG "OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n",
126 omap_readl(OMAP_DIE_ID_1), 135 omap_readl(OMAP_DIE_ID_1),
127 (omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf); 136 (omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf);
128 printk("OMAP_PRODUCTION_ID_0: 0x%08x\n", omap_readl(OMAP_PRODUCTION_ID_0)); 137 printk(KERN_DEBUG "OMAP_PRODUCTION_ID_0: 0x%08x\n",
129 printk("OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n", 138 omap_readl(OMAP_PRODUCTION_ID_0));
139 printk(KERN_DEBUG "OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n",
130 omap_readl(OMAP_PRODUCTION_ID_1), 140 omap_readl(OMAP_PRODUCTION_ID_1),
131 omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff); 141 omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff);
132 printk("OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0)); 142 printk(KERN_DEBUG "OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0));
133 printk("OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1)); 143 printk(KERN_DEBUG "OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1));
134 printk("JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev); 144 printk(KERN_DEBUG "JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev);
135#endif 145#endif
136 146
137 system_serial_high = omap_readl(OMAP_DIE_ID_0); 147 system_serial_high = omap_readl(OMAP_DIE_ID_0);
@@ -140,7 +150,7 @@ void __init omap_check_revision(void)
140 /* First check only the major version in a safe way */ 150 /* First check only the major version in a safe way */
141 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) { 151 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
142 if (jtag_id == (omap_ids[i].jtag_id)) { 152 if (jtag_id == (omap_ids[i].jtag_id)) {
143 system_rev = omap_ids[i].type; 153 omap_revision = omap_ids[i].type;
144 break; 154 break;
145 } 155 }
146 } 156 }
@@ -148,7 +158,7 @@ void __init omap_check_revision(void)
148 /* Check if we can find the die revision */ 158 /* Check if we can find the die revision */
149 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) { 159 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
150 if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) { 160 if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) {
151 system_rev = omap_ids[i].type; 161 omap_revision = omap_ids[i].type;
152 break; 162 break;
153 } 163 }
154 } 164 }
@@ -158,35 +168,35 @@ void __init omap_check_revision(void)
158 if (jtag_id == omap_ids[i].jtag_id 168 if (jtag_id == omap_ids[i].jtag_id
159 && die_rev == omap_ids[i].die_rev 169 && die_rev == omap_ids[i].die_rev
160 && omap_id == omap_ids[i].omap_id) { 170 && omap_id == omap_ids[i].omap_id) {
161 system_rev = omap_ids[i].type; 171 omap_revision = omap_ids[i].type;
162 break; 172 break;
163 } 173 }
164 } 174 }
165 175
166 /* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */ 176 /* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */
167 cpu_type = system_rev >> 24; 177 cpu_type = omap_revision >> 24;
168 178
169 switch (cpu_type) { 179 switch (cpu_type) {
170 case 0x07: 180 case 0x07:
171 system_rev |= 0x07; 181 omap_revision |= 0x07;
172 break; 182 break;
173 case 0x03: 183 case 0x03:
174 case 0x15: 184 case 0x15:
175 system_rev |= 0x15; 185 omap_revision |= 0x15;
176 break; 186 break;
177 case 0x16: 187 case 0x16:
178 case 0x17: 188 case 0x17:
179 system_rev |= 0x16; 189 omap_revision |= 0x16;
180 break; 190 break;
181 default: 191 default:
182 printk("Unknown OMAP cpu type: 0x%02x\n", cpu_type); 192 printk(KERN_INFO "Unknown OMAP cpu type: 0x%02x\n", cpu_type);
183 } 193 }
184 194
185 printk("OMAP%04x", system_rev >> 16); 195 printk(KERN_INFO "OMAP%04x", omap_revision >> 16);
186 if ((system_rev >> 8) & 0xff) 196 if ((omap_revision >> 8) & 0xff)
187 printk("%x", (system_rev >> 8) & 0xff); 197 printk(KERN_INFO "%x", (omap_revision >> 8) & 0xff);
188 printk(" revision %i handled as %02xxx id: %08x%08x\n", 198 printk(KERN_INFO " revision %i handled as %02xxx id: %08x%08x\n",
189 die_rev, system_rev & 0xff, system_serial_low, 199 die_rev, omap_revision & 0xff, system_serial_low,
190 system_serial_high); 200 system_serial_high);
191} 201}
192 202
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 770d256c790b..9774c1f5311e 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -226,7 +226,8 @@ void omap_pm_suspend(void)
226{ 226{
227 unsigned long arg0 = 0, arg1 = 0; 227 unsigned long arg0 = 0, arg1 = 0;
228 228
229 printk("PM: OMAP%x is trying to enter deep sleep...\n", system_rev); 229 printk(KERN_INFO "PM: OMAP%x is trying to enter deep sleep...\n",
230 omap_rev());
230 231
231 omap_serial_wake_trigger(1); 232 omap_serial_wake_trigger(1);
232 233
@@ -421,7 +422,8 @@ void omap_pm_suspend(void)
421 422
422 omap_serial_wake_trigger(0); 423 omap_serial_wake_trigger(0);
423 424
424 printk("PM: OMAP%x is re-starting from deep sleep...\n", system_rev); 425 printk(KERN_INFO "PM: OMAP%x is re-starting from deep sleep...\n",
426 omap_rev());
425} 427}
426 428
427#if defined(DEBUG) && defined(CONFIG_PROC_FS) 429#if defined(DEBUG) && defined(CONFIG_PROC_FS)
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 3c2f665742f7..31bb7010bd48 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -475,7 +475,7 @@ int __init omap2_clk_init(void)
475 * Update this if there are further clock changes between ES2 475 * Update this if there are further clock changes between ES2
476 * and production parts 476 * and production parts
477 */ 477 */
478 if (system_rev == OMAP3430_REV_ES1_0) { 478 if (omap_rev() == OMAP3430_REV_ES1_0) {
479 /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */ 479 /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */
480 cpu_clkflg |= CLOCK_IN_OMAP3430ES1; 480 cpu_clkflg |= CLOCK_IN_OMAP3430ES1;
481 } else { 481 } else {
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index d4e3a38e347c..b0f8e7d62798 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -23,6 +23,14 @@
23#include <mach/cpu.h> 23#include <mach/cpu.h>
24 24
25static struct omap_chip_id omap_chip; 25static struct omap_chip_id omap_chip;
26static unsigned int omap_revision;
27
28
29unsigned int omap_rev(void)
30{
31 return omap_revision;
32}
33EXPORT_SYMBOL(omap_rev);
26 34
27/** 35/**
28 * omap_chip_is - test whether currently running OMAP matches a chip type 36 * omap_chip_is - test whether currently running OMAP matches a chip type
@@ -50,7 +58,7 @@ EXPORT_SYMBOL(omap_chip_is);
50struct omap_id { 58struct omap_id {
51 u16 hawkeye; /* Silicon type (Hawkeye id) */ 59 u16 hawkeye; /* Silicon type (Hawkeye id) */
52 u8 dev; /* Device type from production_id reg */ 60 u8 dev; /* Device type from production_id reg */
53 u32 type; /* Combined type id copied to system_rev */ 61 u32 type; /* Combined type id copied to omap_revision */
54}; 62};
55 63
56/* Register values to detect the OMAP version */ 64/* Register values to detect the OMAP version */
@@ -116,9 +124,9 @@ void __init omap24xx_check_revision(void)
116 j = i; 124 j = i;
117 } 125 }
118 126
119 pr_info("OMAP%04x", system_rev >> 16); 127 pr_info("OMAP%04x", omap_rev() >> 16);
120 if ((system_rev >> 8) & 0x0f) 128 if ((omap_rev() >> 8) & 0x0f)
121 pr_info("ES%x", (system_rev >> 12) & 0xf); 129 pr_info("ES%x", (omap_rev() >> 12) & 0xf);
122 pr_info("\n"); 130 pr_info("\n");
123} 131}
124 132
@@ -136,7 +144,7 @@ void __init omap34xx_check_revision(void)
136 */ 144 */
137 cpuid = read_cpuid(CPUID_ID); 145 cpuid = read_cpuid(CPUID_ID);
138 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { 146 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
139 system_rev = OMAP3430_REV_ES1_0; 147 omap_revision = OMAP3430_REV_ES1_0;
140 goto out; 148 goto out;
141 } 149 }
142 150
@@ -153,26 +161,26 @@ void __init omap34xx_check_revision(void)
153 if (hawkeye == 0xb7ae) { 161 if (hawkeye == 0xb7ae) {
154 switch (rev) { 162 switch (rev) {
155 case 0: 163 case 0:
156 system_rev = OMAP3430_REV_ES2_0; 164 omap_revision = OMAP3430_REV_ES2_0;
157 rev_name = "ES2.0"; 165 rev_name = "ES2.0";
158 break; 166 break;
159 case 2: 167 case 2:
160 system_rev = OMAP3430_REV_ES2_1; 168 omap_revision = OMAP3430_REV_ES2_1;
161 rev_name = "ES2.1"; 169 rev_name = "ES2.1";
162 break; 170 break;
163 case 3: 171 case 3:
164 system_rev = OMAP3430_REV_ES3_0; 172 omap_revision = OMAP3430_REV_ES3_0;
165 rev_name = "ES3.0"; 173 rev_name = "ES3.0";
166 break; 174 break;
167 default: 175 default:
168 /* Use the latest known revision as default */ 176 /* Use the latest known revision as default */
169 system_rev = OMAP3430_REV_ES3_0; 177 omap_revision = OMAP3430_REV_ES3_0;
170 rev_name = "Unknown revision\n"; 178 rev_name = "Unknown revision\n";
171 } 179 }
172 } 180 }
173 181
174out: 182out:
175 pr_info("OMAP%04x %s\n", system_rev >> 16, rev_name); 183 pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name);
176} 184}
177 185
178/* 186/*
@@ -203,9 +211,9 @@ void __init omap2_check_revision(void)
203 omap_chip.oc |= CHIP_IS_OMAP2420; 211 omap_chip.oc |= CHIP_IS_OMAP2420;
204 } else if (cpu_is_omap343x()) { 212 } else if (cpu_is_omap343x()) {
205 omap_chip.oc = CHIP_IS_OMAP3430; 213 omap_chip.oc = CHIP_IS_OMAP3430;
206 if (system_rev == OMAP3430_REV_ES1_0) 214 if (omap_rev() == OMAP3430_REV_ES1_0)
207 omap_chip.oc |= CHIP_IS_OMAP3430ES1; 215 omap_chip.oc |= CHIP_IS_OMAP3430ES1;
208 else if (system_rev > OMAP3430_REV_ES1_0) 216 else if (omap_rev() > OMAP3430_REV_ES1_0)
209 omap_chip.oc |= CHIP_IS_OMAP3430ES2; 217 omap_chip.oc |= CHIP_IS_OMAP3430ES2;
210 } else { 218 } else {
211 pr_err("Uninitialized omap_chip, please fix!\n"); 219 pr_err("Uninitialized omap_chip, please fix!\n");
@@ -221,7 +229,7 @@ void __init omap2_check_revision(void)
221 */ 229 */
222void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) 230void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
223{ 231{
224 system_rev = omap2_globals->class; 232 omap_revision = omap2_globals->class;
225 tap_base = omap2_globals->tap; 233 tap_base = omap2_globals->tap;
226 234
227 if (cpu_is_omap34xx()) 235 if (cpu_is_omap34xx())
diff --git a/arch/arm/plat-omap/include/mach/board-apollon.h b/arch/arm/plat-omap/include/mach/board-apollon.h
index 731c858cf3fe..61bd5e8f09b1 100644
--- a/arch/arm/plat-omap/include/mach/board-apollon.h
+++ b/arch/arm/plat-omap/include/mach/board-apollon.h
@@ -29,12 +29,14 @@
29#ifndef __ASM_ARCH_OMAP_APOLLON_H 29#ifndef __ASM_ARCH_OMAP_APOLLON_H
30#define __ASM_ARCH_OMAP_APOLLON_H 30#define __ASM_ARCH_OMAP_APOLLON_H
31 31
32#include <mach/cpu.h>
33
32extern void apollon_mmc_init(void); 34extern void apollon_mmc_init(void);
33 35
34static inline int apollon_plus(void) 36static inline int apollon_plus(void)
35{ 37{
36 /* The apollon plus has IDCODE revision 5 */ 38 /* The apollon plus has IDCODE revision 5 */
37 return system_rev & 0xc0; 39 return omap_rev() & 0xc0;
38} 40}
39 41
40/* Placeholder for APOLLON specific defines */ 42/* Placeholder for APOLLON specific defines */
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h
index 4325bbc97477..b2062f1175de 100644
--- a/arch/arm/plat-omap/include/mach/cpu.h
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -34,12 +34,12 @@ struct omap_chip_id {
34#define OMAP_CHIP_INIT(x) { .oc = x } 34#define OMAP_CHIP_INIT(x) { .oc = x }
35 35
36/* 36/*
37 * system_rev bits: 37 * omap_rev bits:
38 * CPU id bits (0730, 1510, 1710, 2422...) [31:16] 38 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
39 * CPU revision (See _REV_ defined in cpu.h) [15:08] 39 * CPU revision (See _REV_ defined in cpu.h) [15:08]
40 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00] 40 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
41 */ 41 */
42extern unsigned int system_rev; 42unsigned int omap_rev(void);
43 43
44/* 44/*
45 * Test if multicore OMAP support is needed 45 * Test if multicore OMAP support is needed
@@ -113,7 +113,7 @@ extern unsigned int system_rev;
113 * cpu_is_omap243x(): True for OMAP2430 113 * cpu_is_omap243x(): True for OMAP2430
114 * cpu_is_omap343x(): True for OMAP3430 114 * cpu_is_omap343x(): True for OMAP3430
115 */ 115 */
116#define GET_OMAP_CLASS (system_rev & 0xff) 116#define GET_OMAP_CLASS (omap_rev() & 0xff)
117 117
118#define IS_OMAP_CLASS(class, id) \ 118#define IS_OMAP_CLASS(class, id) \
119static inline int is_omap ##class (void) \ 119static inline int is_omap ##class (void) \
@@ -121,7 +121,7 @@ static inline int is_omap ##class (void) \
121 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ 121 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
122} 122}
123 123
124#define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff) 124#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
125 125
126#define IS_OMAP_SUBCLASS(subclass, id) \ 126#define IS_OMAP_SUBCLASS(subclass, id) \
127static inline int is_omap ##subclass (void) \ 127static inline int is_omap ##subclass (void) \
@@ -231,7 +231,7 @@ IS_OMAP_SUBCLASS(343x, 0x343)
231 * cpu_is_omap2430(): True for OMAP2430 231 * cpu_is_omap2430(): True for OMAP2430
232 * cpu_is_omap3430(): True for OMAP3430 232 * cpu_is_omap3430(): True for OMAP3430
233 */ 233 */
234#define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) 234#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
235 235
236#define IS_OMAP_TYPE(type, id) \ 236#define IS_OMAP_TYPE(type, id) \
237static inline int is_omap ##type (void) \ 237static inline int is_omap ##type (void) \
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index dcd9d16da2e9..be7bcaf2b832 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -24,6 +24,7 @@
24 24
25#include <mach/sram.h> 25#include <mach/sram.h>
26#include <mach/board.h> 26#include <mach/board.h>
27#include <mach/cpu.h>
27 28
28#include <mach/control.h> 29#include <mach/control.h>
29 30
@@ -87,7 +88,7 @@ static int is_sram_locked(void)
87 int type = 0; 88 int type = 0;
88 89
89 if (cpu_is_omap242x()) 90 if (cpu_is_omap242x())
90 type = system_rev & OMAP2_DEVICETYPE_MASK; 91 type = omap_rev() & OMAP2_DEVICETYPE_MASK;
91 92
92 if (type == GP_DEVICE) { 93 if (type == GP_DEVICE) {
93 /* RAMFW: R/W access to all initiators for all qualifier sets */ 94 /* RAMFW: R/W access to all initiators for all qualifier sets */