1 /* 2 * OMAP cpu type detection 3 * 4 * Copyright (C) 2004, 2008 Nokia Corporation 5 * 6 * Copyright (C) 2009-11 Texas Instruments. 7 * 8 * Written by Tony Lindgren <tony.lindgren@nokia.com> 9 * 10 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com> 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation; either version 2 of the License, or 15 * (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 * 26 */ 27 28 #ifndef __ASM_ARCH_OMAP_CPU_H 29 #define __ASM_ARCH_OMAP_CPU_H 30 31 #include <asm/irq.h> 32 #include <mach/hardware.h> 33 #include <mach/irqs.h> 34 35 #ifndef __ASSEMBLY__ 36 37 #include <linux/bitops.h> 38 39 /* 40 * Test if multicore OMAP support is needed 41 */ 42 #undef MULTI_OMAP1 43 #undef OMAP_NAME 44 45 #ifdef CONFIG_ARCH_OMAP730 46 # ifdef OMAP_NAME 47 # undef MULTI_OMAP1 48 # define MULTI_OMAP1 49 # else 50 # define OMAP_NAME omap730 51 # endif 52 #endif 53 #ifdef CONFIG_ARCH_OMAP850 54 # ifdef OMAP_NAME 55 # undef MULTI_OMAP1 56 # define MULTI_OMAP1 57 # else 58 # define OMAP_NAME omap850 59 # endif 60 #endif 61 #ifdef CONFIG_ARCH_OMAP15XX 62 # ifdef OMAP_NAME 63 # undef MULTI_OMAP1 64 # define MULTI_OMAP1 65 # else 66 # define OMAP_NAME omap1510 67 # endif 68 #endif 69 #ifdef CONFIG_ARCH_OMAP16XX 70 # ifdef OMAP_NAME 71 # undef MULTI_OMAP1 72 # define MULTI_OMAP1 73 # else 74 # define OMAP_NAME omap16xx 75 # endif 76 #endif 77 78 /* 79 * omap_rev bits: 80 * CPU id bits (0730, 1510, 1710, 2422...) [31:16] 81 * CPU revision (See _REV_ defined in cpu.h) [15:08] 82 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00] 83 */ 84 unsigned int omap_rev(void); 85 86 /* 87 * Get the CPU revision for OMAP devices 88 */ 89 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) 90 91 /* 92 * Macros to group OMAP into cpu classes. 93 * These can be used in most places. 94 * cpu_is_omap7xx(): True for OMAP730, OMAP850 95 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 96 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 97 */ 98 #define GET_OMAP_CLASS (omap_rev() & 0xff) 99 100 #define IS_OMAP_CLASS(class, id) \ 101 static inline int is_omap ##class (void) \ 102 { \ 103 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ 104 } 105 106 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) 107 108 #define IS_OMAP_SUBCLASS(subclass, id) \ 109 static inline int is_omap ##subclass (void) \ 110 { \ 111 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 112 } 113 114 IS_OMAP_CLASS(7xx, 0x07) 115 IS_OMAP_CLASS(15xx, 0x15) 116 IS_OMAP_CLASS(16xx, 0x16) 117 118 #define cpu_is_omap7xx() 0 119 #define cpu_is_omap15xx() 0 120 #define cpu_is_omap16xx() 0 121 122 #if defined(MULTI_OMAP1) 123 # if defined(CONFIG_ARCH_OMAP730) 124 # undef cpu_is_omap7xx 125 # define cpu_is_omap7xx() is_omap7xx() 126 # endif 127 # if defined(CONFIG_ARCH_OMAP850) 128 # undef cpu_is_omap7xx 129 # define cpu_is_omap7xx() is_omap7xx() 130 # endif 131 # if defined(CONFIG_ARCH_OMAP15XX) 132 # undef cpu_is_omap15xx 133 # define cpu_is_omap15xx() is_omap15xx() 134 # endif 135 # if defined(CONFIG_ARCH_OMAP16XX) 136 # undef cpu_is_omap16xx 137 # define cpu_is_omap16xx() is_omap16xx() 138 # endif 139 #else 140 # if defined(CONFIG_ARCH_OMAP730) 141 # undef cpu_is_omap7xx 142 # define cpu_is_omap7xx() 1 143 # endif 144 # if defined(CONFIG_ARCH_OMAP850) 145 # undef cpu_is_omap7xx 146 # define cpu_is_omap7xx() 1 147 # endif 148 # if defined(CONFIG_ARCH_OMAP15XX) 149 # undef cpu_is_omap15xx 150 # define cpu_is_omap15xx() 1 151 # endif 152 # if defined(CONFIG_ARCH_OMAP16XX) 153 # undef cpu_is_omap16xx 154 # define cpu_is_omap16xx() 1 155 # endif 156 #endif 157 158 /* 159 * Macros to detect individual cpu types. 160 * These are only rarely needed. 161 * cpu_is_omap310(): True for OMAP310 162 * cpu_is_omap1510(): True for OMAP1510 163 * cpu_is_omap1610(): True for OMAP1610 164 * cpu_is_omap1611(): True for OMAP1611 165 * cpu_is_omap5912(): True for OMAP5912 166 * cpu_is_omap1621(): True for OMAP1621 167 * cpu_is_omap1710(): True for OMAP1710 168 */ 169 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) 170 171 #define IS_OMAP_TYPE(type, id) \ 172 static inline int is_omap ##type (void) \ 173 { \ 174 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ 175 } 176 177 IS_OMAP_TYPE(310, 0x0310) 178 IS_OMAP_TYPE(1510, 0x1510) 179 IS_OMAP_TYPE(1610, 0x1610) 180 IS_OMAP_TYPE(1611, 0x1611) 181 IS_OMAP_TYPE(5912, 0x1611) 182 IS_OMAP_TYPE(1621, 0x1621) 183 IS_OMAP_TYPE(1710, 0x1710) 184 185 #define cpu_is_omap310() 0 186 #define cpu_is_omap1510() 0 187 #define cpu_is_omap1610() 0 188 #define cpu_is_omap5912() 0 189 #define cpu_is_omap1611() 0 190 #define cpu_is_omap1621() 0 191 #define cpu_is_omap1710() 0 192 193 /* These are needed to compile common code */ 194 #ifdef CONFIG_ARCH_OMAP1 195 #define cpu_is_omap242x() 0 196 #define cpu_is_omap2430() 0 197 #define cpu_is_omap243x() 0 198 #define cpu_is_omap24xx() 0 199 #define cpu_is_omap34xx() 0 200 #define cpu_is_omap44xx() 0 201 #define soc_is_omap54xx() 0 202 #define soc_is_dra7xx() 0 203 #define soc_is_am33xx() 0 204 #define cpu_class_is_omap1() 1 205 #define cpu_class_is_omap2() 0 206 #endif 207 208 /* 209 * Whether we have MULTI_OMAP1 or not, we still need to distinguish 210 * between 310 vs. 1510 and 1611B/5912 vs. 1710. 211 */ 212 213 #if defined(CONFIG_ARCH_OMAP15XX) 214 # undef cpu_is_omap310 215 # undef cpu_is_omap1510 216 # define cpu_is_omap310() is_omap310() 217 # define cpu_is_omap1510() is_omap1510() 218 #endif 219 220 #if defined(CONFIG_ARCH_OMAP16XX) 221 # undef cpu_is_omap1610 222 # undef cpu_is_omap1611 223 # undef cpu_is_omap5912 224 # undef cpu_is_omap1621 225 # undef cpu_is_omap1710 226 # define cpu_is_omap1610() is_omap1610() 227 # define cpu_is_omap1611() is_omap1611() 228 # define cpu_is_omap5912() is_omap5912() 229 # define cpu_is_omap1621() is_omap1621() 230 # define cpu_is_omap1710() is_omap1710() 231 #endif 232 233 #endif /* __ASSEMBLY__ */ 234 #endif 235