diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-12-08 00:37:59 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@stericsson.com> | 2011-01-10 12:34:53 -0500 |
commit | abf12d719a2c9e45f7f90c02a3a25107206ed57a (patch) | |
tree | 0aa9d9ecc7188b748eeda954b609dd74a8f5d24f /arch/arm/mach-ux500/include | |
parent | 5dc55e0a39434ec8bec7978aef2dc00c91a530ba (diff) |
ux500: dynamic SOC detection
Dynamically detect the DBx500 SOC an revision based on the ASIC ID.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Diffstat (limited to 'arch/arm/mach-ux500/include')
-rw-r--r-- | arch/arm/mach-ux500/include/mach/hardware.h | 50 | ||||
-rw-r--r-- | arch/arm/mach-ux500/include/mach/id.h | 80 | ||||
-rw-r--r-- | arch/arm/mach-ux500/include/mach/setup.h | 1 |
3 files changed, 82 insertions, 49 deletions
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h index bced4a8e16ef..bf63f2631ba0 100644 --- a/arch/arm/mach-ux500/include/mach/hardware.h +++ b/arch/arm/mach-ux500/include/mach/hardware.h | |||
@@ -34,57 +34,9 @@ | |||
34 | 34 | ||
35 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
36 | 36 | ||
37 | #include <asm/cputype.h> | 37 | #include <mach/id.h> |
38 | |||
39 | static inline bool cpu_is_u8500(void) | ||
40 | { | ||
41 | #ifdef CONFIG_UX500_SOC_DB8500 | ||
42 | return 1; | ||
43 | #else | ||
44 | return 0; | ||
45 | #endif | ||
46 | } | ||
47 | |||
48 | #define CPUID_DB8500ED 0x410fc090 | ||
49 | #define CPUID_DB8500V1 0x411fc091 | ||
50 | #define CPUID_DB8500V2 0x412fc091 | ||
51 | |||
52 | static inline bool cpu_is_u8500ed(void) | ||
53 | { | ||
54 | return cpu_is_u8500() && (read_cpuid_id() == CPUID_DB8500ED); | ||
55 | } | ||
56 | |||
57 | static inline bool cpu_is_u8500v1(void) | ||
58 | { | ||
59 | return cpu_is_u8500() && (read_cpuid_id() == CPUID_DB8500V1); | ||
60 | } | ||
61 | |||
62 | static inline bool cpu_is_u8500v2(void) | ||
63 | { | ||
64 | return cpu_is_u8500() && (read_cpuid_id() == CPUID_DB8500V2); | ||
65 | } | ||
66 | |||
67 | #ifdef CONFIG_UX500_SOC_DB8500 | ||
68 | bool cpu_is_u8500v10(void); | ||
69 | bool cpu_is_u8500v11(void); | ||
70 | bool cpu_is_u8500v20(void); | ||
71 | #else | ||
72 | static inline bool cpu_is_u8500v10(void) { return false; } | ||
73 | static inline bool cpu_is_u8500v11(void) { return false; } | ||
74 | static inline bool cpu_is_u8500v20(void) { return false; } | ||
75 | #endif | ||
76 | |||
77 | static inline bool cpu_is_u5500(void) | ||
78 | { | ||
79 | #ifdef CONFIG_UX500_SOC_DB5500 | ||
80 | return 1; | ||
81 | #else | ||
82 | return 0; | ||
83 | #endif | ||
84 | } | ||
85 | 38 | ||
86 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | 39 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) |
87 | #define ux500_unknown_soc() BUG() | ||
88 | 40 | ||
89 | #endif | 41 | #endif |
90 | 42 | ||
diff --git a/arch/arm/mach-ux500/include/mach/id.h b/arch/arm/mach-ux500/include/mach/id.h new file mode 100644 index 000000000000..f1288d10b6ab --- /dev/null +++ b/arch/arm/mach-ux500/include/mach/id.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson | ||
5 | * License terms: GNU General Public License (GPL) version 2 | ||
6 | */ | ||
7 | |||
8 | #ifndef __MACH_UX500_ID | ||
9 | #define __MACH_UX500_ID | ||
10 | |||
11 | /** | ||
12 | * struct dbx500_asic_id - fields of the ASIC ID | ||
13 | * @process: the manufacturing process, 0x40 is 40 nm 0x00 is "standard" | ||
14 | * @partnumber: hithereto 0x8500 for DB8500 | ||
15 | * @revision: version code in the series | ||
16 | */ | ||
17 | struct dbx500_asic_id { | ||
18 | u16 partnumber; | ||
19 | u8 revision; | ||
20 | u8 process; | ||
21 | }; | ||
22 | |||
23 | extern struct dbx500_asic_id dbx500_id; | ||
24 | |||
25 | static inline unsigned int __attribute_const__ dbx500_partnumber(void) | ||
26 | { | ||
27 | return dbx500_id.partnumber; | ||
28 | } | ||
29 | |||
30 | static inline unsigned int __attribute_const__ dbx500_revision(void) | ||
31 | { | ||
32 | return dbx500_id.revision; | ||
33 | } | ||
34 | |||
35 | /* | ||
36 | * SOCs | ||
37 | */ | ||
38 | |||
39 | static inline bool __attribute_const__ cpu_is_u8500(void) | ||
40 | { | ||
41 | return dbx500_partnumber() == 0x8500; | ||
42 | } | ||
43 | |||
44 | static inline bool __attribute_const__ cpu_is_u5500(void) | ||
45 | { | ||
46 | return dbx500_partnumber() == 0x5500; | ||
47 | } | ||
48 | |||
49 | /* | ||
50 | * 8500 revisions | ||
51 | */ | ||
52 | |||
53 | static inline bool __attribute_const__ cpu_is_u8500ed(void) | ||
54 | { | ||
55 | return cpu_is_u8500() && dbx500_revision() == 0x00; | ||
56 | } | ||
57 | |||
58 | static inline bool __attribute_const__ cpu_is_u8500v1(void) | ||
59 | { | ||
60 | return cpu_is_u8500() && (dbx500_revision() & 0xf0) == 0xA0; | ||
61 | } | ||
62 | |||
63 | static inline bool __attribute_const__ cpu_is_u8500v10(void) | ||
64 | { | ||
65 | return cpu_is_u8500() && dbx500_revision() == 0xA0; | ||
66 | } | ||
67 | |||
68 | static inline bool __attribute_const__ cpu_is_u8500v11(void) | ||
69 | { | ||
70 | return cpu_is_u8500() && dbx500_revision() == 0xA1; | ||
71 | } | ||
72 | |||
73 | static inline bool __attribute_const__ cpu_is_u8500v2(void) | ||
74 | { | ||
75 | return cpu_is_u8500() && ((dbx500_revision() & 0xf0) == 0xB0); | ||
76 | } | ||
77 | |||
78 | #define ux500_unknown_soc() BUG() | ||
79 | |||
80 | #endif | ||
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h index 5d8423294d41..a7d363fdb4cd 100644 --- a/arch/arm/mach-ux500/include/mach/setup.h +++ b/arch/arm/mach-ux500/include/mach/setup.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/mach/time.h> | 14 | #include <asm/mach/time.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | 16 | ||
17 | void __init ux500_map_io(void); | ||
17 | extern void __init u5500_map_io(void); | 18 | extern void __init u5500_map_io(void); |
18 | extern void __init u8500_map_io(void); | 19 | extern void __init u8500_map_io(void); |
19 | 20 | ||