diff options
Diffstat (limited to 'arch/arm/mach-mx5/cpu.c')
-rw-r--r-- | arch/arm/mach-mx5/cpu.c | 118 |
1 files changed, 69 insertions, 49 deletions
diff --git a/arch/arm/mach-mx5/cpu.c b/arch/arm/mach-mx5/cpu.c index eaacb6e9b5d0..d40671da4372 100644 --- a/arch/arm/mach-mx5/cpu.c +++ b/arch/arm/mach-mx5/cpu.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * The code contained herein is licensed under the GNU General Public | 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 | 5 | * License. You may obtain a copy of the GNU General Public License |
@@ -20,37 +20,18 @@ | |||
20 | 20 | ||
21 | static int cpu_silicon_rev = -1; | 21 | static int cpu_silicon_rev = -1; |
22 | 22 | ||
23 | #define SI_REV 0x48 | 23 | #define IIM_SREV 0x24 |
24 | 24 | ||
25 | static void query_silicon_parameter(void) | 25 | static int get_mx51_srev(void) |
26 | { | 26 | { |
27 | void __iomem *rom = ioremap(MX51_IROM_BASE_ADDR, MX51_IROM_SIZE); | 27 | void __iomem *iim_base = MX51_IO_ADDRESS(MX51_IIM_BASE_ADDR); |
28 | u32 rev; | 28 | u32 rev = readl(iim_base + IIM_SREV) & 0xff; |
29 | 29 | ||
30 | if (!rom) { | 30 | if (rev == 0x0) |
31 | cpu_silicon_rev = -EINVAL; | 31 | return IMX_CHIP_REVISION_2_0; |
32 | return; | 32 | else if (rev == 0x10) |
33 | } | 33 | return IMX_CHIP_REVISION_3_0; |
34 | 34 | return 0; | |
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; | ||
51 | } | ||
52 | |||
53 | iounmap(rom); | ||
54 | } | 35 | } |
55 | 36 | ||
56 | /* | 37 | /* |
@@ -64,7 +45,7 @@ int mx51_revision(void) | |||
64 | return -EINVAL; | 45 | return -EINVAL; |
65 | 46 | ||
66 | if (cpu_silicon_rev == -1) | 47 | if (cpu_silicon_rev == -1) |
67 | query_silicon_parameter(); | 48 | cpu_silicon_rev = get_mx51_srev(); |
68 | 49 | ||
69 | return cpu_silicon_rev; | 50 | return cpu_silicon_rev; |
70 | } | 51 | } |
@@ -79,7 +60,10 @@ EXPORT_SYMBOL(mx51_revision); | |||
79 | */ | 60 | */ |
80 | static int __init mx51_neon_fixup(void) | 61 | static int __init mx51_neon_fixup(void) |
81 | { | 62 | { |
82 | if (mx51_revision() < MX51_CHIP_REV_3_0 && (elf_hwcap & HWCAP_NEON)) { | 63 | if (!cpu_is_mx51()) |
64 | return 0; | ||
65 | |||
66 | if (mx51_revision() < IMX_CHIP_REVISION_3_0 && (elf_hwcap & HWCAP_NEON)) { | ||
83 | elf_hwcap &= ~HWCAP_NEON; | 67 | elf_hwcap &= ~HWCAP_NEON; |
84 | pr_info("Turning off NEON support, detected broken NEON implementation\n"); | 68 | pr_info("Turning off NEON support, detected broken NEON implementation\n"); |
85 | } | 69 | } |
@@ -89,29 +73,65 @@ static int __init mx51_neon_fixup(void) | |||
89 | late_initcall(mx51_neon_fixup); | 73 | late_initcall(mx51_neon_fixup); |
90 | #endif | 74 | #endif |
91 | 75 | ||
76 | static int get_mx53_srev(void) | ||
77 | { | ||
78 | void __iomem *iim_base = MX51_IO_ADDRESS(MX53_IIM_BASE_ADDR); | ||
79 | u32 rev = readl(iim_base + IIM_SREV) & 0xff; | ||
80 | |||
81 | if (rev == 0x0) | ||
82 | return IMX_CHIP_REVISION_1_0; | ||
83 | else if (rev == 0x10) | ||
84 | return IMX_CHIP_REVISION_2_0; | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | /* | ||
89 | * Returns: | ||
90 | * the silicon revision of the cpu | ||
91 | * -EINVAL - not a mx53 | ||
92 | */ | ||
93 | int mx53_revision(void) | ||
94 | { | ||
95 | if (!cpu_is_mx53()) | ||
96 | return -EINVAL; | ||
97 | |||
98 | if (cpu_silicon_rev == -1) | ||
99 | cpu_silicon_rev = get_mx53_srev(); | ||
100 | |||
101 | return cpu_silicon_rev; | ||
102 | } | ||
103 | EXPORT_SYMBOL(mx53_revision); | ||
104 | |||
92 | static int __init post_cpu_init(void) | 105 | static int __init post_cpu_init(void) |
93 | { | 106 | { |
94 | unsigned int reg; | 107 | unsigned int reg; |
95 | void __iomem *base; | 108 | void __iomem *base; |
96 | 109 | ||
97 | if (!cpu_is_mx51()) | 110 | if (cpu_is_mx51() || cpu_is_mx53()) { |
98 | return 0; | 111 | if (cpu_is_mx51()) |
99 | 112 | base = MX51_IO_ADDRESS(MX51_AIPS1_BASE_ADDR); | |
100 | base = MX51_IO_ADDRESS(MX51_AIPS1_BASE_ADDR); | 113 | else |
101 | __raw_writel(0x0, base + 0x40); | 114 | base = MX53_IO_ADDRESS(MX53_AIPS1_BASE_ADDR); |
102 | __raw_writel(0x0, base + 0x44); | 115 | |
103 | __raw_writel(0x0, base + 0x48); | 116 | __raw_writel(0x0, base + 0x40); |
104 | __raw_writel(0x0, base + 0x4C); | 117 | __raw_writel(0x0, base + 0x44); |
105 | reg = __raw_readl(base + 0x50) & 0x00FFFFFF; | 118 | __raw_writel(0x0, base + 0x48); |
106 | __raw_writel(reg, base + 0x50); | 119 | __raw_writel(0x0, base + 0x4C); |
107 | 120 | reg = __raw_readl(base + 0x50) & 0x00FFFFFF; | |
108 | base = MX51_IO_ADDRESS(MX51_AIPS2_BASE_ADDR); | 121 | __raw_writel(reg, base + 0x50); |
109 | __raw_writel(0x0, base + 0x40); | 122 | |
110 | __raw_writel(0x0, base + 0x44); | 123 | if (cpu_is_mx51()) |
111 | __raw_writel(0x0, base + 0x48); | 124 | base = MX51_IO_ADDRESS(MX51_AIPS2_BASE_ADDR); |
112 | __raw_writel(0x0, base + 0x4C); | 125 | else |
113 | reg = __raw_readl(base + 0x50) & 0x00FFFFFF; | 126 | base = MX53_IO_ADDRESS(MX53_AIPS2_BASE_ADDR); |
114 | __raw_writel(reg, base + 0x50); | 127 | |
128 | __raw_writel(0x0, base + 0x40); | ||
129 | __raw_writel(0x0, base + 0x44); | ||
130 | __raw_writel(0x0, base + 0x48); | ||
131 | __raw_writel(0x0, base + 0x4C); | ||
132 | reg = __raw_readl(base + 0x50) & 0x00FFFFFF; | ||
133 | __raw_writel(reg, base + 0x50); | ||
134 | } | ||
115 | 135 | ||
116 | return 0; | 136 | return 0; |
117 | } | 137 | } |