summaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/include/mach/id.h
blob: b27902a5f2b35b0310579913f154373ab73a8f2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
 * Copyright (C) ST-Ericsson SA 2010
 *
 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
 * License terms: GNU General Public License (GPL) version 2
 */

#ifndef __MACH_UX500_ID
#define __MACH_UX500_ID

/**
 * struct dbx500_asic_id - fields of the ASIC ID
 * @process: the manufacturing process, 0x40 is 40 nm 0x00 is "standard"
 * @partnumber: hithereto 0x8500 for DB8500
 * @revision: version code in the series
 */
struct dbx500_asic_id {
	u16	partnumber;
	u8	revision;
	u8	process;
};

extern struct dbx500_asic_id dbx500_id;

static inline unsigned int __attribute_const__ dbx500_partnumber(void)
{
	return dbx500_id.partnumber;
}

static inline unsigned int __attribute_const__ dbx500_revision(void)
{
	return dbx500_id.revision;
}

/*
 * SOCs
 */

static inline bool __attribute_const__ cpu_is_u8500(void)
{
#ifdef CONFIG_UX500_SOC_DB8500
	/* partnumber 8520 also comes under 8500 */
	return ((dbx500_partnumber() >> 8) & 0xff) == 0x85;
#else
	return false;
#endif
}

static inline bool __attribute_const__ cpu_is_u8520(void)
{
#ifdef CONFIG_UX500_SOC_DB8500
	return dbx500_partnumber() == 0x8520;
#else
	return false;
#endif
}

static inline bool __attribute_const__ cpu_is_u5500(void)
{
#ifdef CONFIG_UX500_SOC_DB5500
	return dbx500_partnumber() == 0x5500;
#else
	return false;
#endif
}

#ifdef CONFIG_UX500_SOC_DB8500
bool cpu_is_u9500(void);
#else
static inline bool cpu_is_u9500(void)
{
	return false;
}
#endif

/*
 * 5500 revisions
 */

static inline bool __attribute_const__ cpu_is_u5500v1(void)
{
	return cpu_is_u5500() && (dbx500_revision() & 0xf0) == 0xA0;
}

static inline bool __attribute_const__ cpu_is_u5500v2(void)
{
	return (dbx500_id.revision & 0xf0) == 0xB0;
}

static inline bool __attribute_const__ cpu_is_u5500v20(void)
{
	return cpu_is_u5500() && ((dbx500_revision() & 0xf0) == 0xB0);
}

static inline bool __attribute_const__ cpu_is_u5500v21(void)
{
	return cpu_is_u5500() && (dbx500_revision() == 0xB1);
}

/*
 * 8500 revisions
 */

static inline bool __attribute_const__ cpu_is_u8500v2(void)
{
	return cpu_is_u8500() && ((dbx500_revision() & 0xf0) == 0xB0);
}

static inline bool cpu_is_u8500v20(void)
{
	return cpu_is_u8500() && (dbx500_revision() == 0xB0);
}

static inline bool cpu_is_u8500v21(void)
{
	return cpu_is_u8500() && (dbx500_revision() == 0xB1);
}

static inline bool cpu_is_u8500v22(void)
{
	return cpu_is_u8500() && (dbx500_revision() == 0xB2);
}

static inline bool cpu_is_u8500v20_or_later(void)
{
	return cpu_is_u8500() && ((dbx500_revision() & 0xf0) >= 0xB0);
}

static inline bool ux500_is_svp(void)
{
	return false;
}

#define ux500_unknown_soc()	BUG()

#endif