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