1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * OMAP cpu type detection
5 * Copyright (C) 2004, 2008 Nokia Corporation
7 * Copyright (C) 2009-11 Texas Instruments.
9 * Written by Tony Lindgren <tony.lindgren@nokia.com>
11 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
14 #ifndef __ASM_ARCH_OMAP_CPU_H
15 #define __ASM_ARCH_OMAP_CPU_H
18 #include <mach/hardware.h>
19 #include <mach/irqs.h>
23 #include <linux/bitops.h>
26 * Test if multicore OMAP support is needed
31 #ifdef CONFIG_ARCH_OMAP730
36 # define OMAP_NAME omap730
39 #ifdef CONFIG_ARCH_OMAP850
44 # define OMAP_NAME omap850
47 #ifdef CONFIG_ARCH_OMAP15XX
52 # define OMAP_NAME omap1510
55 #ifdef CONFIG_ARCH_OMAP16XX
60 # define OMAP_NAME omap16xx
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]
70 unsigned int omap_rev(void);
73 * Get the CPU revision for OMAP devices
75 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
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
84 #define GET_OMAP_CLASS (omap_rev() & 0xff)
86 #define IS_OMAP_CLASS(class, id) \
87 static inline int is_omap ##class (void) \
89 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
92 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
94 #define IS_OMAP_SUBCLASS(subclass, id) \
95 static inline int is_omap ##subclass (void) \
97 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
100 IS_OMAP_CLASS(7xx
, 0x07)
101 IS_OMAP_CLASS(15xx
, 0x15)
102 IS_OMAP_CLASS(16xx
, 0x16)
104 #define cpu_is_omap7xx() 0
105 #define cpu_is_omap15xx() 0
106 #define cpu_is_omap16xx() 0
108 #if defined(MULTI_OMAP1)
109 # if defined(CONFIG_ARCH_OMAP730)
110 # undef cpu_is_omap7xx
111 # define cpu_is_omap7xx() is_omap7xx()
113 # if defined(CONFIG_ARCH_OMAP850)
114 # undef cpu_is_omap7xx
115 # define cpu_is_omap7xx() is_omap7xx()
117 # if defined(CONFIG_ARCH_OMAP15XX)
118 # undef cpu_is_omap15xx
119 # define cpu_is_omap15xx() is_omap15xx()
121 # if defined(CONFIG_ARCH_OMAP16XX)
122 # undef cpu_is_omap16xx
123 # define cpu_is_omap16xx() is_omap16xx()
126 # if defined(CONFIG_ARCH_OMAP730)
127 # undef cpu_is_omap7xx
128 # define cpu_is_omap7xx() 1
130 # if defined(CONFIG_ARCH_OMAP850)
131 # undef cpu_is_omap7xx
132 # define cpu_is_omap7xx() 1
134 # if defined(CONFIG_ARCH_OMAP15XX)
135 # undef cpu_is_omap15xx
136 # define cpu_is_omap15xx() 1
138 # if defined(CONFIG_ARCH_OMAP16XX)
139 # undef cpu_is_omap16xx
140 # define cpu_is_omap16xx() 1
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
155 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
157 #define IS_OMAP_TYPE(type, id) \
158 static inline int is_omap ##type (void) \
160 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
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)
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
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
188 #define soc_is_dra7xx() 0
189 #define soc_is_am33xx() 0
190 #define cpu_class_is_omap1() 1
191 #define cpu_class_is_omap2() 0
195 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
196 * between 310 vs. 1510 and 1611B/5912 vs. 1710.
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()
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()
219 #endif /* __ASSEMBLY__ */