1e4c060dbSTony Lindgren /* 2e4c060dbSTony Lindgren * OMAP cpu type detection 3e4c060dbSTony Lindgren * 4e4c060dbSTony Lindgren * Copyright (C) 2004, 2008 Nokia Corporation 5e4c060dbSTony Lindgren * 6e4c060dbSTony Lindgren * Copyright (C) 2009-11 Texas Instruments. 7e4c060dbSTony Lindgren * 8e4c060dbSTony Lindgren * Written by Tony Lindgren <tony.lindgren@nokia.com> 9e4c060dbSTony Lindgren * 10e4c060dbSTony Lindgren * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com> 116852215aSR Sricharan * Added DRA7xxx specific defines - Sricharan R<r.sricharan@ti.com> 12e4c060dbSTony Lindgren * 13e4c060dbSTony Lindgren * This program is free software; you can redistribute it and/or modify 14e4c060dbSTony Lindgren * it under the terms of the GNU General Public License as published by 15e4c060dbSTony Lindgren * the Free Software Foundation; either version 2 of the License, or 16e4c060dbSTony Lindgren * (at your option) any later version. 17e4c060dbSTony Lindgren * 18e4c060dbSTony Lindgren * This program is distributed in the hope that it will be useful, 19e4c060dbSTony Lindgren * but WITHOUT ANY WARRANTY; without even the implied warranty of 20e4c060dbSTony Lindgren * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21e4c060dbSTony Lindgren * GNU General Public License for more details. 22e4c060dbSTony Lindgren * 23e4c060dbSTony Lindgren * You should have received a copy of the GNU General Public License 24e4c060dbSTony Lindgren * along with this program; if not, write to the Free Software 25e4c060dbSTony Lindgren * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26e4c060dbSTony Lindgren * 27e4c060dbSTony Lindgren */ 28e4c060dbSTony Lindgren 29c49f34bcSTony Lindgren #include "omap24xx.h" 30c49f34bcSTony Lindgren #include "omap34xx.h" 31c49f34bcSTony Lindgren #include "omap44xx.h" 32c49f34bcSTony Lindgren #include "ti81xx.h" 33c49f34bcSTony Lindgren #include "am33xx.h" 34c49f34bcSTony Lindgren #include "omap54xx.h" 35e4c060dbSTony Lindgren 36e4c060dbSTony Lindgren #ifndef __ASSEMBLY__ 37e4c060dbSTony Lindgren 38e4c060dbSTony Lindgren #include <linux/bitops.h> 396852215aSR Sricharan #include <linux/of.h> 40e4c060dbSTony Lindgren 41e4c060dbSTony Lindgren /* 42e4c060dbSTony Lindgren * Test if multicore OMAP support is needed 43e4c060dbSTony Lindgren */ 44e4c060dbSTony Lindgren #undef MULTI_OMAP2 45e4c060dbSTony Lindgren #undef OMAP_NAME 46e4c060dbSTony Lindgren 47816a65efSTony Lindgren #ifdef CONFIG_ARCH_MULTIPLATFORM 48816a65efSTony Lindgren #define MULTI_OMAP2 49816a65efSTony Lindgren #endif 50e4c060dbSTony Lindgren #ifdef CONFIG_SOC_OMAP2420 51e4c060dbSTony Lindgren # ifdef OMAP_NAME 52e4c060dbSTony Lindgren # undef MULTI_OMAP2 53e4c060dbSTony Lindgren # define MULTI_OMAP2 54e4c060dbSTony Lindgren # else 55e4c060dbSTony Lindgren # define OMAP_NAME omap2420 56e4c060dbSTony Lindgren # endif 57e4c060dbSTony Lindgren #endif 58e4c060dbSTony Lindgren #ifdef CONFIG_SOC_OMAP2430 59e4c060dbSTony Lindgren # ifdef OMAP_NAME 60e4c060dbSTony Lindgren # undef MULTI_OMAP2 61e4c060dbSTony Lindgren # define MULTI_OMAP2 62e4c060dbSTony Lindgren # else 63e4c060dbSTony Lindgren # define OMAP_NAME omap2430 64e4c060dbSTony Lindgren # endif 65e4c060dbSTony Lindgren #endif 66e4c060dbSTony Lindgren #ifdef CONFIG_ARCH_OMAP3 67e4c060dbSTony Lindgren # ifdef OMAP_NAME 68e4c060dbSTony Lindgren # undef MULTI_OMAP2 69e4c060dbSTony Lindgren # define MULTI_OMAP2 70e4c060dbSTony Lindgren # else 71e4c060dbSTony Lindgren # define OMAP_NAME omap3 72e4c060dbSTony Lindgren # endif 73e4c060dbSTony Lindgren #endif 74e4c060dbSTony Lindgren #ifdef CONFIG_ARCH_OMAP4 75e4c060dbSTony Lindgren # ifdef OMAP_NAME 76e4c060dbSTony Lindgren # undef MULTI_OMAP2 77e4c060dbSTony Lindgren # define MULTI_OMAP2 78e4c060dbSTony Lindgren # else 79e4c060dbSTony Lindgren # define OMAP_NAME omap4 80e4c060dbSTony Lindgren # endif 81e4c060dbSTony Lindgren #endif 82e4c060dbSTony Lindgren 83e4c060dbSTony Lindgren #ifdef CONFIG_SOC_OMAP5 84e4c060dbSTony Lindgren # ifdef OMAP_NAME 85e4c060dbSTony Lindgren # undef MULTI_OMAP2 86e4c060dbSTony Lindgren # define MULTI_OMAP2 87e4c060dbSTony Lindgren # else 88e4c060dbSTony Lindgren # define OMAP_NAME omap5 89e4c060dbSTony Lindgren # endif 90e4c060dbSTony Lindgren #endif 91e4c060dbSTony Lindgren 92e4c060dbSTony Lindgren #ifdef CONFIG_SOC_AM33XX 93e4c060dbSTony Lindgren # ifdef OMAP_NAME 94e4c060dbSTony Lindgren # undef MULTI_OMAP2 95e4c060dbSTony Lindgren # define MULTI_OMAP2 96e4c060dbSTony Lindgren # else 97e4c060dbSTony Lindgren # define OMAP_NAME am33xx 98e4c060dbSTony Lindgren # endif 99e4c060dbSTony Lindgren #endif 100e4c060dbSTony Lindgren 101c664d0a9SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX 102c664d0a9SAfzal Mohammed # ifdef OMAP_NAME 103c664d0a9SAfzal Mohammed # undef MULTI_OMAP2 104c664d0a9SAfzal Mohammed # define MULTI_OMAP2 105c664d0a9SAfzal Mohammed # else 106c664d0a9SAfzal Mohammed # define OMAP_NAME am43xx 107c664d0a9SAfzal Mohammed # endif 108c664d0a9SAfzal Mohammed #endif 109c664d0a9SAfzal Mohammed 1106852215aSR Sricharan #ifdef CONFIG_SOC_DRA7XX 1116852215aSR Sricharan # ifdef OMAP_NAME 1126852215aSR Sricharan # undef MULTI_OMAP2 1136852215aSR Sricharan # define MULTI_OMAP2 1146852215aSR Sricharan # else 1156852215aSR Sricharan # define OMAP_NAME DRA7XX 1166852215aSR Sricharan # endif 1176852215aSR Sricharan #endif 1186852215aSR Sricharan 119e4c060dbSTony Lindgren /* 120e4c060dbSTony Lindgren * Omap device type i.e. EMU/HS/TST/GP/BAD 121e4c060dbSTony Lindgren */ 122e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_TEST 0 123e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_EMU 1 124e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_SEC 2 125e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_GP 3 126e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_BAD 4 127e4c060dbSTony Lindgren 128e4c060dbSTony Lindgren int omap_type(void); 129e4c060dbSTony Lindgren 130e4c060dbSTony Lindgren /* 131e4c060dbSTony Lindgren * omap_rev bits: 132d0b50905STony Lindgren * SoC id bits (0730, 1510, 1710, 2422...) [31:16] 133d0b50905STony Lindgren * SoC revision (See _REV_ defined in cpu.h) [15:08] 134d0b50905STony Lindgren * SoC class bits (15xx, 16xx, 24xx, 34xx...) [07:00] 135e4c060dbSTony Lindgren */ 136e4c060dbSTony Lindgren unsigned int omap_rev(void); 137e4c060dbSTony Lindgren 138816a65efSTony Lindgren static inline int soc_is_omap(void) 139816a65efSTony Lindgren { 140816a65efSTony Lindgren return omap_rev() != 0; 141816a65efSTony Lindgren } 142816a65efSTony Lindgren 143e4c060dbSTony Lindgren /* 144d0b50905STony Lindgren * Get the SoC revision for OMAP devices 145e4c060dbSTony Lindgren */ 146e4c060dbSTony Lindgren #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) 147e4c060dbSTony Lindgren 148e4c060dbSTony Lindgren /* 149e4c060dbSTony Lindgren * Macros to group OMAP into cpu classes. 150e4c060dbSTony Lindgren * These can be used in most places. 151d0b50905STony Lindgren * soc_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 152d0b50905STony Lindgren * soc_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 153d0b50905STony Lindgren * soc_is_omap243x(): True for OMAP2430 154d0b50905STony Lindgren * soc_is_omap343x(): True for OMAP3430 155d0b50905STony Lindgren * soc_is_omap443x(): True for OMAP4430 156d0b50905STony Lindgren * soc_is_omap446x(): True for OMAP4460 157d0b50905STony Lindgren * soc_is_omap447x(): True for OMAP4470 158e4c060dbSTony Lindgren * soc_is_omap543x(): True for OMAP5430, OMAP5432 159e4c060dbSTony Lindgren */ 160e4c060dbSTony Lindgren #define GET_OMAP_CLASS (omap_rev() & 0xff) 161e4c060dbSTony Lindgren 162e4c060dbSTony Lindgren #define IS_OMAP_CLASS(class, id) \ 163e4c060dbSTony Lindgren static inline int is_omap ##class (void) \ 164e4c060dbSTony Lindgren { \ 165e4c060dbSTony Lindgren return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ 166e4c060dbSTony Lindgren } 167e4c060dbSTony Lindgren 168e4c060dbSTony Lindgren #define GET_AM_CLASS ((omap_rev() >> 24) & 0xff) 169e4c060dbSTony Lindgren 170e4c060dbSTony Lindgren #define IS_AM_CLASS(class, id) \ 171e4c060dbSTony Lindgren static inline int is_am ##class (void) \ 172e4c060dbSTony Lindgren { \ 173e4c060dbSTony Lindgren return (GET_AM_CLASS == (id)) ? 1 : 0; \ 174e4c060dbSTony Lindgren } 175e4c060dbSTony Lindgren 176e4c060dbSTony Lindgren #define GET_TI_CLASS ((omap_rev() >> 24) & 0xff) 177e4c060dbSTony Lindgren 178e4c060dbSTony Lindgren #define IS_TI_CLASS(class, id) \ 179e4c060dbSTony Lindgren static inline int is_ti ##class (void) \ 180e4c060dbSTony Lindgren { \ 181e4c060dbSTony Lindgren return (GET_TI_CLASS == (id)) ? 1 : 0; \ 182e4c060dbSTony Lindgren } 183e4c060dbSTony Lindgren 184*06c2d368SKeerthy #define GET_DRA_CLASS ((omap_rev() >> 24) & 0xff) 185*06c2d368SKeerthy 186*06c2d368SKeerthy #define IS_DRA_CLASS(class, id) \ 187*06c2d368SKeerthy static inline int is_dra ##class (void) \ 188*06c2d368SKeerthy { \ 189*06c2d368SKeerthy return (GET_DRA_CLASS == (id)) ? 1 : 0; \ 190*06c2d368SKeerthy } 191*06c2d368SKeerthy 192e4c060dbSTony Lindgren #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) 193e4c060dbSTony Lindgren 194e4c060dbSTony Lindgren #define IS_OMAP_SUBCLASS(subclass, id) \ 195e4c060dbSTony Lindgren static inline int is_omap ##subclass (void) \ 196e4c060dbSTony Lindgren { \ 197e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 198e4c060dbSTony Lindgren } 199e4c060dbSTony Lindgren 200e4c060dbSTony Lindgren #define IS_TI_SUBCLASS(subclass, id) \ 201e4c060dbSTony Lindgren static inline int is_ti ##subclass (void) \ 202e4c060dbSTony Lindgren { \ 203e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 204e4c060dbSTony Lindgren } 205e4c060dbSTony Lindgren 206e4c060dbSTony Lindgren #define IS_AM_SUBCLASS(subclass, id) \ 207e4c060dbSTony Lindgren static inline int is_am ##subclass (void) \ 208e4c060dbSTony Lindgren { \ 209e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 210e4c060dbSTony Lindgren } 211e4c060dbSTony Lindgren 212*06c2d368SKeerthy #define IS_DRA_SUBCLASS(subclass, id) \ 213*06c2d368SKeerthy static inline int is_dra ##subclass (void) \ 214*06c2d368SKeerthy { \ 215*06c2d368SKeerthy return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 216*06c2d368SKeerthy } 217*06c2d368SKeerthy 218e4c060dbSTony Lindgren IS_OMAP_CLASS(24xx, 0x24) 219e4c060dbSTony Lindgren IS_OMAP_CLASS(34xx, 0x34) 220e4c060dbSTony Lindgren IS_OMAP_CLASS(44xx, 0x44) 221e4c060dbSTony Lindgren IS_AM_CLASS(35xx, 0x35) 222e4c060dbSTony Lindgren IS_OMAP_CLASS(54xx, 0x54) 223e4c060dbSTony Lindgren IS_AM_CLASS(33xx, 0x33) 224c664d0a9SAfzal Mohammed IS_AM_CLASS(43xx, 0x43) 225e4c060dbSTony Lindgren 226e4c060dbSTony Lindgren IS_TI_CLASS(81xx, 0x81) 227*06c2d368SKeerthy IS_DRA_CLASS(7xx, 0x7) 228e4c060dbSTony Lindgren 229e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(242x, 0x242) 230e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(243x, 0x243) 231e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(343x, 0x343) 232e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(363x, 0x363) 233e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(443x, 0x443) 234e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(446x, 0x446) 235e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(447x, 0x447) 236e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(543x, 0x543) 237e4c060dbSTony Lindgren 238e4c060dbSTony Lindgren IS_TI_SUBCLASS(816x, 0x816) 239e4c060dbSTony Lindgren IS_TI_SUBCLASS(814x, 0x814) 240e4c060dbSTony Lindgren IS_AM_SUBCLASS(335x, 0x335) 241c664d0a9SAfzal Mohammed IS_AM_SUBCLASS(437x, 0x437) 242*06c2d368SKeerthy IS_DRA_SUBCLASS(75x, 0x75) 243*06c2d368SKeerthy IS_DRA_SUBCLASS(72x, 0x72) 244e4c060dbSTony Lindgren 245d0b50905STony Lindgren #define soc_is_omap24xx() 0 246d0b50905STony Lindgren #define soc_is_omap242x() 0 247d0b50905STony Lindgren #define soc_is_omap243x() 0 248d0b50905STony Lindgren #define soc_is_omap34xx() 0 249d0b50905STony Lindgren #define soc_is_omap343x() 0 250d0b50905STony Lindgren #define soc_is_ti81xx() 0 251d0b50905STony Lindgren #define soc_is_ti816x() 0 252d0b50905STony Lindgren #define soc_is_ti814x() 0 253e4c060dbSTony Lindgren #define soc_is_am35xx() 0 254e4c060dbSTony Lindgren #define soc_is_am33xx() 0 255e4c060dbSTony Lindgren #define soc_is_am335x() 0 256c664d0a9SAfzal Mohammed #define soc_is_am43xx() 0 257c664d0a9SAfzal Mohammed #define soc_is_am437x() 0 258d0b50905STony Lindgren #define soc_is_omap44xx() 0 259d0b50905STony Lindgren #define soc_is_omap443x() 0 260d0b50905STony Lindgren #define soc_is_omap446x() 0 261d0b50905STony Lindgren #define soc_is_omap447x() 0 262e4c060dbSTony Lindgren #define soc_is_omap54xx() 0 263e4c060dbSTony Lindgren #define soc_is_omap543x() 0 2646852215aSR Sricharan #define soc_is_dra7xx() 0 265af438fecSRajendra Nayak #define soc_is_dra74x() 0 266af438fecSRajendra Nayak #define soc_is_dra72x() 0 267e4c060dbSTony Lindgren 268e4c060dbSTony Lindgren #if defined(MULTI_OMAP2) 269e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP2) 270d0b50905STony Lindgren # undef soc_is_omap24xx 271d0b50905STony Lindgren # define soc_is_omap24xx() is_omap24xx() 272e4c060dbSTony Lindgren # endif 273e4c060dbSTony Lindgren # if defined (CONFIG_SOC_OMAP2420) 274d0b50905STony Lindgren # undef soc_is_omap242x 275d0b50905STony Lindgren # define soc_is_omap242x() is_omap242x() 276e4c060dbSTony Lindgren # endif 277e4c060dbSTony Lindgren # if defined (CONFIG_SOC_OMAP2430) 278d0b50905STony Lindgren # undef soc_is_omap243x 279d0b50905STony Lindgren # define soc_is_omap243x() is_omap243x() 280e4c060dbSTony Lindgren # endif 281e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP3) 282d0b50905STony Lindgren # undef soc_is_omap34xx 283d0b50905STony Lindgren # undef soc_is_omap343x 284d0b50905STony Lindgren # define soc_is_omap34xx() is_omap34xx() 285d0b50905STony Lindgren # define soc_is_omap343x() is_omap343x() 286e4c060dbSTony Lindgren # endif 287e4c060dbSTony Lindgren #else 288e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP2) 289d0b50905STony Lindgren # undef soc_is_omap24xx 290d0b50905STony Lindgren # define soc_is_omap24xx() 1 291e4c060dbSTony Lindgren # endif 292e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP2420) 293d0b50905STony Lindgren # undef soc_is_omap242x 294d0b50905STony Lindgren # define soc_is_omap242x() 1 295e4c060dbSTony Lindgren # endif 296e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP2430) 297d0b50905STony Lindgren # undef soc_is_omap243x 298d0b50905STony Lindgren # define soc_is_omap243x() 1 299e4c060dbSTony Lindgren # endif 300e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP3) 301d0b50905STony Lindgren # undef soc_is_omap34xx 302d0b50905STony Lindgren # define soc_is_omap34xx() 1 303e4c060dbSTony Lindgren # endif 304e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP3430) 305d0b50905STony Lindgren # undef soc_is_omap343x 306d0b50905STony Lindgren # define soc_is_omap343x() 1 307e4c060dbSTony Lindgren # endif 308e4c060dbSTony Lindgren #endif 309e4c060dbSTony Lindgren 310e4c060dbSTony Lindgren /* 311e4c060dbSTony Lindgren * Macros to detect individual cpu types. 312e4c060dbSTony Lindgren * These are only rarely needed. 313d0b50905STony Lindgren * soc_is_omap2420(): True for OMAP2420 314d0b50905STony Lindgren * soc_is_omap2422(): True for OMAP2422 315d0b50905STony Lindgren * soc_is_omap2423(): True for OMAP2423 316d0b50905STony Lindgren * soc_is_omap2430(): True for OMAP2430 317d0b50905STony Lindgren * soc_is_omap3430(): True for OMAP3430 318e4c060dbSTony Lindgren */ 319e4c060dbSTony Lindgren #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) 320e4c060dbSTony Lindgren 321e4c060dbSTony Lindgren #define IS_OMAP_TYPE(type, id) \ 322e4c060dbSTony Lindgren static inline int is_omap ##type (void) \ 323e4c060dbSTony Lindgren { \ 324e4c060dbSTony Lindgren return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ 325e4c060dbSTony Lindgren } 326e4c060dbSTony Lindgren 327e4c060dbSTony Lindgren IS_OMAP_TYPE(2420, 0x2420) 328e4c060dbSTony Lindgren IS_OMAP_TYPE(2422, 0x2422) 329e4c060dbSTony Lindgren IS_OMAP_TYPE(2423, 0x2423) 330e4c060dbSTony Lindgren IS_OMAP_TYPE(2430, 0x2430) 331e4c060dbSTony Lindgren IS_OMAP_TYPE(3430, 0x3430) 332e4c060dbSTony Lindgren 333d0b50905STony Lindgren #define soc_is_omap2420() 0 334d0b50905STony Lindgren #define soc_is_omap2422() 0 335d0b50905STony Lindgren #define soc_is_omap2423() 0 336d0b50905STony Lindgren #define soc_is_omap2430() 0 337d0b50905STony Lindgren #define soc_is_omap3430() 0 338d0b50905STony Lindgren #define soc_is_omap3630() 0 339e4c060dbSTony Lindgren #define soc_is_omap5430() 0 340e4c060dbSTony Lindgren 341e4c060dbSTony Lindgren /* These are needed for the common code */ 342e4c060dbSTony Lindgren #ifdef CONFIG_ARCH_OMAP2PLUS 343d0b50905STony Lindgren #define soc_is_omap7xx() 0 344d0b50905STony Lindgren #define soc_is_omap15xx() 0 345d0b50905STony Lindgren #define soc_is_omap16xx() 0 346d0b50905STony Lindgren #define soc_is_omap1510() 0 347d0b50905STony Lindgren #define soc_is_omap1610() 0 348d0b50905STony Lindgren #define soc_is_omap1611() 0 349d0b50905STony Lindgren #define soc_is_omap1621() 0 350d0b50905STony Lindgren #define soc_is_omap1710() 0 351e4c060dbSTony Lindgren #define cpu_class_is_omap1() 0 352e4c060dbSTony Lindgren #define cpu_class_is_omap2() 1 353e4c060dbSTony Lindgren #endif 354e4c060dbSTony Lindgren 355e4c060dbSTony Lindgren #if defined(CONFIG_ARCH_OMAP2) 356d0b50905STony Lindgren # undef soc_is_omap2420 357d0b50905STony Lindgren # undef soc_is_omap2422 358d0b50905STony Lindgren # undef soc_is_omap2423 359d0b50905STony Lindgren # undef soc_is_omap2430 360d0b50905STony Lindgren # define soc_is_omap2420() is_omap2420() 361d0b50905STony Lindgren # define soc_is_omap2422() is_omap2422() 362d0b50905STony Lindgren # define soc_is_omap2423() is_omap2423() 363d0b50905STony Lindgren # define soc_is_omap2430() is_omap2430() 364e4c060dbSTony Lindgren #endif 365e4c060dbSTony Lindgren 366e4c060dbSTony Lindgren #if defined(CONFIG_ARCH_OMAP3) 367d0b50905STony Lindgren # undef soc_is_omap3430 368d0b50905STony Lindgren # undef soc_is_ti81xx 369d0b50905STony Lindgren # undef soc_is_ti816x 370d0b50905STony Lindgren # undef soc_is_ti814x 371e4c060dbSTony Lindgren # undef soc_is_am35xx 372d0b50905STony Lindgren # define soc_is_omap3430() is_omap3430() 373d0b50905STony Lindgren # undef soc_is_omap3630 374d0b50905STony Lindgren # define soc_is_omap3630() is_omap363x() 375d0b50905STony Lindgren # define soc_is_ti81xx() is_ti81xx() 376d0b50905STony Lindgren # define soc_is_ti816x() is_ti816x() 377d0b50905STony Lindgren # define soc_is_ti814x() is_ti814x() 378e4c060dbSTony Lindgren # define soc_is_am35xx() is_am35xx() 379e4c060dbSTony Lindgren #endif 380e4c060dbSTony Lindgren 381e4c060dbSTony Lindgren # if defined(CONFIG_SOC_AM33XX) 382e4c060dbSTony Lindgren # undef soc_is_am33xx 383e4c060dbSTony Lindgren # undef soc_is_am335x 384e4c060dbSTony Lindgren # define soc_is_am33xx() is_am33xx() 385e4c060dbSTony Lindgren # define soc_is_am335x() is_am335x() 386e4c060dbSTony Lindgren #endif 387e4c060dbSTony Lindgren 388c664d0a9SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX 389c664d0a9SAfzal Mohammed # undef soc_is_am43xx 390c664d0a9SAfzal Mohammed # undef soc_is_am437x 391c664d0a9SAfzal Mohammed # define soc_is_am43xx() is_am43xx() 392c664d0a9SAfzal Mohammed # define soc_is_am437x() is_am437x() 393c664d0a9SAfzal Mohammed #endif 394c664d0a9SAfzal Mohammed 395e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP4) 396d0b50905STony Lindgren # undef soc_is_omap44xx 397d0b50905STony Lindgren # undef soc_is_omap443x 398d0b50905STony Lindgren # undef soc_is_omap446x 399d0b50905STony Lindgren # undef soc_is_omap447x 400d0b50905STony Lindgren # define soc_is_omap44xx() is_omap44xx() 401d0b50905STony Lindgren # define soc_is_omap443x() is_omap443x() 402d0b50905STony Lindgren # define soc_is_omap446x() is_omap446x() 403d0b50905STony Lindgren # define soc_is_omap447x() is_omap447x() 404e4c060dbSTony Lindgren # endif 405e4c060dbSTony Lindgren 406e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP5) 407e4c060dbSTony Lindgren # undef soc_is_omap54xx 408e4c060dbSTony Lindgren # undef soc_is_omap543x 409e4c060dbSTony Lindgren # define soc_is_omap54xx() is_omap54xx() 410e4c060dbSTony Lindgren # define soc_is_omap543x() is_omap543x() 411e4c060dbSTony Lindgren #endif 412e4c060dbSTony Lindgren 4136852215aSR Sricharan #if defined(CONFIG_SOC_DRA7XX) 4146852215aSR Sricharan #undef soc_is_dra7xx 415af438fecSRajendra Nayak #undef soc_is_dra74x 416af438fecSRajendra Nayak #undef soc_is_dra72x 417*06c2d368SKeerthy #define soc_is_dra7xx() is_dra7xx() 418*06c2d368SKeerthy #define soc_is_dra74x() is_dra75x() 419*06c2d368SKeerthy #define soc_is_dra72x() is_dra72x() 4206852215aSR Sricharan #endif 4216852215aSR Sricharan 422e4c060dbSTony Lindgren /* Various silicon revisions for omap2 */ 423e4c060dbSTony Lindgren #define OMAP242X_CLASS 0x24200024 424e4c060dbSTony Lindgren #define OMAP2420_REV_ES1_0 OMAP242X_CLASS 425e4c060dbSTony Lindgren #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8)) 426e4c060dbSTony Lindgren 427e4c060dbSTony Lindgren #define OMAP243X_CLASS 0x24300024 428e4c060dbSTony Lindgren #define OMAP2430_REV_ES1_0 OMAP243X_CLASS 429e4c060dbSTony Lindgren 430e4c060dbSTony Lindgren #define OMAP343X_CLASS 0x34300034 431e4c060dbSTony Lindgren #define OMAP3430_REV_ES1_0 OMAP343X_CLASS 432e4c060dbSTony Lindgren #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8)) 433e4c060dbSTony Lindgren #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8)) 434e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8)) 435e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8)) 436e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8)) 437e4c060dbSTony Lindgren 438e4c060dbSTony Lindgren #define OMAP363X_CLASS 0x36300034 439e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_0 OMAP363X_CLASS 440e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8)) 441e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8)) 442e4c060dbSTony Lindgren 443c27964b5STony Lindgren #define TI816X_CLASS 0x81600081 444e4c060dbSTony Lindgren #define TI8168_REV_ES1_0 TI816X_CLASS 445e4c060dbSTony Lindgren #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8)) 446a5f93d9dSAida Mynzhasova #define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8)) 447a5f93d9dSAida Mynzhasova #define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8)) 448e4c060dbSTony Lindgren 449c27964b5STony Lindgren #define TI814X_CLASS 0x81400081 450e4c060dbSTony Lindgren #define TI8148_REV_ES1_0 TI814X_CLASS 451e4c060dbSTony Lindgren #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8)) 452e4c060dbSTony Lindgren #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8)) 453e4c060dbSTony Lindgren 454e4c060dbSTony Lindgren #define AM35XX_CLASS 0x35170034 455e4c060dbSTony Lindgren #define AM35XX_REV_ES1_0 AM35XX_CLASS 456e4c060dbSTony Lindgren #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8)) 457e4c060dbSTony Lindgren 458e4c060dbSTony Lindgren #define AM335X_CLASS 0x33500033 459e4c060dbSTony Lindgren #define AM335X_REV_ES1_0 AM335X_CLASS 4605af044f4SAnilKumar Ch #define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8)) 461d240ef30SVaibhav Hiremath #define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8)) 462e4c060dbSTony Lindgren 463c664d0a9SAfzal Mohammed #define AM437X_CLASS 0x43700000 4644a2ed4c0SLokesh Vutla #define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8)) 4654a2ed4c0SLokesh Vutla #define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8)) 4664fdd54f0SLokesh Vutla #define AM437X_REV_ES1_2 (AM437X_CLASS | (0x12 << 8)) 467c664d0a9SAfzal Mohammed 468e4c060dbSTony Lindgren #define OMAP443X_CLASS 0x44300044 469e4c060dbSTony Lindgren #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) 470e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8)) 471e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8)) 472e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8)) 473e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8)) 474e4c060dbSTony Lindgren 475e4c060dbSTony Lindgren #define OMAP446X_CLASS 0x44600044 476e4c060dbSTony Lindgren #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8)) 477e4c060dbSTony Lindgren #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8)) 478e4c060dbSTony Lindgren 479e4c060dbSTony Lindgren #define OMAP447X_CLASS 0x44700044 480e4c060dbSTony Lindgren #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8)) 481e4c060dbSTony Lindgren 482e4c060dbSTony Lindgren #define OMAP54XX_CLASS 0x54000054 4835a898a78SSantosh Shilimkar #define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8)) 4845a898a78SSantosh Shilimkar #define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8)) 485e4c060dbSTony Lindgren 486733d20eeSNishanth Menon #define DRA7XX_CLASS 0x07000000 487733d20eeSNishanth Menon #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) 488733d20eeSNishanth Menon #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) 48981032e34SVishal Mahaveer #define DRA752_REV_ES2_0 (DRA7XX_CLASS | (0x52 << 16) | (0x20 << 8)) 49081032e34SVishal Mahaveer #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8)) 49173d20280SNishanth Menon #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8)) 492733d20eeSNishanth Menon 493e4c060dbSTony Lindgren void omap2xxx_check_revision(void); 494e4c060dbSTony Lindgren void omap3xxx_check_revision(void); 495e4c060dbSTony Lindgren void omap4xxx_check_revision(void); 496e4c060dbSTony Lindgren void omap5xxx_check_revision(void); 497733d20eeSNishanth Menon void dra7xxx_check_revision(void); 498e4c060dbSTony Lindgren void omap3xxx_check_features(void); 499e4c060dbSTony Lindgren void ti81xx_check_features(void); 5007bcad170SVaibhav Hiremath void am33xx_check_features(void); 501e4c060dbSTony Lindgren void omap4xxx_check_features(void); 502e4c060dbSTony Lindgren 503e4c060dbSTony Lindgren /* 504e4c060dbSTony Lindgren * Runtime detection of OMAP3 features 505e4c060dbSTony Lindgren * 506e4c060dbSTony Lindgren * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip 507e4c060dbSTony Lindgren * family have OS-level control over the I/O chain clock. This is 508e4c060dbSTony Lindgren * to avoid a window during which wakeups could potentially be lost 509e4c060dbSTony Lindgren * during powerdomain transitions. If this bit is set, it 510e4c060dbSTony Lindgren * indicates that the chip does support OS-level control of this 511e4c060dbSTony Lindgren * feature. 512e4c060dbSTony Lindgren */ 513e4c060dbSTony Lindgren extern u32 omap_features; 514e4c060dbSTony Lindgren 515e4c060dbSTony Lindgren #define OMAP3_HAS_L2CACHE BIT(0) 516e4c060dbSTony Lindgren #define OMAP3_HAS_IVA BIT(1) 517e4c060dbSTony Lindgren #define OMAP3_HAS_SGX BIT(2) 518e4c060dbSTony Lindgren #define OMAP3_HAS_NEON BIT(3) 519e4c060dbSTony Lindgren #define OMAP3_HAS_ISP BIT(4) 520e4c060dbSTony Lindgren #define OMAP3_HAS_192MHZ_CLK BIT(5) 521e4c060dbSTony Lindgren #define OMAP3_HAS_IO_WAKEUP BIT(6) 522e4c060dbSTony Lindgren #define OMAP3_HAS_SDRC BIT(7) 523e4c060dbSTony Lindgren #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8) 52442a1cc9cSIvan Khoronzhuk #define OMAP4_HAS_PERF_SILICON BIT(9) 525e4c060dbSTony Lindgren 526e4c060dbSTony Lindgren 527e4c060dbSTony Lindgren #define OMAP3_HAS_FEATURE(feat,flag) \ 528e4c060dbSTony Lindgren static inline unsigned int omap3_has_ ##feat(void) \ 529e4c060dbSTony Lindgren { \ 530e4c060dbSTony Lindgren return omap_features & OMAP3_HAS_ ##flag; \ 531e4c060dbSTony Lindgren } \ 532e4c060dbSTony Lindgren 533e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(l2cache, L2CACHE) 534e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(sgx, SGX) 535e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(iva, IVA) 536e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(neon, NEON) 537e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(isp, ISP) 538e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) 539e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) 540e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(sdrc, SDRC) 541e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL) 542e4c060dbSTony Lindgren 543e4c060dbSTony Lindgren /* 544e4c060dbSTony Lindgren * Runtime detection of OMAP4 features 545e4c060dbSTony Lindgren */ 546e4c060dbSTony Lindgren #define OMAP4_HAS_FEATURE(feat, flag) \ 547e4c060dbSTony Lindgren static inline unsigned int omap4_has_ ##feat(void) \ 548e4c060dbSTony Lindgren { \ 549e4c060dbSTony Lindgren return omap_features & OMAP4_HAS_ ##flag; \ 550e4c060dbSTony Lindgren } \ 551e4c060dbSTony Lindgren 55242a1cc9cSIvan Khoronzhuk OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON) 553e4c060dbSTony Lindgren 554816a65efSTony Lindgren /* 555816a65efSTony Lindgren * We need to make sure omap initcalls don't run when 556816a65efSTony Lindgren * multiplatform kernels are booted on other SoCs. 557816a65efSTony Lindgren */ 558816a65efSTony Lindgren #define omap_initcall(level, fn) \ 559816a65efSTony Lindgren static int __init __used __##fn(void) \ 560816a65efSTony Lindgren { \ 561816a65efSTony Lindgren if (!soc_is_omap()) \ 562816a65efSTony Lindgren return 0; \ 563816a65efSTony Lindgren return fn(); \ 564816a65efSTony Lindgren } \ 565816a65efSTony Lindgren level(__##fn); 566816a65efSTony Lindgren 567816a65efSTony Lindgren #define omap_early_initcall(fn) omap_initcall(early_initcall, fn) 568816a65efSTony Lindgren #define omap_core_initcall(fn) omap_initcall(core_initcall, fn) 569816a65efSTony Lindgren #define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn) 570816a65efSTony Lindgren #define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn) 571816a65efSTony Lindgren #define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn) 572816a65efSTony Lindgren #define omap_device_initcall(fn) omap_initcall(device_initcall, fn) 573816a65efSTony Lindgren #define omap_late_initcall(fn) omap_initcall(late_initcall, fn) 574e7e17c53SKevin Hilman #define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn) 575816a65efSTony Lindgren 576d0b50905STony Lindgren /* Legacy defines, these can be removed when users are removed */ 577d0b50905STony Lindgren #define cpu_is_omap2420() soc_is_omap2420() 578d0b50905STony Lindgren #define cpu_is_omap2422() soc_is_omap2422() 579d0b50905STony Lindgren #define cpu_is_omap242x() soc_is_omap242x() 580d0b50905STony Lindgren #define cpu_is_omap2430() soc_is_omap2430() 581d0b50905STony Lindgren #define cpu_is_omap243x() soc_is_omap243x() 582d0b50905STony Lindgren #define cpu_is_omap24xx() soc_is_omap24xx() 583d0b50905STony Lindgren #define cpu_is_omap3430() soc_is_omap3430() 584d0b50905STony Lindgren #define cpu_is_omap343x() soc_is_omap343x() 585d0b50905STony Lindgren #define cpu_is_omap34xx() soc_is_omap34xx() 586d0b50905STony Lindgren #define cpu_is_omap3630() soc_is_omap3630() 587d0b50905STony Lindgren #define cpu_is_omap443x() soc_is_omap443x() 588d0b50905STony Lindgren #define cpu_is_omap446x() soc_is_omap446x() 589d0b50905STony Lindgren #define cpu_is_omap44xx() soc_is_omap44xx() 590d0b50905STony Lindgren #define cpu_is_ti814x() soc_is_ti814x() 591d0b50905STony Lindgren #define cpu_is_ti816x() soc_is_ti816x() 592d0b50905STony Lindgren #define cpu_is_ti81xx() soc_is_ti81xx() 593e4c060dbSTony Lindgren 594d0b50905STony Lindgren #endif /* __ASSEMBLY__ */ 595