]>
Commit | Line | Data |
---|---|---|
1a59d1b8 | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
4e969010 TL |
2 | /* |
3 | * OMAP cpu type detection | |
4 | * | |
5 | * Copyright (C) 2004, 2008 Nokia Corporation | |
6 | * | |
7 | * Copyright (C) 2009-11 Texas Instruments. | |
8 | * | |
9 | * Written by Tony Lindgren <tony.lindgren@nokia.com> | |
10 | * | |
11 | * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com> | |
4e969010 TL |
12 | */ |
13 | ||
14 | #ifndef __ASM_ARCH_OMAP_CPU_H | |
15 | #define __ASM_ARCH_OMAP_CPU_H | |
16 | ||
685e2d08 TL |
17 | #include <asm/irq.h> |
18 | #include <mach/hardware.h> | |
19 | #include <mach/irqs.h> | |
20 | ||
4e969010 TL |
21 | #ifndef __ASSEMBLY__ |
22 | ||
23 | #include <linux/bitops.h> | |
24 | ||
25 | /* | |
26 | * Test if multicore OMAP support is needed | |
27 | */ | |
28 | #undef MULTI_OMAP1 | |
29 | #undef OMAP_NAME | |
30 | ||
31 | #ifdef CONFIG_ARCH_OMAP730 | |
32 | # ifdef OMAP_NAME | |
33 | # undef MULTI_OMAP1 | |
34 | # define MULTI_OMAP1 | |
35 | # else | |
36 | # define OMAP_NAME omap730 | |
37 | # endif | |
38 | #endif | |
39 | #ifdef CONFIG_ARCH_OMAP850 | |
40 | # ifdef OMAP_NAME | |
41 | # undef MULTI_OMAP1 | |
42 | # define MULTI_OMAP1 | |
43 | # else | |
44 | # define OMAP_NAME omap850 | |
45 | # endif | |
46 | #endif | |
47 | #ifdef CONFIG_ARCH_OMAP15XX | |
48 | # ifdef OMAP_NAME | |
49 | # undef MULTI_OMAP1 | |
50 | # define MULTI_OMAP1 | |
51 | # else | |
52 | # define OMAP_NAME omap1510 | |
53 | # endif | |
54 | #endif | |
55 | #ifdef CONFIG_ARCH_OMAP16XX | |
56 | # ifdef OMAP_NAME | |
57 | # undef MULTI_OMAP1 | |
58 | # define MULTI_OMAP1 | |
59 | # else | |
60 | # define OMAP_NAME omap16xx | |
61 | # endif | |
62 | #endif | |
63 | ||
64 | /* | |
65 | * omap_rev bits: | |
66 | * CPU id bits (0730, 1510, 1710, 2422...) [31:16] | |
67 | * CPU revision (See _REV_ defined in cpu.h) [15:08] | |
68 | * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00] | |
69 | */ | |
70 | unsigned int omap_rev(void); | |
71 | ||
72 | /* | |
73 | * Get the CPU revision for OMAP devices | |
74 | */ | |
75 | #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) | |
76 | ||
77 | /* | |
78 | * Macros to group OMAP into cpu classes. | |
79 | * These can be used in most places. | |
80 | * cpu_is_omap7xx(): True for OMAP730, OMAP850 | |
81 | * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 | |
82 | * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 | |
83 | */ | |
84 | #define GET_OMAP_CLASS (omap_rev() & 0xff) | |
85 | ||
86 | #define IS_OMAP_CLASS(class, id) \ | |
87 | static inline int is_omap ##class (void) \ | |
88 | { \ | |
89 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ | |
90 | } | |
91 | ||
92 | #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) | |
93 | ||
94 | #define IS_OMAP_SUBCLASS(subclass, id) \ | |
95 | static inline int is_omap ##subclass (void) \ | |
96 | { \ | |
97 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ | |
98 | } | |
99 | ||
100 | IS_OMAP_CLASS(7xx, 0x07) | |
101 | IS_OMAP_CLASS(15xx, 0x15) | |
102 | IS_OMAP_CLASS(16xx, 0x16) | |
103 | ||
104 | #define cpu_is_omap7xx() 0 | |
105 | #define cpu_is_omap15xx() 0 | |
106 | #define cpu_is_omap16xx() 0 | |
107 | ||
108 | #if defined(MULTI_OMAP1) | |
109 | # if defined(CONFIG_ARCH_OMAP730) | |
110 | # undef cpu_is_omap7xx | |
111 | # define cpu_is_omap7xx() is_omap7xx() | |
112 | # endif | |
113 | # if defined(CONFIG_ARCH_OMAP850) | |
114 | # undef cpu_is_omap7xx | |
115 | # define cpu_is_omap7xx() is_omap7xx() | |
116 | # endif | |
117 | # if defined(CONFIG_ARCH_OMAP15XX) | |
118 | # undef cpu_is_omap15xx | |
119 | # define cpu_is_omap15xx() is_omap15xx() | |
120 | # endif | |
121 | # if defined(CONFIG_ARCH_OMAP16XX) | |
122 | # undef cpu_is_omap16xx | |
123 | # define cpu_is_omap16xx() is_omap16xx() | |
124 | # endif | |
125 | #else | |
126 | # if defined(CONFIG_ARCH_OMAP730) | |
127 | # undef cpu_is_omap7xx | |
128 | # define cpu_is_omap7xx() 1 | |
129 | # endif | |
130 | # if defined(CONFIG_ARCH_OMAP850) | |
131 | # undef cpu_is_omap7xx | |
132 | # define cpu_is_omap7xx() 1 | |
133 | # endif | |
134 | # if defined(CONFIG_ARCH_OMAP15XX) | |
135 | # undef cpu_is_omap15xx | |
136 | # define cpu_is_omap15xx() 1 | |
137 | # endif | |
138 | # if defined(CONFIG_ARCH_OMAP16XX) | |
139 | # undef cpu_is_omap16xx | |
140 | # define cpu_is_omap16xx() 1 | |
141 | # endif | |
142 | #endif | |
143 | ||
144 | /* | |
145 | * Macros to detect individual cpu types. | |
146 | * These are only rarely needed. | |
147 | * cpu_is_omap310(): True for OMAP310 | |
148 | * cpu_is_omap1510(): True for OMAP1510 | |
149 | * cpu_is_omap1610(): True for OMAP1610 | |
150 | * cpu_is_omap1611(): True for OMAP1611 | |
151 | * cpu_is_omap5912(): True for OMAP5912 | |
152 | * cpu_is_omap1621(): True for OMAP1621 | |
153 | * cpu_is_omap1710(): True for OMAP1710 | |
154 | */ | |
155 | #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) | |
156 | ||
157 | #define IS_OMAP_TYPE(type, id) \ | |
158 | static inline int is_omap ##type (void) \ | |
159 | { \ | |
160 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ | |
161 | } | |
162 | ||
163 | IS_OMAP_TYPE(310, 0x0310) | |
164 | IS_OMAP_TYPE(1510, 0x1510) | |
165 | IS_OMAP_TYPE(1610, 0x1610) | |
166 | IS_OMAP_TYPE(1611, 0x1611) | |
167 | IS_OMAP_TYPE(5912, 0x1611) | |
168 | IS_OMAP_TYPE(1621, 0x1621) | |
169 | IS_OMAP_TYPE(1710, 0x1710) | |
170 | ||
171 | #define cpu_is_omap310() 0 | |
172 | #define cpu_is_omap1510() 0 | |
173 | #define cpu_is_omap1610() 0 | |
174 | #define cpu_is_omap5912() 0 | |
175 | #define cpu_is_omap1611() 0 | |
176 | #define cpu_is_omap1621() 0 | |
177 | #define cpu_is_omap1710() 0 | |
178 | ||
179 | /* These are needed to compile common code */ | |
180 | #ifdef CONFIG_ARCH_OMAP1 | |
181 | #define cpu_is_omap242x() 0 | |
182 | #define cpu_is_omap2430() 0 | |
183 | #define cpu_is_omap243x() 0 | |
184 | #define cpu_is_omap24xx() 0 | |
185 | #define cpu_is_omap34xx() 0 | |
186 | #define cpu_is_omap44xx() 0 | |
187 | #define soc_is_omap54xx() 0 | |
6852215a | 188 | #define soc_is_dra7xx() 0 |
4e969010 TL |
189 | #define soc_is_am33xx() 0 |
190 | #define cpu_class_is_omap1() 1 | |
191 | #define cpu_class_is_omap2() 0 | |
192 | #endif | |
193 | ||
194 | /* | |
195 | * Whether we have MULTI_OMAP1 or not, we still need to distinguish | |
196 | * between 310 vs. 1510 and 1611B/5912 vs. 1710. | |
197 | */ | |
198 | ||
199 | #if defined(CONFIG_ARCH_OMAP15XX) | |
200 | # undef cpu_is_omap310 | |
201 | # undef cpu_is_omap1510 | |
202 | # define cpu_is_omap310() is_omap310() | |
203 | # define cpu_is_omap1510() is_omap1510() | |
204 | #endif | |
205 | ||
206 | #if defined(CONFIG_ARCH_OMAP16XX) | |
207 | # undef cpu_is_omap1610 | |
208 | # undef cpu_is_omap1611 | |
209 | # undef cpu_is_omap5912 | |
210 | # undef cpu_is_omap1621 | |
211 | # undef cpu_is_omap1710 | |
212 | # define cpu_is_omap1610() is_omap1610() | |
213 | # define cpu_is_omap1611() is_omap1611() | |
214 | # define cpu_is_omap5912() is_omap5912() | |
215 | # define cpu_is_omap1621() is_omap1621() | |
216 | # define cpu_is_omap1710() is_omap1710() | |
217 | #endif | |
218 | ||
219 | #endif /* __ASSEMBLY__ */ | |
220 | #endif |