diff options
Diffstat (limited to 'arch/arm/mach-imx/cpu-imx27.c')
-rw-r--r-- | arch/arm/mach-imx/cpu-imx27.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/arch/arm/mach-imx/cpu-imx27.c b/arch/arm/mach-imx/cpu-imx27.c index 3b117be37bd2..ff38e1505f67 100644 --- a/arch/arm/mach-imx/cpu-imx27.c +++ b/arch/arm/mach-imx/cpu-imx27.c | |||
@@ -26,12 +26,12 @@ | |||
26 | 26 | ||
27 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
28 | 28 | ||
29 | static int cpu_silicon_rev = -1; | 29 | static int mx27_cpu_rev = -1; |
30 | static int cpu_partnumber; | 30 | static int mx27_cpu_partnumber; |
31 | 31 | ||
32 | #define SYS_CHIP_ID 0x00 /* The offset of CHIP ID register */ | 32 | #define SYS_CHIP_ID 0x00 /* The offset of CHIP ID register */ |
33 | 33 | ||
34 | static void query_silicon_parameter(void) | 34 | static int mx27_read_cpu_rev(void) |
35 | { | 35 | { |
36 | u32 val; | 36 | u32 val; |
37 | /* | 37 | /* |
@@ -42,20 +42,18 @@ static void query_silicon_parameter(void) | |||
42 | val = __raw_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR | 42 | val = __raw_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR |
43 | + SYS_CHIP_ID)); | 43 | + SYS_CHIP_ID)); |
44 | 44 | ||
45 | mx27_cpu_partnumber = (int)((val >> 12) & 0xFFFF); | ||
46 | |||
45 | switch (val >> 28) { | 47 | switch (val >> 28) { |
46 | case 0: | 48 | case 0: |
47 | cpu_silicon_rev = IMX_CHIP_REVISION_1_0; | 49 | return IMX_CHIP_REVISION_1_0; |
48 | break; | ||
49 | case 1: | 50 | case 1: |
50 | cpu_silicon_rev = IMX_CHIP_REVISION_2_0; | 51 | return IMX_CHIP_REVISION_2_0; |
51 | break; | ||
52 | case 2: | 52 | case 2: |
53 | cpu_silicon_rev = IMX_CHIP_REVISION_2_1; | 53 | return IMX_CHIP_REVISION_2_1; |
54 | break; | ||
55 | default: | 54 | default: |
56 | cpu_silicon_rev = IMX_CHIP_REVISION_UNKNOWN; | 55 | return IMX_CHIP_REVISION_UNKNOWN; |
57 | } | 56 | } |
58 | cpu_partnumber = (int)((val >> 12) & 0xFFFF); | ||
59 | } | 57 | } |
60 | 58 | ||
61 | /* | 59 | /* |
@@ -65,12 +63,12 @@ static void query_silicon_parameter(void) | |||
65 | */ | 63 | */ |
66 | int mx27_revision(void) | 64 | int mx27_revision(void) |
67 | { | 65 | { |
68 | if (cpu_silicon_rev == -1) | 66 | if (mx27_cpu_rev == -1) |
69 | query_silicon_parameter(); | 67 | mx27_cpu_rev = mx27_read_cpu_rev(); |
70 | 68 | ||
71 | if (cpu_partnumber != 0x8821) | 69 | if (mx27_cpu_partnumber != 0x8821) |
72 | return -EINVAL; | 70 | return -EINVAL; |
73 | 71 | ||
74 | return cpu_silicon_rev; | 72 | return mx27_cpu_rev; |
75 | } | 73 | } |
76 | EXPORT_SYMBOL(mx27_revision); | 74 | EXPORT_SYMBOL(mx27_revision); |