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 | |
| 31 | #define OMAP_DIE_ID_0 0xfffe1800 |
| 32 | #define OMAP_DIE_ID_1 0xfffe1804 |
| 33 | #define OMAP_PRODUCTION_ID_0 0xfffe2000 |
| 34 | #define OMAP_PRODUCTION_ID_1 0xfffe2004 |
| 35 | #define OMAP32_ID_0 0xfffed400 |
| 36 | #define OMAP32_ID_1 0xfffed404 |
| 37 | |
| 38 | /* |
| 39 | * Test if multicore OMAP support is needed |
| 40 | */ |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 41 | #undef MULTI_OMAP1 |
| 42 | #undef MULTI_OMAP2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #undef OMAP_NAME |
| 44 | |
| 45 | #ifdef CONFIG_ARCH_OMAP730 |
| 46 | # ifdef OMAP_NAME |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 47 | # undef MULTI_OMAP1 |
| 48 | # define MULTI_OMAP1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | # else |
| 50 | # define OMAP_NAME omap730 |
| 51 | # endif |
| 52 | #endif |
| 53 | #ifdef CONFIG_ARCH_OMAP1510 |
| 54 | # ifdef OMAP_NAME |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 55 | # undef MULTI_OMAP1 |
| 56 | # define MULTI_OMAP1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | # else |
| 58 | # define OMAP_NAME omap1510 |
| 59 | # endif |
| 60 | #endif |
| 61 | #ifdef CONFIG_ARCH_OMAP16XX |
| 62 | # ifdef OMAP_NAME |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 63 | # undef MULTI_OMAP1 |
| 64 | # define MULTI_OMAP1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | # else |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 66 | # define OMAP_NAME omap16xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | # endif |
| 68 | #endif |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 69 | #ifdef CONFIG_ARCH_OMAP24XX |
| 70 | # if (defined(OMAP_NAME) || defined(MULTI_OMAP1)) |
| 71 | # error "OMAP1 and OMAP2 can't be selected at the same time" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | # else |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 73 | # undef MULTI_OMAP2 |
| 74 | # define OMAP_NAME omap24xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | # endif |
| 76 | #endif |
| 77 | |
| 78 | /* |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 79 | * Macros to group OMAP into cpu classes. |
| 80 | * These can be used in most places. |
| 81 | * cpu_is_omap7xx(): True for OMAP730 |
| 82 | * cpu_is_omap15xx(): True for OMAP1510 and OMAP5910 |
| 83 | * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 |
| 84 | * cpu_is_omap24xx(): True for OMAP2420 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | #define GET_OMAP_CLASS (system_rev & 0xff) |
| 87 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | #define IS_OMAP_CLASS(class, id) \ |
| 89 | static inline int is_omap ##class (void) \ |
| 90 | { \ |
| 91 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ |
| 92 | } |
| 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | IS_OMAP_CLASS(7xx, 0x07) |
| 95 | IS_OMAP_CLASS(15xx, 0x15) |
| 96 | IS_OMAP_CLASS(16xx, 0x16) |
| 97 | IS_OMAP_CLASS(24xx, 0x24) |
| 98 | |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 99 | #define cpu_is_omap7xx() 0 |
| 100 | #define cpu_is_omap15xx() 0 |
| 101 | #define cpu_is_omap16xx() 0 |
| 102 | #define cpu_is_omap24xx() 0 |
| 103 | |
| 104 | #if defined(MULTI_OMAP1) |
| 105 | # if defined(CONFIG_ARCH_OMAP730) |
| 106 | # undef cpu_is_omap7xx |
| 107 | # define cpu_is_omap7xx() is_omap7xx() |
| 108 | # endif |
| 109 | # if defined(CONFIG_ARCH_OMAP1510) |
| 110 | # undef cpu_is_omap15xx |
| 111 | # define cpu_is_omap15xx() is_omap15xx() |
| 112 | # endif |
| 113 | # if defined(CONFIG_ARCH_OMAP16XX) |
| 114 | # undef cpu_is_omap16xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | # define cpu_is_omap16xx() is_omap16xx() |
| 116 | # endif |
| 117 | #else |
| 118 | # if defined(CONFIG_ARCH_OMAP730) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 119 | # undef cpu_is_omap7xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | # define cpu_is_omap7xx() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | # endif |
| 122 | # if defined(CONFIG_ARCH_OMAP1510) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 123 | # undef cpu_is_omap15xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | # define cpu_is_omap15xx() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | # endif |
| 126 | # if defined(CONFIG_ARCH_OMAP16XX) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 127 | # undef cpu_is_omap16xx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | # define cpu_is_omap16xx() 1 |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 129 | # endif |
| 130 | # if defined(CONFIG_ARCH_OMAP24XX) |
| 131 | # undef cpu_is_omap24xx |
| 132 | # define cpu_is_omap24xx() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | # endif |
| 134 | #endif |
| 135 | |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 136 | /* |
| 137 | * Macros to detect individual cpu types. |
| 138 | * These are only rarely needed. |
| 139 | * cpu_is_omap730(): True for OMAP730 |
| 140 | * cpu_is_omap1510(): True for OMAP1510 |
| 141 | * cpu_is_omap1610(): True for OMAP1610 |
| 142 | * cpu_is_omap1611(): True for OMAP1611 |
| 143 | * cpu_is_omap5912(): True for OMAP5912 |
| 144 | * cpu_is_omap1621(): True for OMAP1621 |
| 145 | * cpu_is_omap1710(): True for OMAP1710 |
| 146 | * cpu_is_omap2420(): True for OMAP2420 |
| 147 | */ |
| 148 | #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) |
| 149 | |
| 150 | #define IS_OMAP_TYPE(type, id) \ |
| 151 | static inline int is_omap ##type (void) \ |
| 152 | { \ |
| 153 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ |
| 154 | } |
| 155 | |
| 156 | IS_OMAP_TYPE(730, 0x0730) |
| 157 | IS_OMAP_TYPE(1510, 0x1510) |
| 158 | IS_OMAP_TYPE(1610, 0x1610) |
| 159 | IS_OMAP_TYPE(1611, 0x1611) |
| 160 | IS_OMAP_TYPE(5912, 0x1611) |
| 161 | IS_OMAP_TYPE(1621, 0x1621) |
| 162 | IS_OMAP_TYPE(1710, 0x1710) |
| 163 | IS_OMAP_TYPE(2420, 0x2420) |
| 164 | |
| 165 | #define cpu_is_omap730() 0 |
| 166 | #define cpu_is_omap1510() 0 |
| 167 | #define cpu_is_omap1610() 0 |
| 168 | #define cpu_is_omap5912() 0 |
| 169 | #define cpu_is_omap1611() 0 |
| 170 | #define cpu_is_omap1621() 0 |
| 171 | #define cpu_is_omap1710() 0 |
| 172 | #define cpu_is_omap2420() 0 |
| 173 | |
| 174 | #if defined(MULTI_OMAP1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | # if defined(CONFIG_ARCH_OMAP730) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 176 | # undef cpu_is_omap730 |
| 177 | # define cpu_is_omap730() is_omap730() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | # endif |
| 179 | # if defined(CONFIG_ARCH_OMAP1510) |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 180 | # undef cpu_is_omap1510 |
| 181 | # define cpu_is_omap1510() is_omap1510() |
| 182 | # endif |
| 183 | #else |
| 184 | # if defined(CONFIG_ARCH_OMAP730) |
| 185 | # undef cpu_is_omap730 |
| 186 | # define cpu_is_omap730() 1 |
| 187 | # endif |
| 188 | # if defined(CONFIG_ARCH_OMAP1510) |
| 189 | # undef cpu_is_omap1510 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | # define cpu_is_omap1510() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | # endif |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 192 | #endif |
| 193 | |
| 194 | /* |
| 195 | * Whether we have MULTI_OMAP1 or not, we still need to distinguish |
| 196 | * between 1611B/5912 and 1710. |
| 197 | */ |
| 198 | #if defined(CONFIG_ARCH_OMAP16XX) |
| 199 | # undef cpu_is_omap1610 |
| 200 | # undef cpu_is_omap1611 |
| 201 | # undef cpu_is_omap5912 |
| 202 | # undef cpu_is_omap1621 |
| 203 | # undef cpu_is_omap1710 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | # define cpu_is_omap1610() is_omap1610() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 205 | # define cpu_is_omap1611() is_omap1611() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | # define cpu_is_omap5912() is_omap5912() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 207 | # define cpu_is_omap1621() is_omap1621() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | # define cpu_is_omap1710() is_omap1710() |
Tony Lindgren | 9839c6b | 2005-09-07 17:20:27 +0100 | [diff] [blame^] | 209 | #endif |
| 210 | |
| 211 | #if defined(CONFIG_ARCH_OMAP2420) |
| 212 | # undef cpu_is_omap2420 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | # define cpu_is_omap2420() 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | #endif |
| 215 | |
| 216 | #endif |