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_OMAP15XX
28 # define OMAP_NAME omap1510
31 #ifdef CONFIG_ARCH_OMAP16XX
36 # define OMAP_NAME omap16xx
42 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
43 * CPU revision (See _REV_ defined in cpu.h) [15:08]
44 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
46 unsigned int omap_rev(void);
49 * Get the CPU revision for OMAP devices
51 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
54 * Macros to group OMAP into cpu classes.
55 * These can be used in most places.
56 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
57 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
59 #define GET_OMAP_CLASS (omap_rev() & 0xff)
61 #define IS_OMAP_CLASS(class, id) \
62 static inline int is_omap ##class (void) \
64 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
67 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
69 #define IS_OMAP_SUBCLASS(subclass, id) \
70 static inline int is_omap ##subclass (void) \
72 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
75 IS_OMAP_CLASS(15xx, 0x15)
76 IS_OMAP_CLASS(16xx, 0x16)
78 #define cpu_is_omap15xx() 0
79 #define cpu_is_omap16xx() 0
81 #if defined(MULTI_OMAP1)
82 # if defined(CONFIG_ARCH_OMAP15XX)
83 # undef cpu_is_omap15xx
84 # define cpu_is_omap15xx() is_omap15xx()
86 # if defined(CONFIG_ARCH_OMAP16XX)
87 # undef cpu_is_omap16xx
88 # define cpu_is_omap16xx() is_omap16xx()
91 # if defined(CONFIG_ARCH_OMAP15XX)
92 # undef cpu_is_omap15xx
93 # define cpu_is_omap15xx() 1
95 # if defined(CONFIG_ARCH_OMAP16XX)
96 # undef cpu_is_omap16xx
97 # define cpu_is_omap16xx() 1
102 * Macros to detect individual cpu types.
103 * These are only rarely needed.
104 * cpu_is_omap310(): True for OMAP310
105 * cpu_is_omap1510(): True for OMAP1510
106 * cpu_is_omap1610(): True for OMAP1610
107 * cpu_is_omap1611(): True for OMAP1611
108 * cpu_is_omap5912(): True for OMAP5912
109 * cpu_is_omap1621(): True for OMAP1621
110 * cpu_is_omap1710(): True for OMAP1710
112 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
114 #define IS_OMAP_TYPE(type, id) \
115 static inline int is_omap ##type (void) \
117 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
120 IS_OMAP_TYPE(310, 0x0310)
121 IS_OMAP_TYPE(1510, 0x1510)
122 IS_OMAP_TYPE(1610, 0x1610)
123 IS_OMAP_TYPE(1611, 0x1611)
124 IS_OMAP_TYPE(5912, 0x1611)
125 IS_OMAP_TYPE(1621, 0x1621)
126 IS_OMAP_TYPE(1710, 0x1710)
128 #define cpu_is_omap310() 0
129 #define cpu_is_omap1510() 0
130 #define cpu_is_omap1610() 0
131 #define cpu_is_omap5912() 0
132 #define cpu_is_omap1611() 0
133 #define cpu_is_omap1621() 0
134 #define cpu_is_omap1710() 0
136 #define cpu_class_is_omap1() 1
139 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
140 * between 310 vs. 1510 and 1611B/5912 vs. 1710.
143 #if defined(CONFIG_ARCH_OMAP15XX)
144 # undef cpu_is_omap310
145 # undef cpu_is_omap1510
146 # define cpu_is_omap310() is_omap310()
147 # define cpu_is_omap1510() is_omap1510()
150 #if defined(CONFIG_ARCH_OMAP16XX)
151 # undef cpu_is_omap1610
152 # undef cpu_is_omap1611
153 # undef cpu_is_omap5912
154 # undef cpu_is_omap1621
155 # undef cpu_is_omap1710
156 # define cpu_is_omap1610() is_omap1610()
157 # define cpu_is_omap1611() is_omap1611()
158 # define cpu_is_omap5912() is_omap5912()
159 # define cpu_is_omap1621() is_omap1621()
160 # define cpu_is_omap1710() is_omap1710()