1 /* 2 * linux/include/asm-arm/arch-omap/cpu.h 3 * 4 * OMAP cpu type detection 5 * 6 * Copyright (C) 2004 Nokia Corporation 7 * 8 * Written by Tony Lindgren <tony.lindgren (at) nokia.com> 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * 24 */ 25 26 #ifndef __ASM_ARCH_OMAP_CPU_H 27 #define __ASM_ARCH_OMAP_CPU_H 28 29 extern unsigned int system_rev; 30 31 #define omap2_cpu_rev() ((system_rev >> 8) & 0x0f) 32 33 /* 34 * Test if multicore OMAP support is needed 35 */ 36 #undef MULTI_OMAP1 37 #undef MULTI_OMAP2 38 #undef OMAP_NAME 39 40 #ifdef CONFIG_ARCH_OMAP730 41 # ifdef OMAP_NAME 42 # undef MULTI_OMAP1 43 # define MULTI_OMAP1 44 # else 45 # define OMAP_NAME omap730 46 # endif 47 #endif 48 #ifdef CONFIG_ARCH_OMAP15XX 49 # ifdef OMAP_NAME 50 # undef MULTI_OMAP1 51 # define MULTI_OMAP1 52 # else 53 # define OMAP_NAME omap1510 54 # endif 55 #endif 56 #ifdef CONFIG_ARCH_OMAP16XX 57 # ifdef OMAP_NAME 58 # undef MULTI_OMAP1 59 # define MULTI_OMAP1 60 # else 61 # define OMAP_NAME omap16xx 62 # endif 63 #endif 64 #ifdef CONFIG_ARCH_OMAP24XX 65 # if (defined(OMAP_NAME) || defined(MULTI_OMAP1)) 66 # error "OMAP1 and OMAP2 can't be selected at the same time" 67 # else 68 # undef MULTI_OMAP2 69 # define OMAP_NAME omap24xx 70 # endif 71 #endif 72 73 /* 74 * Macros to group OMAP into cpu classes. 75 * These can be used in most places. 76 * cpu_is_omap7xx(): True for OMAP730 77 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 78 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 79 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 80 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 81 * cpu_is_omap243x(): True for OMAP2430 82 */ 83 #define GET_OMAP_CLASS (system_rev & 0xff) 84 85 #define IS_OMAP_CLASS(class, id) \ 86 static inline int is_omap ##class (void) \ 87 { \ 88 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ 89 } 90 91 #define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff) 92 93 #define IS_OMAP_SUBCLASS(subclass, id) \ 94 static inline int is_omap ##subclass (void) \ 95 { \ 96 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 97 } 98 99 IS_OMAP_CLASS(7xx, 0x07) 100 IS_OMAP_CLASS(15xx, 0x15) 101 IS_OMAP_CLASS(16xx, 0x16) 102 IS_OMAP_CLASS(24xx, 0x24) 103 104 IS_OMAP_SUBCLASS(242x, 0x242) 105 IS_OMAP_SUBCLASS(243x, 0x243) 106 107 #define cpu_is_omap7xx() 0 108 #define cpu_is_omap15xx() 0 109 #define cpu_is_omap16xx() 0 110 #define cpu_is_omap24xx() 0 111 #define cpu_is_omap242x() 0 112 #define cpu_is_omap243x() 0 113 114 #if defined(MULTI_OMAP1) 115 # if defined(CONFIG_ARCH_OMAP730) 116 # undef cpu_is_omap7xx 117 # define cpu_is_omap7xx() is_omap7xx() 118 # endif 119 # if defined(CONFIG_ARCH_OMAP15XX) 120 # undef cpu_is_omap15xx 121 # define cpu_is_omap15xx() is_omap15xx() 122 # endif 123 # if defined(CONFIG_ARCH_OMAP16XX) 124 # undef cpu_is_omap16xx 125 # define cpu_is_omap16xx() is_omap16xx() 126 # endif 127 #else 128 # if defined(CONFIG_ARCH_OMAP730) 129 # undef cpu_is_omap7xx 130 # define cpu_is_omap7xx() 1 131 # endif 132 # if defined(CONFIG_ARCH_OMAP15XX) 133 # undef cpu_is_omap15xx 134 # define cpu_is_omap15xx() 1 135 # endif 136 # if defined(CONFIG_ARCH_OMAP16XX) 137 # undef cpu_is_omap16xx 138 # define cpu_is_omap16xx() 1 139 # endif 140 # if defined(CONFIG_ARCH_OMAP24XX) 141 # undef cpu_is_omap24xx 142 # undef cpu_is_omap242x 143 # undef cpu_is_omap243x 144 # define cpu_is_omap24xx() 1 145 # define cpu_is_omap242x() is_omap242x() 146 # define cpu_is_omap243x() is_omap243x() 147 # endif 148 #endif 149 150 /* 151 * Macros to detect individual cpu types. 152 * These are only rarely needed. 153 * cpu_is_omap330(): True for OMAP330 154 * cpu_is_omap730(): True for OMAP730 155 * cpu_is_omap1510(): True for OMAP1510 156 * cpu_is_omap1610(): True for OMAP1610 157 * cpu_is_omap1611(): True for OMAP1611 158 * cpu_is_omap5912(): True for OMAP5912 159 * cpu_is_omap1621(): True for OMAP1621 160 * cpu_is_omap1710(): True for OMAP1710 161 * cpu_is_omap2420(): True for OMAP2420 162 * cpu_is_omap2422(): True for OMAP2422 163 * cpu_is_omap2423(): True for OMAP2423 164 * cpu_is_omap2430(): True for OMAP2430 165 */ 166 #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) 167 168 #define IS_OMAP_TYPE(type, id) \ 169 static inline int is_omap ##type (void) \ 170 { \ 171 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ 172 } 173 174 IS_OMAP_TYPE(310, 0x0310) 175 IS_OMAP_TYPE(730, 0x0730) 176 IS_OMAP_TYPE(1510, 0x1510) 177 IS_OMAP_TYPE(1610, 0x1610) 178 IS_OMAP_TYPE(1611, 0x1611) 179 IS_OMAP_TYPE(5912, 0x1611) 180 IS_OMAP_TYPE(1621, 0x1621) 181 IS_OMAP_TYPE(1710, 0x1710) 182 IS_OMAP_TYPE(2420, 0x2420) 183 IS_OMAP_TYPE(2422, 0x2422) 184 IS_OMAP_TYPE(2423, 0x2423) 185 IS_OMAP_TYPE(2430, 0x2430) 186 187 #define cpu_is_omap310() 0 188 #define cpu_is_omap730() 0 189 #define cpu_is_omap1510() 0 190 #define cpu_is_omap1610() 0 191 #define cpu_is_omap5912() 0 192 #define cpu_is_omap1611() 0 193 #define cpu_is_omap1621() 0 194 #define cpu_is_omap1710() 0 195 #define cpu_is_omap2420() 0 196 #define cpu_is_omap2422() 0 197 #define cpu_is_omap2423() 0 198 #define cpu_is_omap2430() 0 199 200 #if defined(MULTI_OMAP1) 201 # if defined(CONFIG_ARCH_OMAP730) 202 # undef cpu_is_omap730 203 # define cpu_is_omap730() is_omap730() 204 # endif 205 #else 206 # if defined(CONFIG_ARCH_OMAP730) 207 # undef cpu_is_omap730 208 # define cpu_is_omap730() 1 209 # endif 210 #endif 211 212 /* 213 * Whether we have MULTI_OMAP1 or not, we still need to distinguish 214 * between 330 vs. 1510 and 1611B/5912 vs. 1710. 215 */ 216 #if defined(CONFIG_ARCH_OMAP15XX) 217 # undef cpu_is_omap310 218 # undef cpu_is_omap1510 219 # define cpu_is_omap310() is_omap310() 220 # define cpu_is_omap1510() is_omap1510() 221 #endif 222 223 #if defined(CONFIG_ARCH_OMAP16XX) 224 # undef cpu_is_omap1610 225 # undef cpu_is_omap1611 226 # undef cpu_is_omap5912 227 # undef cpu_is_omap1621 228 # undef cpu_is_omap1710 229 # define cpu_is_omap1610() is_omap1610() 230 # define cpu_is_omap1611() is_omap1611() 231 # define cpu_is_omap5912() is_omap5912() 232 # define cpu_is_omap1621() is_omap1621() 233 # define cpu_is_omap1710() is_omap1710() 234 #endif 235 236 #if defined(CONFIG_ARCH_OMAP24XX) 237 # undef cpu_is_omap2420 238 # undef cpu_is_omap2422 239 # undef cpu_is_omap2423 240 # undef cpu_is_omap2430 241 # define cpu_is_omap2420() is_omap2420() 242 # define cpu_is_omap2422() is_omap2422() 243 # define cpu_is_omap2423() is_omap2423() 244 # define cpu_is_omap2430() is_omap2430() 245 #endif 246 247 /* Macros to detect if we have OMAP1 or OMAP2 */ 248 #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \ 249 cpu_is_omap16xx()) 250 #define cpu_class_is_omap2() cpu_is_omap24xx() 251 252 #endif 253