ARM: mxc: turn off HWCAP_NEON for older versions of imx51 silicon
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-mx5 / cpu.c
blobeaacb6e9b5d0b417d0b78d56a8ebb406cb8ee9cd
1 /*
2 * Copyright 2008-2009 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>
18 #include <mach/hardware.h>
19 #include <asm/io.h>
21 static int cpu_silicon_rev = -1;
23 #define SI_REV 0x48
25 static void query_silicon_parameter(void)
27 void __iomem *rom = ioremap(MX51_IROM_BASE_ADDR, MX51_IROM_SIZE);
28 u32 rev;
30 if (!rom) {
31 cpu_silicon_rev = -EINVAL;
32 return;
35 rev = readl(rom + SI_REV);
36 switch (rev) {
37 case 0x1:
38 cpu_silicon_rev = MX51_CHIP_REV_1_0;
39 break;
40 case 0x2:
41 cpu_silicon_rev = MX51_CHIP_REV_1_1;
42 break;
43 case 0x10:
44 cpu_silicon_rev = MX51_CHIP_REV_2_0;
45 break;
46 case 0x20:
47 cpu_silicon_rev = MX51_CHIP_REV_3_0;
48 break;
49 default:
50 cpu_silicon_rev = 0;
53 iounmap(rom);
57 * Returns:
58 * the silicon revision of the cpu
59 * -EINVAL - not a mx51
61 int mx51_revision(void)
63 if (!cpu_is_mx51())
64 return -EINVAL;
66 if (cpu_silicon_rev == -1)
67 query_silicon_parameter();
69 return cpu_silicon_rev;
71 EXPORT_SYMBOL(mx51_revision);
73 #ifdef CONFIG_NEON
76 * All versions of the silicon before Rev. 3 have broken NEON implementations.
77 * Dependent on link order - so the assumption is that vfp_init is called
78 * before us.
80 static int __init mx51_neon_fixup(void)
82 if (mx51_revision() < MX51_CHIP_REV_3_0 && (elf_hwcap & HWCAP_NEON)) {
83 elf_hwcap &= ~HWCAP_NEON;
84 pr_info("Turning off NEON support, detected broken NEON implementation\n");
86 return 0;
89 late_initcall(mx51_neon_fixup);
90 #endif
92 static int __init post_cpu_init(void)
94 unsigned int reg;
95 void __iomem *base;
97 if (!cpu_is_mx51())
98 return 0;
100 base = MX51_IO_ADDRESS(MX51_AIPS1_BASE_ADDR);
101 __raw_writel(0x0, base + 0x40);
102 __raw_writel(0x0, base + 0x44);
103 __raw_writel(0x0, base + 0x48);
104 __raw_writel(0x0, base + 0x4C);
105 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
106 __raw_writel(reg, base + 0x50);
108 base = MX51_IO_ADDRESS(MX51_AIPS2_BASE_ADDR);
109 __raw_writel(0x0, base + 0x40);
110 __raw_writel(0x0, base + 0x44);
111 __raw_writel(0x0, base + 0x48);
112 __raw_writel(0x0, base + 0x4C);
113 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
114 __raw_writel(reg, base + 0x50);
116 return 0;
119 postcore_initcall(post_cpu_init);