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 | */ |
| 41 | #undef MULTI_OMAP |
| 42 | #undef OMAP_NAME |
| 43 | |
| 44 | #ifdef CONFIG_ARCH_OMAP730 |
| 45 | # ifdef OMAP_NAME |
| 46 | # undef MULTI_OMAP |
| 47 | # define MULTI_OMAP |
| 48 | # else |
| 49 | # define OMAP_NAME omap730 |
| 50 | # endif |
| 51 | #endif |
| 52 | #ifdef CONFIG_ARCH_OMAP1510 |
| 53 | # ifdef OMAP_NAME |
| 54 | # undef MULTI_OMAP |
| 55 | # define MULTI_OMAP |
| 56 | # else |
| 57 | # define OMAP_NAME omap1510 |
| 58 | # endif |
| 59 | #endif |
| 60 | #ifdef CONFIG_ARCH_OMAP16XX |
| 61 | # ifdef OMAP_NAME |
| 62 | # undef MULTI_OMAP |
| 63 | # define MULTI_OMAP |
| 64 | # else |
| 65 | # define OMAP_NAME omap1610 |
| 66 | # endif |
| 67 | #endif |
| 68 | #ifdef CONFIG_ARCH_OMAP16XX |
| 69 | # ifdef OMAP_NAME |
| 70 | # undef MULTI_OMAP |
| 71 | # define MULTI_OMAP |
| 72 | # else |
| 73 | # define OMAP_NAME omap1710 |
| 74 | # endif |
| 75 | #endif |
| 76 | |
| 77 | /* |
| 78 | * Generate various OMAP cpu specific macros, and cpu class |
| 79 | * specific macros |
| 80 | */ |
| 81 | #define GET_OMAP_TYPE ((system_rev >> 24) & 0xff) |
| 82 | #define GET_OMAP_CLASS (system_rev & 0xff) |
| 83 | |
| 84 | #define IS_OMAP_TYPE(type, id) \ |
| 85 | static inline int is_omap ##type (void) \ |
| 86 | { \ |
| 87 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ |
| 88 | } |
| 89 | |
| 90 | #define IS_OMAP_CLASS(class, id) \ |
| 91 | static inline int is_omap ##class (void) \ |
| 92 | { \ |
| 93 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ |
| 94 | } |
| 95 | |
| 96 | IS_OMAP_TYPE(730, 0x07) |
| 97 | IS_OMAP_TYPE(1510, 0x15) |
| 98 | IS_OMAP_TYPE(1610, 0x16) |
| 99 | IS_OMAP_TYPE(5912, 0x16) |
| 100 | IS_OMAP_TYPE(1710, 0x17) |
| 101 | IS_OMAP_TYPE(2420, 0x24) |
| 102 | |
| 103 | IS_OMAP_CLASS(7xx, 0x07) |
| 104 | IS_OMAP_CLASS(15xx, 0x15) |
| 105 | IS_OMAP_CLASS(16xx, 0x16) |
| 106 | IS_OMAP_CLASS(24xx, 0x24) |
| 107 | |
| 108 | /* |
| 109 | * Macros to group OMAP types into cpu classes. |
| 110 | * These can be used in most places. |
| 111 | * cpu_is_omap15xx(): True for 1510 and 5910 |
| 112 | * cpu_is_omap16xx(): True for 1610, 5912 and 1710 |
| 113 | */ |
| 114 | #if defined(MULTI_OMAP) |
| 115 | # define cpu_is_omap7xx() is_omap7xx() |
| 116 | # define cpu_is_omap15xx() is_omap15xx() |
| 117 | # if !(defined(CONFIG_ARCH_OMAP1510) || defined(CONFIG_ARCH_OMAP730)) |
| 118 | # define cpu_is_omap16xx() 1 |
| 119 | # else |
| 120 | # define cpu_is_omap16xx() is_omap16xx() |
| 121 | # endif |
| 122 | #else |
| 123 | # if defined(CONFIG_ARCH_OMAP730) |
| 124 | # define cpu_is_omap7xx() 1 |
| 125 | # else |
| 126 | # define cpu_is_omap7xx() 0 |
| 127 | # endif |
| 128 | # if defined(CONFIG_ARCH_OMAP1510) |
| 129 | # define cpu_is_omap15xx() 1 |
| 130 | # else |
| 131 | # define cpu_is_omap15xx() 0 |
| 132 | # endif |
| 133 | # if defined(CONFIG_ARCH_OMAP16XX) |
| 134 | # define cpu_is_omap16xx() 1 |
| 135 | # else |
| 136 | # define cpu_is_omap16xx() 0 |
| 137 | # endif |
| 138 | #endif |
| 139 | |
| 140 | #if defined(MULTI_OMAP) |
| 141 | # define cpu_is_omap730() is_omap730() |
| 142 | # define cpu_is_omap1510() is_omap1510() |
| 143 | # define cpu_is_omap1610() is_omap1610() |
| 144 | # define cpu_is_omap5912() is_omap5912() |
| 145 | # define cpu_is_omap1710() is_omap1710() |
| 146 | #else |
| 147 | # if defined(CONFIG_ARCH_OMAP730) |
| 148 | # define cpu_is_omap730() 1 |
| 149 | # else |
| 150 | # define cpu_is_omap730() 0 |
| 151 | # endif |
| 152 | # if defined(CONFIG_ARCH_OMAP1510) |
| 153 | # define cpu_is_omap1510() 1 |
| 154 | # else |
| 155 | # define cpu_is_omap1510() 0 |
| 156 | # endif |
| 157 | # if defined(CONFIG_ARCH_OMAP16XX) |
| 158 | # define cpu_is_omap1610() 1 |
| 159 | # else |
| 160 | # define cpu_is_omap1610() 0 |
| 161 | # endif |
| 162 | # if defined(CONFIG_ARCH_OMAP16XX) |
| 163 | # define cpu_is_omap5912() 1 |
| 164 | # else |
| 165 | # define cpu_is_omap5912() 0 |
| 166 | # endif |
| 167 | # if defined(CONFIG_ARCH_OMAP16XX) |
| 168 | # define cpu_is_omap1610() is_omap1610() |
| 169 | # define cpu_is_omap5912() is_omap5912() |
| 170 | # define cpu_is_omap1710() is_omap1710() |
| 171 | # else |
| 172 | # define cpu_is_omap1610() 0 |
| 173 | # define cpu_is_omap5912() 0 |
| 174 | # define cpu_is_omap1710() 0 |
| 175 | # endif |
| 176 | # if defined(CONFIG_ARCH_OMAP2420) |
| 177 | # define cpu_is_omap2420() 1 |
| 178 | # else |
| 179 | # define cpu_is_omap2420() 0 |
| 180 | # endif |
| 181 | #endif |
| 182 | |
| 183 | #endif |