aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorSanjeev Premi <premi@ti.com>2009-11-22 13:10:53 -0500
committerTony Lindgren <tony@atomide.com>2009-11-22 13:24:32 -0500
commit8384ce071365244332ea05c81112bfffcf48be87 (patch)
tree5a6f076c6cef8d526b4429e17a64fd73dd63132c /arch/arm
parent45f780a06153544ab84fd1da3a8b28c07f61da1d (diff)
omap3: Runtime detection of Si features
The OMAP35x family has multiple variants differing in the HW features. This patch detects these features at runtime and prints information during the boot. Since most of the code seemed repetitive, macros have been used for readability. Signed-off-by: Sanjeev Premi <premi@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/id.c52
-rw-r--r--arch/arm/plat-omap/include/plat/control.h34
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h25
3 files changed, 108 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index d28e6fec7e47..d7ac8d547141 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -28,6 +28,7 @@
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{
@@ -155,7 +156,33 @@ 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;
@@ -212,6 +239,22 @@ out:
212 pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name); 239 pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name);
213} 240}
214 241
242#define OMAP3_SHOW_FEATURE(feat) \
243 if (omap3_has_ ##feat()) { \
244 pr_info (" - "#feat" : Y"); \
245 } else { \
246 pr_info (" - "#feat" : N"); \
247 }
248
249void __init omap3_cpuinfo(void)
250{
251 OMAP3_SHOW_FEATURE(l2cache);
252 OMAP3_SHOW_FEATURE(iva);
253 OMAP3_SHOW_FEATURE(sgx);
254 OMAP3_SHOW_FEATURE(neon);
255 OMAP3_SHOW_FEATURE(isp);
256}
257
215/* 258/*
216 * Try to detect the exact revision of the omap we're running on 259 * Try to detect the exact revision of the omap we're running on
217 */ 260 */
@@ -223,8 +266,11 @@ void __init omap2_check_revision(void)
223 */ 266 */
224 if (cpu_is_omap24xx()) 267 if (cpu_is_omap24xx())
225 omap24xx_check_revision(); 268 omap24xx_check_revision();
226 else if (cpu_is_omap34xx()) 269 else if (cpu_is_omap34xx()) {
227 omap34xx_check_revision(); 270 omap3_check_features();
271 omap3_check_revision();
272 omap3_cpuinfo();
273 }
228 else if (cpu_is_omap44xx()) { 274 else if (cpu_is_omap44xx()) {
229 printk(KERN_INFO "FIXME: CPU revision = OMAP4430\n"); 275 printk(KERN_INFO "FIXME: CPU revision = OMAP4430\n");
230 return; 276 return;
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/plat-omap/include/plat/control.h
index 8237cb9e74fd..79985e497c4e 100644
--- a/arch/arm/plat-omap/include/plat/control.h
+++ b/arch/arm/plat-omap/include/plat/control.h
@@ -254,6 +254,40 @@
254#define OMAP343X_SCRATCHPAD (OMAP343X_CTRL_BASE + 0x910) 254#define OMAP343X_SCRATCHPAD (OMAP343X_CTRL_BASE + 0x910)
255#define OMAP343X_SCRATCHPAD_ROM_OFFSET 0x19C 255#define OMAP343X_SCRATCHPAD_ROM_OFFSET 0x19C
256 256
257/*
258 * CONTROL OMAP STATUS register to identify OMAP3 features
259 */
260#define OMAP3_CONTROL_OMAP_STATUS 0x044c
261
262#define OMAP3_SGX_SHIFT 13
263#define OMAP3_SGX_MASK (3 << OMAP3_SGX_SHIFT)
264#define FEAT_SGX_FULL 0
265#define FEAT_SGX_HALF 1
266#define FEAT_SGX_NONE 2
267
268#define OMAP3_IVA_SHIFT 12
269#define OMAP3_IVA_MASK (1 << OMAP3_SGX_SHIFT)
270#define FEAT_IVA 0
271#define FEAT_IVA_NONE 1
272
273#define OMAP3_L2CACHE_SHIFT 10
274#define OMAP3_L2CACHE_MASK (3 << OMAP3_L2CACHE_SHIFT)
275#define FEAT_L2CACHE_NONE 0
276#define FEAT_L2CACHE_64KB 1
277#define FEAT_L2CACHE_128KB 2
278#define FEAT_L2CACHE_256KB 3
279
280#define OMAP3_ISP_SHIFT 5
281#define OMAP3_ISP_MASK (1<< OMAP3_ISP_SHIFT)
282#define FEAT_ISP 0
283#define FEAT_ISP_NONE 1
284
285#define OMAP3_NEON_SHIFT 4
286#define OMAP3_NEON_MASK (1<< OMAP3_NEON_SHIFT)
287#define FEAT_NEON 0
288#define FEAT_NEON_NONE 1
289
290
257#ifndef __ASSEMBLY__ 291#ifndef __ASSEMBLY__
258#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ 292#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
259 defined(CONFIG_ARCH_OMAP4) 293 defined(CONFIG_ARCH_OMAP4)
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index f129efb3075e..431fec45bbbc 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -30,6 +30,8 @@
30#ifndef __ASM_ARCH_OMAP_CPU_H 30#ifndef __ASM_ARCH_OMAP_CPU_H
31#define __ASM_ARCH_OMAP_CPU_H 31#define __ASM_ARCH_OMAP_CPU_H
32 32
33#include <linux/bitops.h>
34
33/* 35/*
34 * Omap device type i.e. EMU/HS/TST/GP/BAD 36 * Omap device type i.e. EMU/HS/TST/GP/BAD
35 */ 37 */
@@ -423,4 +425,27 @@ IS_OMAP_TYPE(3430, 0x3430)
423int omap_chip_is(struct omap_chip_id oci); 425int omap_chip_is(struct omap_chip_id oci);
424void omap2_check_revision(void); 426void omap2_check_revision(void);
425 427
428/*
429 * Runtime detection of OMAP3 features
430 */
431extern u32 omap3_features;
432
433#define OMAP3_HAS_L2CACHE BIT(0)
434#define OMAP3_HAS_IVA BIT(1)
435#define OMAP3_HAS_SGX BIT(2)
436#define OMAP3_HAS_NEON BIT(3)
437#define OMAP3_HAS_ISP BIT(4)
438
439#define OMAP3_HAS_FEATURE(feat,flag) \
440static inline unsigned int omap3_has_ ##feat(void) \
441{ \
442 return (omap3_features & OMAP3_HAS_ ##flag); \
443} \
444
445OMAP3_HAS_FEATURE(l2cache, L2CACHE)
446OMAP3_HAS_FEATURE(sgx, SGX)
447OMAP3_HAS_FEATURE(iva, IVA)
448OMAP3_HAS_FEATURE(neon, NEON)
449OMAP3_HAS_FEATURE(isp, ISP)
450
426#endif 451#endif