aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/id.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/id.c')
-rw-r--r--arch/arm/mach-omap2/id.c165
1 files changed, 140 insertions, 25 deletions
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index a98201cc265c..f48a4b2654dd 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -21,13 +21,14 @@
21 21
22#include <asm/cputype.h> 22#include <asm/cputype.h>
23 23
24#include <mach/common.h> 24#include <plat/common.h>
25#include <mach/control.h> 25#include <plat/control.h>
26#include <mach/cpu.h> 26#include <plat/cpu.h>
27 27
28static struct omap_chip_id omap_chip; 28static struct omap_chip_id omap_chip;
29static unsigned int omap_revision; 29static unsigned int omap_revision;
30 30
31u32 omap3_features;
31 32
32unsigned int omap_rev(void) 33unsigned int omap_rev(void)
33{ 34{
@@ -52,11 +53,11 @@ int omap_type(void)
52{ 53{
53 u32 val = 0; 54 u32 val = 0;
54 55
55 if (cpu_is_omap24xx()) 56 if (cpu_is_omap24xx()) {
56 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS); 57 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
57 else if (cpu_is_omap34xx()) 58 } else if (cpu_is_omap34xx()) {
58 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS); 59 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
59 else { 60 } else {
60 pr_err("Cannot detect omap type!\n"); 61 pr_err("Cannot detect omap type!\n");
61 goto out; 62 goto out;
62 } 63 }
@@ -155,12 +156,37 @@ void __init omap24xx_check_revision(void)
155 pr_info("\n"); 156 pr_info("\n");
156} 157}
157 158
158void __init omap34xx_check_revision(void) 159#define OMAP3_CHECK_FEATURE(status,feat) \
160 if (((status & OMAP3_ ##feat## _MASK) \
161 >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \
162 omap3_features |= OMAP3_HAS_ ##feat; \
163 }
164
165void __init omap3_check_features(void)
166{
167 u32 status;
168
169 omap3_features = 0;
170
171 status = omap_ctrl_readl(OMAP3_CONTROL_OMAP_STATUS);
172
173 OMAP3_CHECK_FEATURE(status, L2CACHE);
174 OMAP3_CHECK_FEATURE(status, IVA);
175 OMAP3_CHECK_FEATURE(status, SGX);
176 OMAP3_CHECK_FEATURE(status, NEON);
177 OMAP3_CHECK_FEATURE(status, ISP);
178
179 /*
180 * TODO: Get additional info (where applicable)
181 * e.g. Size of L2 cache.
182 */
183}
184
185void __init omap3_check_revision(void)
159{ 186{
160 u32 cpuid, idcode; 187 u32 cpuid, idcode;
161 u16 hawkeye; 188 u16 hawkeye;
162 u8 rev; 189 u8 rev;
163 char *rev_name = "ES1.0";
164 190
165 /* 191 /*
166 * We cannot access revision registers on ES1.0. 192 * We cannot access revision registers on ES1.0.
@@ -170,7 +196,7 @@ void __init omap34xx_check_revision(void)
170 cpuid = read_cpuid(CPUID_ID); 196 cpuid = read_cpuid(CPUID_ID);
171 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { 197 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
172 omap_revision = OMAP3430_REV_ES1_0; 198 omap_revision = OMAP3430_REV_ES1_0;
173 goto out; 199 return;
174 } 200 }
175 201
176 /* 202 /*
@@ -183,33 +209,115 @@ void __init omap34xx_check_revision(void)
183 hawkeye = (idcode >> 12) & 0xffff; 209 hawkeye = (idcode >> 12) & 0xffff;
184 rev = (idcode >> 28) & 0xff; 210 rev = (idcode >> 28) & 0xff;
185 211
186 if (hawkeye == 0xb7ae) { 212 switch (hawkeye) {
213 case 0xb7ae:
214 /* Handle 34xx/35xx devices */
187 switch (rev) { 215 switch (rev) {
188 case 0: 216 case 0: /* Take care of early samples */
217 case 1:
189 omap_revision = OMAP3430_REV_ES2_0; 218 omap_revision = OMAP3430_REV_ES2_0;
190 rev_name = "ES2.0";
191 break; 219 break;
192 case 2: 220 case 2:
193 omap_revision = OMAP3430_REV_ES2_1; 221 omap_revision = OMAP3430_REV_ES2_1;
194 rev_name = "ES2.1";
195 break; 222 break;
196 case 3: 223 case 3:
197 omap_revision = OMAP3430_REV_ES3_0; 224 omap_revision = OMAP3430_REV_ES3_0;
198 rev_name = "ES3.0";
199 break; 225 break;
200 case 4: 226 case 4:
201 omap_revision = OMAP3430_REV_ES3_1; 227 /* FALLTHROUGH */
202 rev_name = "ES3.1";
203 break;
204 default: 228 default:
205 /* Use the latest known revision as default */ 229 /* Use the latest known revision as default */
206 omap_revision = OMAP3430_REV_ES3_1; 230 omap_revision = OMAP3430_REV_ES3_1;
207 rev_name = "Unknown revision\n";
208 } 231 }
232 break;
233 case 0xb868:
234 /* Handle OMAP35xx/AM35xx devices
235 *
236 * Set the device to be OMAP3505 here. Actual device
237 * is identified later based on the features.
238 */
239 omap_revision = OMAP3505_REV(rev);
240 break;
241 case 0xb891:
242 /* FALLTHROUGH */
243 default:
244 /* Unknown default to latest silicon rev as default*/
245 omap_revision = OMAP3630_REV_ES1_0;
209 } 246 }
247}
210 248
211out: 249#define OMAP3_SHOW_FEATURE(feat) \
212 pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name); 250 if (omap3_has_ ##feat()) \
251 printk(#feat" ");
252
253void __init omap3_cpuinfo(void)
254{
255 u8 rev = GET_OMAP_REVISION();
256 char cpu_name[16], cpu_rev[16];
257
258 /* OMAP3430 and OMAP3530 are assumed to be same.
259 *
260 * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
261 * on available features. Upon detection, update the CPU id
262 * and CPU class bits.
263 */
264 if (cpu_is_omap3630()) {
265 strcpy(cpu_name, "OMAP3630");
266 } else if (cpu_is_omap3505()) {
267 /*
268 * AM35xx devices
269 */
270 if (omap3_has_sgx()) {
271 omap_revision = OMAP3517_REV(rev);
272 strcpy(cpu_name, "AM3517");
273 } else {
274 /* Already set in omap3_check_revision() */
275 strcpy(cpu_name, "AM3505");
276 }
277 } else if (omap3_has_iva() && omap3_has_sgx()) {
278 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
279 strcpy(cpu_name, "OMAP3430/3530");
280 } else if (omap3_has_sgx()) {
281 omap_revision = OMAP3525_REV(rev);
282 strcpy(cpu_name, "OMAP3525");
283 } else if (omap3_has_iva()) {
284 omap_revision = OMAP3515_REV(rev);
285 strcpy(cpu_name, "OMAP3515");
286 } else {
287 omap_revision = OMAP3503_REV(rev);
288 strcpy(cpu_name, "OMAP3503");
289 }
290
291 switch (rev) {
292 case OMAP_REVBITS_00:
293 strcpy(cpu_rev, "1.0");
294 break;
295 case OMAP_REVBITS_10:
296 strcpy(cpu_rev, "2.0");
297 break;
298 case OMAP_REVBITS_20:
299 strcpy(cpu_rev, "2.1");
300 break;
301 case OMAP_REVBITS_30:
302 strcpy(cpu_rev, "3.0");
303 break;
304 case OMAP_REVBITS_40:
305 /* FALLTHROUGH */
306 default:
307 /* Use the latest known revision as default */
308 strcpy(cpu_rev, "3.1");
309 }
310
311 /* Print verbose information */
312 pr_info("%s ES%s (", cpu_name, cpu_rev);
313
314 OMAP3_SHOW_FEATURE(l2cache);
315 OMAP3_SHOW_FEATURE(iva);
316 OMAP3_SHOW_FEATURE(sgx);
317 OMAP3_SHOW_FEATURE(neon);
318 OMAP3_SHOW_FEATURE(isp);
319
320 printk(")\n");
213} 321}
214 322
215/* 323/*
@@ -221,15 +329,18 @@ void __init omap2_check_revision(void)
221 * At this point we have an idea about the processor revision set 329 * At this point we have an idea about the processor revision set
222 * earlier with omap2_set_globals_tap(). 330 * earlier with omap2_set_globals_tap().
223 */ 331 */
224 if (cpu_is_omap24xx()) 332 if (cpu_is_omap24xx()) {
225 omap24xx_check_revision(); 333 omap24xx_check_revision();
226 else if (cpu_is_omap34xx()) 334 } else if (cpu_is_omap34xx()) {
227 omap34xx_check_revision(); 335 omap3_check_revision();
228 else if (cpu_is_omap44xx()) { 336 omap3_check_features();
337 omap3_cpuinfo();
338 } else if (cpu_is_omap44xx()) {
229 printk(KERN_INFO "FIXME: CPU revision = OMAP4430\n"); 339 printk(KERN_INFO "FIXME: CPU revision = OMAP4430\n");
230 return; 340 return;
231 } else 341 } else {
232 pr_err("OMAP revision unknown, please fix!\n"); 342 pr_err("OMAP revision unknown, please fix!\n");
343 }
233 344
234 /* 345 /*
235 * OK, now we know the exact revision. Initialize omap_chip bits 346 * OK, now we know the exact revision. Initialize omap_chip bits
@@ -241,6 +352,8 @@ void __init omap2_check_revision(void)
241 } else if (cpu_is_omap242x()) { 352 } else if (cpu_is_omap242x()) {
242 /* Currently only supports 2420ES2.1.1 and 2420-all */ 353 /* Currently only supports 2420ES2.1.1 and 2420-all */
243 omap_chip.oc |= CHIP_IS_OMAP2420; 354 omap_chip.oc |= CHIP_IS_OMAP2420;
355 } else if (cpu_is_omap3505() || cpu_is_omap3517()) {
356 omap_chip.oc = CHIP_IS_OMAP3430 | CHIP_IS_OMAP3430ES3_1;
244 } else if (cpu_is_omap343x()) { 357 } else if (cpu_is_omap343x()) {
245 omap_chip.oc = CHIP_IS_OMAP3430; 358 omap_chip.oc = CHIP_IS_OMAP3430;
246 if (omap_rev() == OMAP3430_REV_ES1_0) 359 if (omap_rev() == OMAP3430_REV_ES1_0)
@@ -252,6 +365,8 @@ void __init omap2_check_revision(void)
252 omap_chip.oc |= CHIP_IS_OMAP3430ES3_0; 365 omap_chip.oc |= CHIP_IS_OMAP3430ES3_0;
253 else if (omap_rev() == OMAP3430_REV_ES3_1) 366 else if (omap_rev() == OMAP3430_REV_ES3_1)
254 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1; 367 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
368 else if (omap_rev() == OMAP3630_REV_ES1_0)
369 omap_chip.oc |= CHIP_IS_OMAP3630ES1;
255 } else { 370 } else {
256 pr_err("Uninitialized omap_chip, please fix!\n"); 371 pr_err("Uninitialized omap_chip, please fix!\n");
257 } 372 }