aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx5/cpu.c
diff options
context:
space:
mode:
authorDinh Nguyen <Dinh.Nguyen@freescale.com>2011-03-21 17:30:35 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2011-03-23 10:08:15 -0400
commit16f246e69b8857c6a2993f1b6663e92d4d4e5395 (patch)
tree9ae26cd2131b8096c8d17e3754f307b6092b514d /arch/arm/mach-mx5/cpu.c
parent021ebc2da02a7f3107a8f31d8a0ebfbe4175429e (diff)
ARM: mx50: Add support to get the silicon revision
For MX50, the HW_ADADIG_DIGPROG register in the ANATOP module will have the correct silicon revision: Major Minor Description 0x50 0x0 TO1.0 0x50 0x1 TO1.1 Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx5/cpu.c')
-rw-r--r--arch/arm/mach-mx5/cpu.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/cpu.c b/arch/arm/mach-mx5/cpu.c
index 3b4c30743052..472bdfab2e55 100644
--- a/arch/arm/mach-mx5/cpu.c
+++ b/arch/arm/mach-mx5/cpu.c
@@ -21,6 +21,7 @@
21static int cpu_silicon_rev = -1; 21static int cpu_silicon_rev = -1;
22 22
23#define IIM_SREV 0x24 23#define IIM_SREV 0x24
24#define MX50_HW_ADADIG_DIGPROG 0xB0
24 25
25static int get_mx51_srev(void) 26static int get_mx51_srev(void)
26{ 27{
@@ -127,6 +128,44 @@ int mx53_revision(void)
127} 128}
128EXPORT_SYMBOL(mx53_revision); 129EXPORT_SYMBOL(mx53_revision);
129 130
131static int get_mx50_srev(void)
132{
133 void __iomem *anatop = ioremap(MX50_ANATOP_BASE_ADDR, SZ_8K);
134 u32 rev;
135
136 if (!anatop) {
137 cpu_silicon_rev = -EINVAL;
138 return 0;
139 }
140
141 rev = readl(anatop + MX50_HW_ADADIG_DIGPROG);
142 rev &= 0xff;
143
144 iounmap(anatop);
145 if (rev == 0x0)
146 return IMX_CHIP_REVISION_1_0;
147 else if (rev == 0x1)
148 return IMX_CHIP_REVISION_1_1;
149 return 0;
150}
151
152/*
153 * Returns:
154 * the silicon revision of the cpu
155 * -EINVAL - not a mx50
156 */
157int mx50_revision(void)
158{
159 if (!cpu_is_mx50())
160 return -EINVAL;
161
162 if (cpu_silicon_rev == -1)
163 cpu_silicon_rev = get_mx50_srev();
164
165 return cpu_silicon_rev;
166}
167EXPORT_SYMBOL(mx50_revision);
168
130static int __init post_cpu_init(void) 169static int __init post_cpu_init(void)
131{ 170{
132 unsigned int reg; 171 unsigned int reg;