blob: c6e2db9e9e5143db632a422fee1ff46067651715 [file] [log] [blame]
Rabin Vincentabf12d72010-12-08 11:07:59 +05301/*
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 */
17struct dbx500_asic_id {
18 u16 partnumber;
19 u8 revision;
20 u8 process;
21};
22
23extern struct dbx500_asic_id dbx500_id;
24
25static inline unsigned int __attribute_const__ dbx500_partnumber(void)
26{
27 return dbx500_id.partnumber;
28}
29
30static inline unsigned int __attribute_const__ dbx500_revision(void)
31{
32 return dbx500_id.revision;
33}
34
35/*
36 * SOCs
37 */
38
39static inline bool __attribute_const__ cpu_is_u8500(void)
40{
41 return dbx500_partnumber() == 0x8500;
42}
43
Linus Walleijbc71c092012-01-23 11:54:44 +010044static inline bool __attribute_const__ cpu_is_u9540(void)
45{
46 return dbx500_partnumber() == 0x9540;
47}
48
49static inline bool cpu_is_u8500_family(void)
50{
51 return cpu_is_u8500() || cpu_is_u9540();
52}
53
Rabin Vincentabf12d72010-12-08 11:07:59 +053054static inline bool __attribute_const__ cpu_is_u5500(void)
55{
56 return dbx500_partnumber() == 0x5500;
57}
58
59/*
Linus Walleijd5608bb2011-12-15 11:41:09 +010060 * 5500 revisions
61 */
62
63static inline bool __attribute_const__ cpu_is_u5500v1(void)
64{
65 return cpu_is_u5500() && (dbx500_revision() & 0xf0) == 0xA0;
66}
67
68static inline bool __attribute_const__ cpu_is_u5500v2(void)
69{
70 return (dbx500_id.revision & 0xf0) == 0xB0;
71}
72
73static inline bool __attribute_const__ cpu_is_u5500v20(void)
74{
75 return cpu_is_u5500() && ((dbx500_revision() & 0xf0) == 0xB0);
76}
77
78static inline bool __attribute_const__ cpu_is_u5500v21(void)
79{
80 return cpu_is_u5500() && (dbx500_revision() == 0xB1);
81}
82
83/*
Rabin Vincentabf12d72010-12-08 11:07:59 +053084 * 8500 revisions
85 */
86
87static inline bool __attribute_const__ cpu_is_u8500ed(void)
88{
89 return cpu_is_u8500() && dbx500_revision() == 0x00;
90}
91
92static inline bool __attribute_const__ cpu_is_u8500v1(void)
93{
94 return cpu_is_u8500() && (dbx500_revision() & 0xf0) == 0xA0;
95}
96
97static inline bool __attribute_const__ cpu_is_u8500v10(void)
98{
99 return cpu_is_u8500() && dbx500_revision() == 0xA0;
100}
101
102static inline bool __attribute_const__ cpu_is_u8500v11(void)
103{
104 return cpu_is_u8500() && dbx500_revision() == 0xA1;
105}
106
107static inline bool __attribute_const__ cpu_is_u8500v2(void)
108{
109 return cpu_is_u8500() && ((dbx500_revision() & 0xf0) == 0xB0);
110}
111
Linus Walleij5d99eae2011-03-29 22:05:06 +0200112static inline bool cpu_is_u8500v20(void)
113{
114 return cpu_is_u8500() && (dbx500_revision() == 0xB0);
115}
116
117static inline bool cpu_is_u8500v21(void)
118{
119 return cpu_is_u8500() && (dbx500_revision() == 0xB1);
120}
121
122static inline bool cpu_is_u8500v20_or_later(void)
123{
Linus Walleijbc71c092012-01-23 11:54:44 +0100124 /*
125 * U9540 has so much in common with U8500 that is is considered a
126 * U8500 variant.
127 */
128 return cpu_is_u9540() ||
129 (cpu_is_u8500() && !cpu_is_u8500v10() && !cpu_is_u8500v11());
Linus Walleij5d99eae2011-03-29 22:05:06 +0200130}
131
132static inline bool ux500_is_svp(void)
133{
134 return false;
135}
136
Rabin Vincentabf12d72010-12-08 11:07:59 +0530137#define ux500_unknown_soc() BUG()
138
139#endif