2 * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
11 * This file contains the CPU initialization code.
14 #include <linux/types.h>
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/module.h>
23 static int mx5_cpu_rev = -1;
27 static int get_mx51_srev(void)
29 void __iomem *iim_base = MX51_IO_ADDRESS(MX51_IIM_BASE_ADDR);
30 u32 rev = readl(iim_base + IIM_SREV) & 0xff;
34 return IMX_CHIP_REVISION_2_0;
36 return IMX_CHIP_REVISION_3_0;
38 return IMX_CHIP_REVISION_UNKNOWN;
44 * the silicon revision of the cpu
45 * -EINVAL - not a mx51
47 int mx51_revision(void)
52 if (mx5_cpu_rev == -1)
53 mx5_cpu_rev = get_mx51_srev();
57 EXPORT_SYMBOL(mx51_revision);
62 * All versions of the silicon before Rev. 3 have broken NEON implementations.
63 * Dependent on link order - so the assumption is that vfp_init is called
66 int __init mx51_neon_fixup(void)
68 if (mx51_revision() < IMX_CHIP_REVISION_3_0 &&
69 (elf_hwcap & HWCAP_NEON)) {
70 elf_hwcap &= ~HWCAP_NEON;
71 pr_info("Turning off NEON support, detected broken NEON implementation\n");
78 static int get_mx53_srev(void)
80 void __iomem *iim_base = MX51_IO_ADDRESS(MX53_IIM_BASE_ADDR);
81 u32 rev = readl(iim_base + IIM_SREV) & 0xff;
85 return IMX_CHIP_REVISION_1_0;
87 return IMX_CHIP_REVISION_2_0;
89 return IMX_CHIP_REVISION_2_1;
91 return IMX_CHIP_REVISION_UNKNOWN;
97 * the silicon revision of the cpu
98 * -EINVAL - not a mx53
100 int mx53_revision(void)
105 if (mx5_cpu_rev == -1)
106 mx5_cpu_rev = get_mx53_srev();
110 EXPORT_SYMBOL(mx53_revision);