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.
14 #ifndef __ASM_ARCH_OMAP_CPU_H
15 #define __ASM_ARCH_OMAP_CPU_H
18 * Test if multicore OMAP support is needed
23 #ifdef CONFIG_ARCH_OMAP730
28 # define OMAP_NAME omap730
31 #ifdef CONFIG_ARCH_OMAP850
36 # define OMAP_NAME omap850
39 #ifdef CONFIG_ARCH_OMAP15XX
44 # define OMAP_NAME omap1510
47 #ifdef CONFIG_ARCH_OMAP16XX
52 # define OMAP_NAME omap16xx
58 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
59 * CPU revision (See _REV_ defined in cpu.h) [15:08]
60 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
62 unsigned int omap_rev(void);
65 * Get the CPU revision for OMAP devices
67 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
70 * Macros to group OMAP into cpu classes.
71 * These can be used in most places.
72 * cpu_is_omap7xx(): True for OMAP730, OMAP850
73 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
74 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
76 #define GET_OMAP_CLASS (omap_rev() & 0xff)
78 #define IS_OMAP_CLASS(class, id) \
79 static inline int is_omap ##class (void) \
81 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
84 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
86 #define IS_OMAP_SUBCLASS(subclass, id) \
87 static inline int is_omap ##subclass (void) \
89 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
92 IS_OMAP_CLASS(7xx, 0x07)
93 IS_OMAP_CLASS(15xx, 0x15)
94 IS_OMAP_CLASS(16xx, 0x16)
96 #define cpu_is_omap7xx() 0
97 #define cpu_is_omap15xx() 0
98 #define cpu_is_omap16xx() 0
100 #if defined(MULTI_OMAP1)
101 # if defined(CONFIG_ARCH_OMAP730)
102 # undef cpu_is_omap7xx
103 # define cpu_is_omap7xx() is_omap7xx()
105 # if defined(CONFIG_ARCH_OMAP850)
106 # undef cpu_is_omap7xx
107 # define cpu_is_omap7xx() is_omap7xx()
109 # if defined(CONFIG_ARCH_OMAP15XX)
110 # undef cpu_is_omap15xx
111 # define cpu_is_omap15xx() is_omap15xx()
113 # if defined(CONFIG_ARCH_OMAP16XX)
114 # undef cpu_is_omap16xx
115 # define cpu_is_omap16xx() is_omap16xx()
118 # if defined(CONFIG_ARCH_OMAP730)
119 # undef cpu_is_omap7xx
120 # define cpu_is_omap7xx() 1
122 # if defined(CONFIG_ARCH_OMAP850)
123 # undef cpu_is_omap7xx
124 # define cpu_is_omap7xx() 1
126 # if defined(CONFIG_ARCH_OMAP15XX)
127 # undef cpu_is_omap15xx
128 # define cpu_is_omap15xx() 1
130 # if defined(CONFIG_ARCH_OMAP16XX)
131 # undef cpu_is_omap16xx
132 # define cpu_is_omap16xx() 1
137 * Macros to detect individual cpu types.
138 * These are only rarely needed.
139 * cpu_is_omap310(): True for OMAP310
140 * cpu_is_omap1510(): True for OMAP1510
141 * cpu_is_omap1610(): True for OMAP1610
142 * cpu_is_omap1611(): True for OMAP1611
143 * cpu_is_omap5912(): True for OMAP5912
144 * cpu_is_omap1621(): True for OMAP1621
145 * cpu_is_omap1710(): True for OMAP1710
147 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
149 #define IS_OMAP_TYPE(type, id) \
150 static inline int is_omap ##type (void) \
152 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
155 IS_OMAP_TYPE(310, 0x0310)
156 IS_OMAP_TYPE(1510, 0x1510)
157 IS_OMAP_TYPE(1610, 0x1610)
158 IS_OMAP_TYPE(1611, 0x1611)
159 IS_OMAP_TYPE(5912, 0x1611)
160 IS_OMAP_TYPE(1621, 0x1621)
161 IS_OMAP_TYPE(1710, 0x1710)
163 #define cpu_is_omap310() 0
164 #define cpu_is_omap1510() 0
165 #define cpu_is_omap1610() 0
166 #define cpu_is_omap5912() 0
167 #define cpu_is_omap1611() 0
168 #define cpu_is_omap1621() 0
169 #define cpu_is_omap1710() 0
171 #define cpu_class_is_omap1() 1
174 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
175 * between 310 vs. 1510 and 1611B/5912 vs. 1710.
178 #if defined(CONFIG_ARCH_OMAP15XX)
179 # undef cpu_is_omap310
180 # undef cpu_is_omap1510
181 # define cpu_is_omap310() is_omap310()
182 # define cpu_is_omap1510() is_omap1510()
185 #if defined(CONFIG_ARCH_OMAP16XX)
186 # undef cpu_is_omap1610
187 # undef cpu_is_omap1611
188 # undef cpu_is_omap5912
189 # undef cpu_is_omap1621
190 # undef cpu_is_omap1710
191 # define cpu_is_omap1610() is_omap1610()
192 # define cpu_is_omap1611() is_omap1611()
193 # define cpu_is_omap5912() is_omap5912()
194 # define cpu_is_omap1621() is_omap1621()
195 # define cpu_is_omap1710() is_omap1710()