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 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 31 | #define omap2_cpu_rev() ((system_rev >> 8) & 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 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 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" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | # else |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 68 | # undef MULTI_OMAP2 |
| 69 | # define OMAP_NAME omap24xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | # endif |
| 71 | #endif |
| 72 | |
| 73 | /* |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 74 | * Macros to group OMAP into cpu classes. |
| 75 | * These can be used in most places. |
| 76 | * cpu_is_omap7xx(): True for OMAP730 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 77 | * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 78 | * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | #define GET_OMAP_CLASS (system_rev & 0xff) |
| 84 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 104 | IS_OMAP_SUBCLASS(242x, 0x242) |
| 105 | IS_OMAP_SUBCLASS(243x, 0x243) |
| 106 | |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 107 | #define cpu_is_omap7xx() 0 |
| 108 | #define cpu_is_omap15xx() 0 |
| 109 | #define cpu_is_omap16xx() 0 |
| 110 | #define cpu_is_omap24xx() 0 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 111 | #define cpu_is_omap242x() 0 |
| 112 | #define cpu_is_omap243x() 0 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 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 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 119 | # if defined(CONFIG_ARCH_OMAP15XX) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | # define cpu_is_omap16xx() is_omap16xx() |
| 126 | # endif |
| 127 | #else |
| 128 | # if defined(CONFIG_ARCH_OMAP730) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 129 | # undef cpu_is_omap7xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | # define cpu_is_omap7xx() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | # endif |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 132 | # if defined(CONFIG_ARCH_OMAP15XX) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 133 | # undef cpu_is_omap15xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | # define cpu_is_omap15xx() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | # endif |
| 136 | # if defined(CONFIG_ARCH_OMAP16XX) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 137 | # undef cpu_is_omap16xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | # define cpu_is_omap16xx() 1 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 139 | # endif |
| 140 | # if defined(CONFIG_ARCH_OMAP24XX) |
| 141 | # undef cpu_is_omap24xx |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 142 | # undef cpu_is_omap242x |
| 143 | # undef cpu_is_omap243x |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 144 | # define cpu_is_omap24xx() 1 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 145 | # define cpu_is_omap242x() is_omap242x() |
| 146 | # define cpu_is_omap243x() is_omap243x() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | # endif |
| 148 | #endif |
| 149 | |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 150 | /* |
| 151 | * Macros to detect individual cpu types. |
| 152 | * These are only rarely needed. |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 153 | * cpu_is_omap330(): True for OMAP330 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 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 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 162 | * cpu_is_omap2422(): True for OMAP2422 |
| 163 | * cpu_is_omap2423(): True for OMAP2423 |
| 164 | * cpu_is_omap2430(): True for OMAP2430 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 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 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 174 | IS_OMAP_TYPE(310, 0x0310) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 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) |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 183 | IS_OMAP_TYPE(2422, 0x2422) |
| 184 | IS_OMAP_TYPE(2423, 0x2423) |
| 185 | IS_OMAP_TYPE(2430, 0x2430) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 186 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 187 | #define cpu_is_omap310() 0 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 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 |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 196 | #define cpu_is_omap2422() 0 |
| 197 | #define cpu_is_omap2423() 0 |
| 198 | #define cpu_is_omap2430() 0 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 199 | |
| 200 | #if defined(MULTI_OMAP1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | # if defined(CONFIG_ARCH_OMAP730) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 202 | # undef cpu_is_omap730 |
| 203 | # define cpu_is_omap730() is_omap730() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | # endif |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 205 | #else |
| 206 | # if defined(CONFIG_ARCH_OMAP730) |
| 207 | # undef cpu_is_omap730 |
| 208 | # define cpu_is_omap730() 1 |
| 209 | # endif |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 210 | #endif |
| 211 | |
| 212 | /* |
| 213 | * Whether we have MULTI_OMAP1 or not, we still need to distinguish |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 214 | * between 330 vs. 1510 and 1611B/5912 vs. 1710. |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 215 | */ |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 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 | |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | # define cpu_is_omap1610() is_omap1610() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 230 | # define cpu_is_omap1611() is_omap1611() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | # define cpu_is_omap5912() is_omap5912() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 232 | # define cpu_is_omap1621() is_omap1621() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | # define cpu_is_omap1710() is_omap1710() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame] | 234 | #endif |
| 235 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 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() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | #endif |
| 246 | |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | #endif |