Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 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> |
R Sricharan | 6852215 | 2013-02-06 20:25:40 +0530 | [diff] [blame] | 11 | * Added DRA7xxx specific defines - Sricharan R<r.sricharan@ti.com> |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2 of the License, or |
| 16 | * (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License |
| 24 | * along with this program; if not, write to the Free Software |
| 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 26 | * |
| 27 | */ |
| 28 | |
Tony Lindgren | c49f34b | 2012-08-31 16:08:07 -0700 | [diff] [blame] | 29 | #include "omap24xx.h" |
| 30 | #include "omap34xx.h" |
| 31 | #include "omap44xx.h" |
| 32 | #include "ti81xx.h" |
| 33 | #include "am33xx.h" |
| 34 | #include "omap54xx.h" |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 35 | |
| 36 | #ifndef __ASSEMBLY__ |
| 37 | |
| 38 | #include <linux/bitops.h> |
R Sricharan | 6852215 | 2013-02-06 20:25:40 +0530 | [diff] [blame] | 39 | #include <linux/of.h> |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 40 | |
| 41 | /* |
Jonas Rabenstein | e60ba93 | 2016-04-06 10:14:08 +0200 | [diff] [blame] | 42 | * OMAP2+ is always defined as ARCH_MULTIPLATFORM in Kconfig |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 43 | */ |
| 44 | #undef MULTI_OMAP2 |
Tony Lindgren | 816a65e | 2013-01-11 11:24:18 -0800 | [diff] [blame] | 45 | #define MULTI_OMAP2 |
R Sricharan | 6852215 | 2013-02-06 20:25:40 +0530 | [diff] [blame] | 46 | |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 47 | /* |
| 48 | * Omap device type i.e. EMU/HS/TST/GP/BAD |
| 49 | */ |
| 50 | #define OMAP2_DEVICE_TYPE_TEST 0 |
| 51 | #define OMAP2_DEVICE_TYPE_EMU 1 |
| 52 | #define OMAP2_DEVICE_TYPE_SEC 2 |
| 53 | #define OMAP2_DEVICE_TYPE_GP 3 |
| 54 | #define OMAP2_DEVICE_TYPE_BAD 4 |
| 55 | |
| 56 | int omap_type(void); |
| 57 | |
| 58 | /* |
| 59 | * omap_rev bits: |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 60 | * SoC id bits (0730, 1510, 1710, 2422...) [31:16] |
| 61 | * SoC revision (See _REV_ defined in cpu.h) [15:08] |
| 62 | * SoC class bits (15xx, 16xx, 24xx, 34xx...) [07:00] |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 63 | */ |
| 64 | unsigned int omap_rev(void); |
| 65 | |
Tony Lindgren | 816a65e | 2013-01-11 11:24:18 -0800 | [diff] [blame] | 66 | static inline int soc_is_omap(void) |
| 67 | { |
| 68 | return omap_rev() != 0; |
| 69 | } |
| 70 | |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 71 | /* |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 72 | * Get the SoC revision for OMAP devices |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 73 | */ |
| 74 | #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) |
| 75 | |
| 76 | /* |
| 77 | * Macros to group OMAP into cpu classes. |
| 78 | * These can be used in most places. |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 79 | * soc_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 |
| 80 | * soc_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 |
| 81 | * soc_is_omap243x(): True for OMAP2430 |
| 82 | * soc_is_omap343x(): True for OMAP3430 |
| 83 | * soc_is_omap443x(): True for OMAP4430 |
| 84 | * soc_is_omap446x(): True for OMAP4460 |
| 85 | * soc_is_omap447x(): True for OMAP4470 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 86 | * soc_is_omap543x(): True for OMAP5430, OMAP5432 |
| 87 | */ |
| 88 | #define GET_OMAP_CLASS (omap_rev() & 0xff) |
| 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 | #define GET_AM_CLASS ((omap_rev() >> 24) & 0xff) |
| 97 | |
| 98 | #define IS_AM_CLASS(class, id) \ |
| 99 | static inline int is_am ##class (void) \ |
| 100 | { \ |
| 101 | return (GET_AM_CLASS == (id)) ? 1 : 0; \ |
| 102 | } |
| 103 | |
| 104 | #define GET_TI_CLASS ((omap_rev() >> 24) & 0xff) |
| 105 | |
| 106 | #define IS_TI_CLASS(class, id) \ |
| 107 | static inline int is_ti ##class (void) \ |
| 108 | { \ |
| 109 | return (GET_TI_CLASS == (id)) ? 1 : 0; \ |
| 110 | } |
| 111 | |
Keerthy | 06c2d36 | 2016-02-17 16:18:43 +0530 | [diff] [blame] | 112 | #define GET_DRA_CLASS ((omap_rev() >> 24) & 0xff) |
| 113 | |
| 114 | #define IS_DRA_CLASS(class, id) \ |
| 115 | static inline int is_dra ##class (void) \ |
| 116 | { \ |
| 117 | return (GET_DRA_CLASS == (id)) ? 1 : 0; \ |
| 118 | } |
| 119 | |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 120 | #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) |
| 121 | |
| 122 | #define IS_OMAP_SUBCLASS(subclass, id) \ |
| 123 | static inline int is_omap ##subclass (void) \ |
| 124 | { \ |
| 125 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ |
| 126 | } |
| 127 | |
| 128 | #define IS_TI_SUBCLASS(subclass, id) \ |
| 129 | static inline int is_ti ##subclass (void) \ |
| 130 | { \ |
| 131 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ |
| 132 | } |
| 133 | |
| 134 | #define IS_AM_SUBCLASS(subclass, id) \ |
| 135 | static inline int is_am ##subclass (void) \ |
| 136 | { \ |
| 137 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ |
| 138 | } |
| 139 | |
Keerthy | 06c2d36 | 2016-02-17 16:18:43 +0530 | [diff] [blame] | 140 | #define IS_DRA_SUBCLASS(subclass, id) \ |
| 141 | static inline int is_dra ##subclass (void) \ |
| 142 | { \ |
| 143 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ |
| 144 | } |
| 145 | |
Lokesh Vutla | 987d13f | 2017-12-18 11:50:01 +0530 | [diff] [blame] | 146 | #define GET_DRA_PACKAGE (omap_rev() & 0xff) |
| 147 | |
| 148 | #define IS_DRA_SUBCLASS_PACKAGE(subclass, package, id) \ |
| 149 | static inline int is_dra ##subclass ##_ ##package (void) \ |
| 150 | { \ |
| 151 | return (is_dra ##subclass () && GET_DRA_PACKAGE == id) ? 1 : 0; \ |
| 152 | } |
| 153 | |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 154 | IS_OMAP_CLASS(24xx, 0x24) |
| 155 | IS_OMAP_CLASS(34xx, 0x34) |
| 156 | IS_OMAP_CLASS(44xx, 0x44) |
| 157 | IS_AM_CLASS(35xx, 0x35) |
| 158 | IS_OMAP_CLASS(54xx, 0x54) |
| 159 | IS_AM_CLASS(33xx, 0x33) |
Afzal Mohammed | c664d0a | 2013-05-27 20:05:51 +0530 | [diff] [blame] | 160 | IS_AM_CLASS(43xx, 0x43) |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 161 | |
| 162 | IS_TI_CLASS(81xx, 0x81) |
Keerthy | 06c2d36 | 2016-02-17 16:18:43 +0530 | [diff] [blame] | 163 | IS_DRA_CLASS(7xx, 0x7) |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 164 | |
| 165 | IS_OMAP_SUBCLASS(242x, 0x242) |
| 166 | IS_OMAP_SUBCLASS(243x, 0x243) |
| 167 | IS_OMAP_SUBCLASS(343x, 0x343) |
| 168 | IS_OMAP_SUBCLASS(363x, 0x363) |
| 169 | IS_OMAP_SUBCLASS(443x, 0x443) |
| 170 | IS_OMAP_SUBCLASS(446x, 0x446) |
| 171 | IS_OMAP_SUBCLASS(447x, 0x447) |
| 172 | IS_OMAP_SUBCLASS(543x, 0x543) |
| 173 | |
| 174 | IS_TI_SUBCLASS(816x, 0x816) |
| 175 | IS_TI_SUBCLASS(814x, 0x814) |
| 176 | IS_AM_SUBCLASS(335x, 0x335) |
Afzal Mohammed | c664d0a | 2013-05-27 20:05:51 +0530 | [diff] [blame] | 177 | IS_AM_SUBCLASS(437x, 0x437) |
Lokesh Vutla | c15ab99 | 2017-08-12 09:35:59 +0530 | [diff] [blame] | 178 | IS_DRA_SUBCLASS(76x, 0x76) |
Lokesh Vutla | 987d13f | 2017-12-18 11:50:01 +0530 | [diff] [blame] | 179 | IS_DRA_SUBCLASS_PACKAGE(76x, abz, 2) |
| 180 | IS_DRA_SUBCLASS_PACKAGE(76x, acd, 3) |
Keerthy | 06c2d36 | 2016-02-17 16:18:43 +0530 | [diff] [blame] | 181 | IS_DRA_SUBCLASS(75x, 0x75) |
| 182 | IS_DRA_SUBCLASS(72x, 0x72) |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 183 | |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 184 | #define soc_is_ti81xx() 0 |
| 185 | #define soc_is_ti816x() 0 |
| 186 | #define soc_is_ti814x() 0 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 187 | #define soc_is_am35xx() 0 |
| 188 | #define soc_is_am33xx() 0 |
| 189 | #define soc_is_am335x() 0 |
Afzal Mohammed | c664d0a | 2013-05-27 20:05:51 +0530 | [diff] [blame] | 190 | #define soc_is_am43xx() 0 |
| 191 | #define soc_is_am437x() 0 |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 192 | #define soc_is_omap44xx() 0 |
| 193 | #define soc_is_omap443x() 0 |
| 194 | #define soc_is_omap446x() 0 |
| 195 | #define soc_is_omap447x() 0 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 196 | #define soc_is_omap54xx() 0 |
| 197 | #define soc_is_omap543x() 0 |
R Sricharan | 6852215 | 2013-02-06 20:25:40 +0530 | [diff] [blame] | 198 | #define soc_is_dra7xx() 0 |
Lokesh Vutla | c15ab99 | 2017-08-12 09:35:59 +0530 | [diff] [blame] | 199 | #define soc_is_dra76x() 0 |
Rajendra Nayak | af438fe | 2014-08-27 19:38:22 -0600 | [diff] [blame] | 200 | #define soc_is_dra74x() 0 |
| 201 | #define soc_is_dra72x() 0 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 202 | |
Jonas Rabenstein | e60ba93 | 2016-04-06 10:14:08 +0200 | [diff] [blame] | 203 | #if defined(CONFIG_ARCH_OMAP2) |
| 204 | # define soc_is_omap24xx() is_omap24xx() |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 205 | #else |
Jonas Rabenstein | e60ba93 | 2016-04-06 10:14:08 +0200 | [diff] [blame] | 206 | # define soc_is_omap24xx() 0 |
| 207 | #endif |
| 208 | #if defined(CONFIG_SOC_OMAP2420) |
| 209 | # define soc_is_omap242x() is_omap242x() |
| 210 | #else |
| 211 | # define soc_is_omap242x() 0 |
| 212 | #endif |
| 213 | #if defined(CONFIG_SOC_OMAP2430) |
| 214 | # define soc_is_omap243x() is_omap243x() |
| 215 | #else |
| 216 | # define soc_is_omap243x() 0 |
| 217 | #endif |
| 218 | #if defined(CONFIG_ARCH_OMAP3) |
| 219 | # define soc_is_omap34xx() is_omap34xx() |
| 220 | # define soc_is_omap343x() is_omap343x() |
| 221 | #else |
| 222 | # define soc_is_omap34xx() 0 |
| 223 | # define soc_is_omap343x() 0 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 224 | #endif |
| 225 | |
| 226 | /* |
| 227 | * Macros to detect individual cpu types. |
| 228 | * These are only rarely needed. |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 229 | * soc_is_omap2420(): True for OMAP2420 |
| 230 | * soc_is_omap2422(): True for OMAP2422 |
| 231 | * soc_is_omap2423(): True for OMAP2423 |
| 232 | * soc_is_omap2430(): True for OMAP2430 |
| 233 | * soc_is_omap3430(): True for OMAP3430 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 234 | */ |
| 235 | #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) |
| 236 | |
| 237 | #define IS_OMAP_TYPE(type, id) \ |
| 238 | static inline int is_omap ##type (void) \ |
| 239 | { \ |
| 240 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ |
| 241 | } |
| 242 | |
| 243 | IS_OMAP_TYPE(2420, 0x2420) |
| 244 | IS_OMAP_TYPE(2422, 0x2422) |
| 245 | IS_OMAP_TYPE(2423, 0x2423) |
| 246 | IS_OMAP_TYPE(2430, 0x2430) |
| 247 | IS_OMAP_TYPE(3430, 0x3430) |
| 248 | |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 249 | #define soc_is_omap2420() 0 |
| 250 | #define soc_is_omap2422() 0 |
| 251 | #define soc_is_omap2423() 0 |
| 252 | #define soc_is_omap2430() 0 |
| 253 | #define soc_is_omap3430() 0 |
| 254 | #define soc_is_omap3630() 0 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 255 | #define soc_is_omap5430() 0 |
| 256 | |
| 257 | /* These are needed for the common code */ |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 258 | #define soc_is_omap7xx() 0 |
| 259 | #define soc_is_omap15xx() 0 |
| 260 | #define soc_is_omap16xx() 0 |
| 261 | #define soc_is_omap1510() 0 |
| 262 | #define soc_is_omap1610() 0 |
| 263 | #define soc_is_omap1611() 0 |
| 264 | #define soc_is_omap1621() 0 |
| 265 | #define soc_is_omap1710() 0 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 266 | #define cpu_class_is_omap1() 0 |
| 267 | #define cpu_class_is_omap2() 1 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 268 | |
| 269 | #if defined(CONFIG_ARCH_OMAP2) |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 270 | # undef soc_is_omap2420 |
| 271 | # undef soc_is_omap2422 |
| 272 | # undef soc_is_omap2423 |
| 273 | # undef soc_is_omap2430 |
| 274 | # define soc_is_omap2420() is_omap2420() |
| 275 | # define soc_is_omap2422() is_omap2422() |
| 276 | # define soc_is_omap2423() is_omap2423() |
| 277 | # define soc_is_omap2430() is_omap2430() |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 278 | #endif |
| 279 | |
| 280 | #if defined(CONFIG_ARCH_OMAP3) |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 281 | # undef soc_is_omap3430 |
| 282 | # undef soc_is_ti81xx |
| 283 | # undef soc_is_ti816x |
| 284 | # undef soc_is_ti814x |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 285 | # undef soc_is_am35xx |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 286 | # define soc_is_omap3430() is_omap3430() |
| 287 | # undef soc_is_omap3630 |
| 288 | # define soc_is_omap3630() is_omap363x() |
| 289 | # define soc_is_ti81xx() is_ti81xx() |
| 290 | # define soc_is_ti816x() is_ti816x() |
| 291 | # define soc_is_ti814x() is_ti814x() |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 292 | # define soc_is_am35xx() is_am35xx() |
| 293 | #endif |
| 294 | |
| 295 | # if defined(CONFIG_SOC_AM33XX) |
| 296 | # undef soc_is_am33xx |
| 297 | # undef soc_is_am335x |
| 298 | # define soc_is_am33xx() is_am33xx() |
| 299 | # define soc_is_am335x() is_am335x() |
| 300 | #endif |
| 301 | |
Afzal Mohammed | c664d0a | 2013-05-27 20:05:51 +0530 | [diff] [blame] | 302 | #ifdef CONFIG_SOC_AM43XX |
| 303 | # undef soc_is_am43xx |
| 304 | # undef soc_is_am437x |
| 305 | # define soc_is_am43xx() is_am43xx() |
| 306 | # define soc_is_am437x() is_am437x() |
| 307 | #endif |
| 308 | |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 309 | # if defined(CONFIG_ARCH_OMAP4) |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 310 | # undef soc_is_omap44xx |
| 311 | # undef soc_is_omap443x |
| 312 | # undef soc_is_omap446x |
| 313 | # undef soc_is_omap447x |
| 314 | # define soc_is_omap44xx() is_omap44xx() |
| 315 | # define soc_is_omap443x() is_omap443x() |
| 316 | # define soc_is_omap446x() is_omap446x() |
| 317 | # define soc_is_omap447x() is_omap447x() |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 318 | # endif |
| 319 | |
| 320 | # if defined(CONFIG_SOC_OMAP5) |
| 321 | # undef soc_is_omap54xx |
| 322 | # undef soc_is_omap543x |
| 323 | # define soc_is_omap54xx() is_omap54xx() |
| 324 | # define soc_is_omap543x() is_omap543x() |
| 325 | #endif |
| 326 | |
R Sricharan | 6852215 | 2013-02-06 20:25:40 +0530 | [diff] [blame] | 327 | #if defined(CONFIG_SOC_DRA7XX) |
| 328 | #undef soc_is_dra7xx |
Lokesh Vutla | c15ab99 | 2017-08-12 09:35:59 +0530 | [diff] [blame] | 329 | #undef soc_is_dra76x |
Lokesh Vutla | 987d13f | 2017-12-18 11:50:01 +0530 | [diff] [blame] | 330 | #undef soc_is_dra76x_abz |
| 331 | #undef soc_is_dra76x_acd |
Rajendra Nayak | af438fe | 2014-08-27 19:38:22 -0600 | [diff] [blame] | 332 | #undef soc_is_dra74x |
| 333 | #undef soc_is_dra72x |
Keerthy | 06c2d36 | 2016-02-17 16:18:43 +0530 | [diff] [blame] | 334 | #define soc_is_dra7xx() is_dra7xx() |
Lokesh Vutla | c15ab99 | 2017-08-12 09:35:59 +0530 | [diff] [blame] | 335 | #define soc_is_dra76x() is_dra76x() |
Lokesh Vutla | 987d13f | 2017-12-18 11:50:01 +0530 | [diff] [blame] | 336 | #define soc_is_dra76x_abz() is_dra76x_abz() |
| 337 | #define soc_is_dra76x_acd() is_dra76x_acd() |
Keerthy | 06c2d36 | 2016-02-17 16:18:43 +0530 | [diff] [blame] | 338 | #define soc_is_dra74x() is_dra75x() |
| 339 | #define soc_is_dra72x() is_dra72x() |
R Sricharan | 6852215 | 2013-02-06 20:25:40 +0530 | [diff] [blame] | 340 | #endif |
| 341 | |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 342 | /* Various silicon revisions for omap2 */ |
| 343 | #define OMAP242X_CLASS 0x24200024 |
| 344 | #define OMAP2420_REV_ES1_0 OMAP242X_CLASS |
| 345 | #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8)) |
| 346 | |
| 347 | #define OMAP243X_CLASS 0x24300024 |
| 348 | #define OMAP2430_REV_ES1_0 OMAP243X_CLASS |
| 349 | |
| 350 | #define OMAP343X_CLASS 0x34300034 |
| 351 | #define OMAP3430_REV_ES1_0 OMAP343X_CLASS |
| 352 | #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8)) |
| 353 | #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8)) |
| 354 | #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8)) |
| 355 | #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8)) |
| 356 | #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8)) |
| 357 | |
| 358 | #define OMAP363X_CLASS 0x36300034 |
| 359 | #define OMAP3630_REV_ES1_0 OMAP363X_CLASS |
| 360 | #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8)) |
| 361 | #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8)) |
| 362 | |
Tony Lindgren | c27964b | 2015-01-14 17:37:16 -0800 | [diff] [blame] | 363 | #define TI816X_CLASS 0x81600081 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 364 | #define TI8168_REV_ES1_0 TI816X_CLASS |
| 365 | #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8)) |
Aida Mynzhasova | a5f93d9 | 2013-05-30 14:21:01 +0400 | [diff] [blame] | 366 | #define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8)) |
| 367 | #define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8)) |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 368 | |
Tony Lindgren | c27964b | 2015-01-14 17:37:16 -0800 | [diff] [blame] | 369 | #define TI814X_CLASS 0x81400081 |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 370 | #define TI8148_REV_ES1_0 TI814X_CLASS |
| 371 | #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8)) |
| 372 | #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8)) |
| 373 | |
| 374 | #define AM35XX_CLASS 0x35170034 |
| 375 | #define AM35XX_REV_ES1_0 AM35XX_CLASS |
| 376 | #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8)) |
| 377 | |
| 378 | #define AM335X_CLASS 0x33500033 |
| 379 | #define AM335X_REV_ES1_0 AM335X_CLASS |
AnilKumar Ch | 5af044f | 2013-02-01 15:58:22 +0530 | [diff] [blame] | 380 | #define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8)) |
Vaibhav Hiremath | d240ef3 | 2013-05-08 16:48:02 -0700 | [diff] [blame] | 381 | #define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8)) |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 382 | |
Afzal Mohammed | c664d0a | 2013-05-27 20:05:51 +0530 | [diff] [blame] | 383 | #define AM437X_CLASS 0x43700000 |
Lokesh Vutla | 4a2ed4c | 2014-02-07 15:51:24 +0530 | [diff] [blame] | 384 | #define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8)) |
| 385 | #define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8)) |
Lokesh Vutla | 4fdd54f | 2014-11-28 09:02:07 +0530 | [diff] [blame] | 386 | #define AM437X_REV_ES1_2 (AM437X_CLASS | (0x12 << 8)) |
Afzal Mohammed | c664d0a | 2013-05-27 20:05:51 +0530 | [diff] [blame] | 387 | |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 388 | #define OMAP443X_CLASS 0x44300044 |
| 389 | #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) |
| 390 | #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8)) |
| 391 | #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8)) |
| 392 | #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8)) |
| 393 | #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8)) |
| 394 | |
| 395 | #define OMAP446X_CLASS 0x44600044 |
| 396 | #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8)) |
| 397 | #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8)) |
| 398 | |
| 399 | #define OMAP447X_CLASS 0x44700044 |
| 400 | #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8)) |
| 401 | |
| 402 | #define OMAP54XX_CLASS 0x54000054 |
Santosh Shilimkar | 5a898a7 | 2013-01-07 19:29:46 +0530 | [diff] [blame] | 403 | #define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8)) |
Santosh Shilimkar | 5a898a7 | 2013-01-07 19:29:46 +0530 | [diff] [blame] | 404 | #define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8)) |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 405 | |
Nishanth Menon | 733d20e | 2014-05-19 10:27:11 -0500 | [diff] [blame] | 406 | #define DRA7XX_CLASS 0x07000000 |
Lokesh Vutla | c15ab99 | 2017-08-12 09:35:59 +0530 | [diff] [blame] | 407 | #define DRA762_REV_ES1_0 (DRA7XX_CLASS | (0x62 << 16) | (0x10 << 8)) |
Lokesh Vutla | 987d13f | 2017-12-18 11:50:01 +0530 | [diff] [blame] | 408 | #define DRA762_ABZ_REV_ES1_0 (DRA762_REV_ES1_0 | (2 << 0)) |
| 409 | #define DRA762_ACD_REV_ES1_0 (DRA762_REV_ES1_0 | (3 << 0)) |
Nishanth Menon | 733d20e | 2014-05-19 10:27:11 -0500 | [diff] [blame] | 410 | #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) |
| 411 | #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) |
Vishal Mahaveer | 81032e3 | 2015-09-01 13:59:25 -0700 | [diff] [blame] | 412 | #define DRA752_REV_ES2_0 (DRA7XX_CLASS | (0x52 << 16) | (0x20 << 8)) |
| 413 | #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8)) |
Vishal Mahaveer | 6b532c4 | 2016-03-09 14:56:31 -0600 | [diff] [blame] | 414 | #define DRA722_REV_ES2_0 (DRA7XX_CLASS | (0x22 << 16) | (0x20 << 8)) |
Vishal Mahaveer | cf14dd0 | 2017-08-30 21:40:29 -0500 | [diff] [blame] | 415 | #define DRA722_REV_ES2_1 (DRA7XX_CLASS | (0x22 << 16) | (0x21 << 8)) |
Nishanth Menon | 733d20e | 2014-05-19 10:27:11 -0500 | [diff] [blame] | 416 | |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 417 | void omap2xxx_check_revision(void); |
| 418 | void omap3xxx_check_revision(void); |
| 419 | void omap4xxx_check_revision(void); |
| 420 | void omap5xxx_check_revision(void); |
Nishanth Menon | 733d20e | 2014-05-19 10:27:11 -0500 | [diff] [blame] | 421 | void dra7xxx_check_revision(void); |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 422 | void omap3xxx_check_features(void); |
| 423 | void ti81xx_check_features(void); |
Vaibhav Hiremath | 7bcad17 | 2013-05-17 15:43:41 +0530 | [diff] [blame] | 424 | void am33xx_check_features(void); |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 425 | void omap4xxx_check_features(void); |
| 426 | |
| 427 | /* |
| 428 | * Runtime detection of OMAP3 features |
| 429 | * |
| 430 | * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip |
| 431 | * family have OS-level control over the I/O chain clock. This is |
| 432 | * to avoid a window during which wakeups could potentially be lost |
| 433 | * during powerdomain transitions. If this bit is set, it |
| 434 | * indicates that the chip does support OS-level control of this |
| 435 | * feature. |
| 436 | */ |
| 437 | extern u32 omap_features; |
| 438 | |
| 439 | #define OMAP3_HAS_L2CACHE BIT(0) |
| 440 | #define OMAP3_HAS_IVA BIT(1) |
| 441 | #define OMAP3_HAS_SGX BIT(2) |
| 442 | #define OMAP3_HAS_NEON BIT(3) |
| 443 | #define OMAP3_HAS_ISP BIT(4) |
| 444 | #define OMAP3_HAS_192MHZ_CLK BIT(5) |
| 445 | #define OMAP3_HAS_IO_WAKEUP BIT(6) |
| 446 | #define OMAP3_HAS_SDRC BIT(7) |
| 447 | #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8) |
Ivan Khoronzhuk | 42a1cc9 | 2012-11-14 12:10:37 -0800 | [diff] [blame] | 448 | #define OMAP4_HAS_PERF_SILICON BIT(9) |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 449 | |
| 450 | |
| 451 | #define OMAP3_HAS_FEATURE(feat,flag) \ |
| 452 | static inline unsigned int omap3_has_ ##feat(void) \ |
| 453 | { \ |
| 454 | return omap_features & OMAP3_HAS_ ##flag; \ |
| 455 | } \ |
| 456 | |
| 457 | OMAP3_HAS_FEATURE(l2cache, L2CACHE) |
| 458 | OMAP3_HAS_FEATURE(sgx, SGX) |
| 459 | OMAP3_HAS_FEATURE(iva, IVA) |
| 460 | OMAP3_HAS_FEATURE(neon, NEON) |
| 461 | OMAP3_HAS_FEATURE(isp, ISP) |
| 462 | OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) |
| 463 | OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) |
| 464 | OMAP3_HAS_FEATURE(sdrc, SDRC) |
| 465 | OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL) |
| 466 | |
| 467 | /* |
| 468 | * Runtime detection of OMAP4 features |
| 469 | */ |
| 470 | #define OMAP4_HAS_FEATURE(feat, flag) \ |
| 471 | static inline unsigned int omap4_has_ ##feat(void) \ |
| 472 | { \ |
| 473 | return omap_features & OMAP4_HAS_ ##flag; \ |
| 474 | } \ |
| 475 | |
Ivan Khoronzhuk | 42a1cc9 | 2012-11-14 12:10:37 -0800 | [diff] [blame] | 476 | OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON) |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 477 | |
Tony Lindgren | 816a65e | 2013-01-11 11:24:18 -0800 | [diff] [blame] | 478 | /* |
| 479 | * We need to make sure omap initcalls don't run when |
| 480 | * multiplatform kernels are booted on other SoCs. |
| 481 | */ |
| 482 | #define omap_initcall(level, fn) \ |
| 483 | static int __init __used __##fn(void) \ |
| 484 | { \ |
| 485 | if (!soc_is_omap()) \ |
| 486 | return 0; \ |
| 487 | return fn(); \ |
| 488 | } \ |
| 489 | level(__##fn); |
| 490 | |
| 491 | #define omap_early_initcall(fn) omap_initcall(early_initcall, fn) |
| 492 | #define omap_core_initcall(fn) omap_initcall(core_initcall, fn) |
| 493 | #define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn) |
| 494 | #define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn) |
| 495 | #define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn) |
| 496 | #define omap_device_initcall(fn) omap_initcall(device_initcall, fn) |
| 497 | #define omap_late_initcall(fn) omap_initcall(late_initcall, fn) |
Kevin Hilman | e7e17c5 | 2013-05-08 16:48:01 -0700 | [diff] [blame] | 498 | #define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn) |
Tony Lindgren | 816a65e | 2013-01-11 11:24:18 -0800 | [diff] [blame] | 499 | |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 500 | /* Legacy defines, these can be removed when users are removed */ |
| 501 | #define cpu_is_omap2420() soc_is_omap2420() |
| 502 | #define cpu_is_omap2422() soc_is_omap2422() |
| 503 | #define cpu_is_omap242x() soc_is_omap242x() |
| 504 | #define cpu_is_omap2430() soc_is_omap2430() |
| 505 | #define cpu_is_omap243x() soc_is_omap243x() |
| 506 | #define cpu_is_omap24xx() soc_is_omap24xx() |
| 507 | #define cpu_is_omap3430() soc_is_omap3430() |
| 508 | #define cpu_is_omap343x() soc_is_omap343x() |
| 509 | #define cpu_is_omap34xx() soc_is_omap34xx() |
| 510 | #define cpu_is_omap3630() soc_is_omap3630() |
| 511 | #define cpu_is_omap443x() soc_is_omap443x() |
| 512 | #define cpu_is_omap446x() soc_is_omap446x() |
| 513 | #define cpu_is_omap44xx() soc_is_omap44xx() |
| 514 | #define cpu_is_ti814x() soc_is_ti814x() |
| 515 | #define cpu_is_ti816x() soc_is_ti816x() |
| 516 | #define cpu_is_ti81xx() soc_is_ti81xx() |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 517 | |
Tony Lindgren | d0b5090 | 2015-10-16 10:08:45 -0700 | [diff] [blame] | 518 | #endif /* __ASSEMBLY__ */ |