Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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@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 | |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 31 | #define omap2_cpu_rev() ((system_rev >> 12) & 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
| 33 | /* |
| 34 | * Test if multicore OMAP support is needed |
| 35 | */ |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 36 | #undef MULTI_OMAP1 |
| 37 | #undef MULTI_OMAP2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | #undef OMAP_NAME |
| 39 | |
| 40 | #ifdef CONFIG_ARCH_OMAP730 |
| 41 | # ifdef OMAP_NAME |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 42 | # undef MULTI_OMAP1 |
| 43 | # define MULTI_OMAP1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | # else |
| 45 | # define OMAP_NAME omap730 |
| 46 | # endif |
| 47 | #endif |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 48 | #ifdef CONFIG_ARCH_OMAP15XX |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | # ifdef OMAP_NAME |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 50 | # undef MULTI_OMAP1 |
| 51 | # define MULTI_OMAP1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | # else |
| 53 | # define OMAP_NAME omap1510 |
| 54 | # endif |
| 55 | #endif |
| 56 | #ifdef CONFIG_ARCH_OMAP16XX |
| 57 | # ifdef OMAP_NAME |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 58 | # undef MULTI_OMAP1 |
| 59 | # define MULTI_OMAP1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | # else |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 61 | # define OMAP_NAME omap16xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | # endif |
| 63 | #endif |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 64 | #if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 65 | # if (defined(OMAP_NAME) || defined(MULTI_OMAP1)) |
| 66 | # error "OMAP1 and OMAP2 can't be selected at the same time" |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 67 | # endif |
| 68 | #endif |
| 69 | #ifdef CONFIG_ARCH_OMAP2420 |
| 70 | # ifdef OMAP_NAME |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 71 | # undef MULTI_OMAP2 |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 72 | # define MULTI_OMAP2 |
| 73 | # else |
| 74 | # define OMAP_NAME omap2420 |
| 75 | # endif |
| 76 | #endif |
| 77 | #ifdef CONFIG_ARCH_OMAP2430 |
| 78 | # ifdef OMAP_NAME |
| 79 | # undef MULTI_OMAP2 |
| 80 | # define MULTI_OMAP2 |
| 81 | # else |
| 82 | # define OMAP_NAME omap2430 |
| 83 | # endif |
| 84 | #endif |
| 85 | #ifdef CONFIG_ARCH_OMAP3430 |
| 86 | # ifdef OMAP_NAME |
| 87 | # undef MULTI_OMAP2 |
| 88 | # define MULTI_OMAP2 |
| 89 | # else |
| 90 | # define OMAP_NAME omap3430 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | # endif |
| 92 | #endif |
| 93 | |
| 94 | /* |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 95 | * Macros to group OMAP into cpu classes. |
| 96 | * These can be used in most places. |
| 97 | * cpu_is_omap7xx(): True for OMAP730 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 98 | * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 99 | * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 100 | * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 |
| 101 | * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 |
| 102 | * cpu_is_omap243x(): True for OMAP2430 |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 103 | * cpu_is_omap343x(): True for OMAP3430 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | */ |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 105 | #define GET_OMAP_CLASS ((system_rev >> 24) & 0xff) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | #define IS_OMAP_CLASS(class, id) \ |
| 108 | static inline int is_omap ##class (void) \ |
| 109 | { \ |
| 110 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ |
| 111 | } |
| 112 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 113 | #define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff) |
| 114 | |
| 115 | #define IS_OMAP_SUBCLASS(subclass, id) \ |
| 116 | static inline int is_omap ##subclass (void) \ |
| 117 | { \ |
| 118 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ |
| 119 | } |
| 120 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | IS_OMAP_CLASS(7xx, 0x07) |
| 122 | IS_OMAP_CLASS(15xx, 0x15) |
| 123 | IS_OMAP_CLASS(16xx, 0x16) |
| 124 | IS_OMAP_CLASS(24xx, 0x24) |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 125 | IS_OMAP_CLASS(34xx, 0x34) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 127 | IS_OMAP_SUBCLASS(242x, 0x242) |
| 128 | IS_OMAP_SUBCLASS(243x, 0x243) |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 129 | IS_OMAP_SUBCLASS(343x, 0x343) |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 130 | |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 131 | #define cpu_is_omap7xx() 0 |
| 132 | #define cpu_is_omap15xx() 0 |
| 133 | #define cpu_is_omap16xx() 0 |
| 134 | #define cpu_is_omap24xx() 0 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 135 | #define cpu_is_omap242x() 0 |
| 136 | #define cpu_is_omap243x() 0 |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 137 | #define cpu_is_omap34xx() 0 |
| 138 | #define cpu_is_omap343x() 0 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 139 | |
| 140 | #if defined(MULTI_OMAP1) |
| 141 | # if defined(CONFIG_ARCH_OMAP730) |
| 142 | # undef cpu_is_omap7xx |
| 143 | # define cpu_is_omap7xx() is_omap7xx() |
| 144 | # endif |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 145 | # if defined(CONFIG_ARCH_OMAP15XX) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 146 | # undef cpu_is_omap15xx |
| 147 | # define cpu_is_omap15xx() is_omap15xx() |
| 148 | # endif |
| 149 | # if defined(CONFIG_ARCH_OMAP16XX) |
| 150 | # undef cpu_is_omap16xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | # define cpu_is_omap16xx() is_omap16xx() |
| 152 | # endif |
| 153 | #else |
| 154 | # if defined(CONFIG_ARCH_OMAP730) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 155 | # undef cpu_is_omap7xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | # define cpu_is_omap7xx() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | # endif |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 158 | # if defined(CONFIG_ARCH_OMAP15XX) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 159 | # undef cpu_is_omap15xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | # define cpu_is_omap15xx() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | # endif |
| 162 | # if defined(CONFIG_ARCH_OMAP16XX) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 163 | # undef cpu_is_omap16xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | # define cpu_is_omap16xx() 1 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 165 | # endif |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 166 | #endif |
| 167 | |
| 168 | #if defined(MULTI_OMAP2) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 169 | # if defined(CONFIG_ARCH_OMAP24XX) |
| 170 | # undef cpu_is_omap24xx |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 171 | # undef cpu_is_omap242x |
| 172 | # undef cpu_is_omap243x |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 173 | # define cpu_is_omap24xx() is_omap24xx() |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 174 | # define cpu_is_omap242x() is_omap242x() |
| 175 | # define cpu_is_omap243x() is_omap243x() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | # endif |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 177 | # if defined(CONFIG_ARCH_OMAP34XX) |
| 178 | # undef cpu_is_omap34xx |
| 179 | # undef cpu_is_omap343x |
| 180 | # define cpu_is_omap34xx() is_omap34xx() |
| 181 | # define cpu_is_omap343x() is_omap343x() |
| 182 | # endif |
| 183 | #else |
| 184 | # if defined(CONFIG_ARCH_OMAP24XX) |
| 185 | # undef cpu_is_omap24xx |
| 186 | # define cpu_is_omap24xx() 1 |
| 187 | # endif |
| 188 | # if defined(CONFIG_ARCH_OMAP2420) |
| 189 | # undef cpu_is_omap242x |
| 190 | # define cpu_is_omap242x() 1 |
| 191 | # endif |
| 192 | # if defined(CONFIG_ARCH_OMAP2430) |
| 193 | # undef cpu_is_omap243x |
| 194 | # define cpu_is_omap243x() 1 |
| 195 | # endif |
| 196 | # if defined(CONFIG_ARCH_OMAP34XX) |
| 197 | # undef cpu_is_omap34xx |
| 198 | # define cpu_is_omap34xx() 1 |
| 199 | # endif |
| 200 | # if defined(CONFIG_ARCH_OMAP3430) |
| 201 | # undef cpu_is_omap343x |
| 202 | # define cpu_is_omap343x() 1 |
| 203 | # endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | #endif |
| 205 | |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 206 | /* |
| 207 | * Macros to detect individual cpu types. |
| 208 | * These are only rarely needed. |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 209 | * cpu_is_omap330(): True for OMAP330 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 210 | * cpu_is_omap730(): True for OMAP730 |
| 211 | * cpu_is_omap1510(): True for OMAP1510 |
| 212 | * cpu_is_omap1610(): True for OMAP1610 |
| 213 | * cpu_is_omap1611(): True for OMAP1611 |
| 214 | * cpu_is_omap5912(): True for OMAP5912 |
| 215 | * cpu_is_omap1621(): True for OMAP1621 |
| 216 | * cpu_is_omap1710(): True for OMAP1710 |
| 217 | * cpu_is_omap2420(): True for OMAP2420 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 218 | * cpu_is_omap2422(): True for OMAP2422 |
| 219 | * cpu_is_omap2423(): True for OMAP2423 |
| 220 | * cpu_is_omap2430(): True for OMAP2430 |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 221 | * cpu_is_omap3430(): True for OMAP3430 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 222 | */ |
| 223 | #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) |
| 224 | |
| 225 | #define IS_OMAP_TYPE(type, id) \ |
| 226 | static inline int is_omap ##type (void) \ |
| 227 | { \ |
| 228 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ |
| 229 | } |
| 230 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 231 | IS_OMAP_TYPE(310, 0x0310) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 232 | IS_OMAP_TYPE(730, 0x0730) |
| 233 | IS_OMAP_TYPE(1510, 0x1510) |
| 234 | IS_OMAP_TYPE(1610, 0x1610) |
| 235 | IS_OMAP_TYPE(1611, 0x1611) |
| 236 | IS_OMAP_TYPE(5912, 0x1611) |
| 237 | IS_OMAP_TYPE(1621, 0x1621) |
| 238 | IS_OMAP_TYPE(1710, 0x1710) |
| 239 | IS_OMAP_TYPE(2420, 0x2420) |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 240 | IS_OMAP_TYPE(2422, 0x2422) |
| 241 | IS_OMAP_TYPE(2423, 0x2423) |
| 242 | IS_OMAP_TYPE(2430, 0x2430) |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 243 | IS_OMAP_TYPE(3430, 0x3430) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 244 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 245 | #define cpu_is_omap310() 0 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 246 | #define cpu_is_omap730() 0 |
| 247 | #define cpu_is_omap1510() 0 |
| 248 | #define cpu_is_omap1610() 0 |
| 249 | #define cpu_is_omap5912() 0 |
| 250 | #define cpu_is_omap1611() 0 |
| 251 | #define cpu_is_omap1621() 0 |
| 252 | #define cpu_is_omap1710() 0 |
| 253 | #define cpu_is_omap2420() 0 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 254 | #define cpu_is_omap2422() 0 |
| 255 | #define cpu_is_omap2423() 0 |
| 256 | #define cpu_is_omap2430() 0 |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 257 | #define cpu_is_omap3430() 0 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 258 | |
| 259 | #if defined(MULTI_OMAP1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | # if defined(CONFIG_ARCH_OMAP730) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 261 | # undef cpu_is_omap730 |
| 262 | # define cpu_is_omap730() is_omap730() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | # endif |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 264 | #else |
| 265 | # if defined(CONFIG_ARCH_OMAP730) |
| 266 | # undef cpu_is_omap730 |
| 267 | # define cpu_is_omap730() 1 |
| 268 | # endif |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 269 | #endif |
| 270 | |
| 271 | /* |
| 272 | * Whether we have MULTI_OMAP1 or not, we still need to distinguish |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 273 | * between 330 vs. 1510 and 1611B/5912 vs. 1710. |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 274 | */ |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 275 | #if defined(CONFIG_ARCH_OMAP15XX) |
| 276 | # undef cpu_is_omap310 |
| 277 | # undef cpu_is_omap1510 |
| 278 | # define cpu_is_omap310() is_omap310() |
| 279 | # define cpu_is_omap1510() is_omap1510() |
| 280 | #endif |
| 281 | |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 282 | #if defined(CONFIG_ARCH_OMAP16XX) |
| 283 | # undef cpu_is_omap1610 |
| 284 | # undef cpu_is_omap1611 |
| 285 | # undef cpu_is_omap5912 |
| 286 | # undef cpu_is_omap1621 |
| 287 | # undef cpu_is_omap1710 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | # define cpu_is_omap1610() is_omap1610() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 289 | # define cpu_is_omap1611() is_omap1611() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | # define cpu_is_omap5912() is_omap5912() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 291 | # define cpu_is_omap1621() is_omap1621() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | # define cpu_is_omap1710() is_omap1710() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 293 | #endif |
| 294 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 295 | #if defined(CONFIG_ARCH_OMAP24XX) |
| 296 | # undef cpu_is_omap2420 |
| 297 | # undef cpu_is_omap2422 |
| 298 | # undef cpu_is_omap2423 |
| 299 | # undef cpu_is_omap2430 |
| 300 | # define cpu_is_omap2420() is_omap2420() |
| 301 | # define cpu_is_omap2422() is_omap2422() |
| 302 | # define cpu_is_omap2423() is_omap2423() |
| 303 | # define cpu_is_omap2430() is_omap2430() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | #endif |
| 305 | |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 306 | #if defined(CONFIG_ARCH_OMAP34XX) |
| 307 | # undef cpu_is_omap3430 |
| 308 | # define cpu_is_omap3430() is_omap3430() |
| 309 | #endif |
| 310 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 311 | /* Macros to detect if we have OMAP1 or OMAP2 */ |
| 312 | #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \ |
| 313 | cpu_is_omap16xx()) |
Syed Mohammed Khasim | 2c17f61 | 2007-12-04 15:38:13 -0800 | [diff] [blame^] | 314 | #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) |
| 315 | |
| 316 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
| 317 | /* |
| 318 | * Macros to detect silicon revision of OMAP2/3 processors. |
| 319 | * is_sil_rev_greater_than: true if passed cpu type & its rev is greater. |
| 320 | * is_sil_rev_lesser_than: true if passed cpu type & its rev is lesser. |
| 321 | * is_sil_rev_equal_to: true if passed cpu type & its rev is equal. |
| 322 | * get_sil_rev: return the silicon rev value. |
| 323 | */ |
| 324 | #define get_sil_omap_type(rev) ((rev & 0xffff0000) >> 16) |
| 325 | #define get_sil_revision(rev) ((rev & 0x0000f000) >> 12) |
| 326 | |
| 327 | #define is_sil_rev_greater_than(rev) \ |
| 328 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ |
| 329 | (get_sil_revision(system_rev) > get_sil_revision(rev))) |
| 330 | |
| 331 | #define is_sil_rev_less_than(rev) \ |
| 332 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ |
| 333 | (get_sil_revision(system_rev) < get_sil_revision(rev))) |
| 334 | |
| 335 | #define is_sil_rev_equal_to(rev) \ |
| 336 | ((get_sil_omap_type(system_rev) == get_sil_omap_type(rev)) && \ |
| 337 | (get_sil_revision(system_rev) == get_sil_revision(rev))) |
| 338 | |
| 339 | #define get_sil_rev() \ |
| 340 | get_sil_revision(system_rev) |
| 341 | |
| 342 | /* Various silicon macros defined here */ |
| 343 | #define OMAP2420_REV_ES1_0 0x24200000 |
| 344 | #define OMAP2420_REV_ES2_0 0x24201000 |
| 345 | #define OMAP2430_REV_ES1_0 0x24300000 |
| 346 | #define OMAP3430_REV_ES1_0 0x34300000 |
| 347 | #define OMAP3430_REV_ES2_0 0x34301000 |
| 348 | |
| 349 | /* |
| 350 | * Macro to detect device type i.e. EMU/HS/TST/GP/BAD |
| 351 | */ |
| 352 | #define DEVICE_TYPE_TEST 0 |
| 353 | #define DEVICE_TYPE_EMU 1 |
| 354 | #define DEVICE_TYPE_SEC 2 |
| 355 | #define DEVICE_TYPE_GP 3 |
| 356 | #define DEVICE_TYPE_BAD 4 |
| 357 | |
| 358 | #define get_device_type() ((system_rev & 0x700) >> 8) |
| 359 | #define is_device_type_test() (get_device_type() == DEVICE_TYPE_TEST) |
| 360 | #define is_device_type_emu() (get_device_type() == DEVICE_TYPE_EMU) |
| 361 | #define is_device_type_sec() (get_device_type() == DEVICE_TYPE_SEC) |
| 362 | #define is_device_type_gp() (get_device_type() == DEVICE_TYPE_GP) |
| 363 | #define is_device_type_bad() (get_device_type() == DEVICE_TYPE_BAD) |
| 364 | |
| 365 | #endif |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 366 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | #endif |