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> 11e4c060dbSTony Lindgren * 12e4c060dbSTony Lindgren * This program is free software; you can redistribute it and/or modify 13e4c060dbSTony Lindgren * it under the terms of the GNU General Public License as published by 14e4c060dbSTony Lindgren * the Free Software Foundation; either version 2 of the License, or 15e4c060dbSTony Lindgren * (at your option) any later version. 16e4c060dbSTony Lindgren * 17e4c060dbSTony Lindgren * This program is distributed in the hope that it will be useful, 18e4c060dbSTony Lindgren * but WITHOUT ANY WARRANTY; without even the implied warranty of 19e4c060dbSTony Lindgren * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20e4c060dbSTony Lindgren * GNU General Public License for more details. 21e4c060dbSTony Lindgren * 22e4c060dbSTony Lindgren * You should have received a copy of the GNU General Public License 23e4c060dbSTony Lindgren * along with this program; if not, write to the Free Software 24e4c060dbSTony Lindgren * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25e4c060dbSTony Lindgren * 26e4c060dbSTony Lindgren */ 27e4c060dbSTony Lindgren 28c49f34bcSTony Lindgren #include "omap24xx.h" 29c49f34bcSTony Lindgren #include "omap34xx.h" 30c49f34bcSTony Lindgren #include "omap44xx.h" 31c49f34bcSTony Lindgren #include "ti81xx.h" 32c49f34bcSTony Lindgren #include "am33xx.h" 33c49f34bcSTony Lindgren #include "omap54xx.h" 34e4c060dbSTony Lindgren 35e4c060dbSTony Lindgren #ifndef __ASSEMBLY__ 36e4c060dbSTony Lindgren 37e4c060dbSTony Lindgren #include <linux/bitops.h> 38e4c060dbSTony Lindgren 39e4c060dbSTony Lindgren /* 40e4c060dbSTony Lindgren * Test if multicore OMAP support is needed 41e4c060dbSTony Lindgren */ 42e4c060dbSTony Lindgren #undef MULTI_OMAP2 43e4c060dbSTony Lindgren #undef OMAP_NAME 44e4c060dbSTony Lindgren 45816a65efSTony Lindgren #ifdef CONFIG_ARCH_MULTIPLATFORM 46816a65efSTony Lindgren #define MULTI_OMAP2 47816a65efSTony Lindgren #endif 48e4c060dbSTony Lindgren #ifdef CONFIG_SOC_OMAP2420 49e4c060dbSTony Lindgren # ifdef OMAP_NAME 50e4c060dbSTony Lindgren # undef MULTI_OMAP2 51e4c060dbSTony Lindgren # define MULTI_OMAP2 52e4c060dbSTony Lindgren # else 53e4c060dbSTony Lindgren # define OMAP_NAME omap2420 54e4c060dbSTony Lindgren # endif 55e4c060dbSTony Lindgren #endif 56e4c060dbSTony Lindgren #ifdef CONFIG_SOC_OMAP2430 57e4c060dbSTony Lindgren # ifdef OMAP_NAME 58e4c060dbSTony Lindgren # undef MULTI_OMAP2 59e4c060dbSTony Lindgren # define MULTI_OMAP2 60e4c060dbSTony Lindgren # else 61e4c060dbSTony Lindgren # define OMAP_NAME omap2430 62e4c060dbSTony Lindgren # endif 63e4c060dbSTony Lindgren #endif 64e4c060dbSTony Lindgren #ifdef CONFIG_ARCH_OMAP3 65e4c060dbSTony Lindgren # ifdef OMAP_NAME 66e4c060dbSTony Lindgren # undef MULTI_OMAP2 67e4c060dbSTony Lindgren # define MULTI_OMAP2 68e4c060dbSTony Lindgren # else 69e4c060dbSTony Lindgren # define OMAP_NAME omap3 70e4c060dbSTony Lindgren # endif 71e4c060dbSTony Lindgren #endif 72e4c060dbSTony Lindgren #ifdef CONFIG_ARCH_OMAP4 73e4c060dbSTony Lindgren # ifdef OMAP_NAME 74e4c060dbSTony Lindgren # undef MULTI_OMAP2 75e4c060dbSTony Lindgren # define MULTI_OMAP2 76e4c060dbSTony Lindgren # else 77e4c060dbSTony Lindgren # define OMAP_NAME omap4 78e4c060dbSTony Lindgren # endif 79e4c060dbSTony Lindgren #endif 80e4c060dbSTony Lindgren 81e4c060dbSTony Lindgren #ifdef CONFIG_SOC_OMAP5 82e4c060dbSTony Lindgren # ifdef OMAP_NAME 83e4c060dbSTony Lindgren # undef MULTI_OMAP2 84e4c060dbSTony Lindgren # define MULTI_OMAP2 85e4c060dbSTony Lindgren # else 86e4c060dbSTony Lindgren # define OMAP_NAME omap5 87e4c060dbSTony Lindgren # endif 88e4c060dbSTony Lindgren #endif 89e4c060dbSTony Lindgren 90e4c060dbSTony Lindgren #ifdef CONFIG_SOC_AM33XX 91e4c060dbSTony Lindgren # ifdef OMAP_NAME 92e4c060dbSTony Lindgren # undef MULTI_OMAP2 93e4c060dbSTony Lindgren # define MULTI_OMAP2 94e4c060dbSTony Lindgren # else 95e4c060dbSTony Lindgren # define OMAP_NAME am33xx 96e4c060dbSTony Lindgren # endif 97e4c060dbSTony Lindgren #endif 98e4c060dbSTony Lindgren 99*c664d0a9SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX 100*c664d0a9SAfzal Mohammed # ifdef OMAP_NAME 101*c664d0a9SAfzal Mohammed # undef MULTI_OMAP2 102*c664d0a9SAfzal Mohammed # define MULTI_OMAP2 103*c664d0a9SAfzal Mohammed # else 104*c664d0a9SAfzal Mohammed # define OMAP_NAME am43xx 105*c664d0a9SAfzal Mohammed # endif 106*c664d0a9SAfzal Mohammed #endif 107*c664d0a9SAfzal Mohammed 108e4c060dbSTony Lindgren /* 109e4c060dbSTony Lindgren * Omap device type i.e. EMU/HS/TST/GP/BAD 110e4c060dbSTony Lindgren */ 111e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_TEST 0 112e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_EMU 1 113e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_SEC 2 114e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_GP 3 115e4c060dbSTony Lindgren #define OMAP2_DEVICE_TYPE_BAD 4 116e4c060dbSTony Lindgren 117e4c060dbSTony Lindgren int omap_type(void); 118e4c060dbSTony Lindgren 119e4c060dbSTony Lindgren /* 120e4c060dbSTony Lindgren * omap_rev bits: 121e4c060dbSTony Lindgren * CPU id bits (0730, 1510, 1710, 2422...) [31:16] 122e4c060dbSTony Lindgren * CPU revision (See _REV_ defined in cpu.h) [15:08] 123e4c060dbSTony Lindgren * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00] 124e4c060dbSTony Lindgren */ 125e4c060dbSTony Lindgren unsigned int omap_rev(void); 126e4c060dbSTony Lindgren 127816a65efSTony Lindgren static inline int soc_is_omap(void) 128816a65efSTony Lindgren { 129816a65efSTony Lindgren return omap_rev() != 0; 130816a65efSTony Lindgren } 131816a65efSTony Lindgren 132e4c060dbSTony Lindgren /* 133e4c060dbSTony Lindgren * Get the CPU revision for OMAP devices 134e4c060dbSTony Lindgren */ 135e4c060dbSTony Lindgren #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) 136e4c060dbSTony Lindgren 137e4c060dbSTony Lindgren /* 138e4c060dbSTony Lindgren * Macros to group OMAP into cpu classes. 139e4c060dbSTony Lindgren * These can be used in most places. 140e4c060dbSTony Lindgren * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 141e4c060dbSTony Lindgren * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 142e4c060dbSTony Lindgren * cpu_is_omap243x(): True for OMAP2430 143e4c060dbSTony Lindgren * cpu_is_omap343x(): True for OMAP3430 144e4c060dbSTony Lindgren * cpu_is_omap443x(): True for OMAP4430 145e4c060dbSTony Lindgren * cpu_is_omap446x(): True for OMAP4460 146e4c060dbSTony Lindgren * cpu_is_omap447x(): True for OMAP4470 147e4c060dbSTony Lindgren * soc_is_omap543x(): True for OMAP5430, OMAP5432 148e4c060dbSTony Lindgren */ 149e4c060dbSTony Lindgren #define GET_OMAP_CLASS (omap_rev() & 0xff) 150e4c060dbSTony Lindgren 151e4c060dbSTony Lindgren #define IS_OMAP_CLASS(class, id) \ 152e4c060dbSTony Lindgren static inline int is_omap ##class (void) \ 153e4c060dbSTony Lindgren { \ 154e4c060dbSTony Lindgren return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ 155e4c060dbSTony Lindgren } 156e4c060dbSTony Lindgren 157e4c060dbSTony Lindgren #define GET_AM_CLASS ((omap_rev() >> 24) & 0xff) 158e4c060dbSTony Lindgren 159e4c060dbSTony Lindgren #define IS_AM_CLASS(class, id) \ 160e4c060dbSTony Lindgren static inline int is_am ##class (void) \ 161e4c060dbSTony Lindgren { \ 162e4c060dbSTony Lindgren return (GET_AM_CLASS == (id)) ? 1 : 0; \ 163e4c060dbSTony Lindgren } 164e4c060dbSTony Lindgren 165e4c060dbSTony Lindgren #define GET_TI_CLASS ((omap_rev() >> 24) & 0xff) 166e4c060dbSTony Lindgren 167e4c060dbSTony Lindgren #define IS_TI_CLASS(class, id) \ 168e4c060dbSTony Lindgren static inline int is_ti ##class (void) \ 169e4c060dbSTony Lindgren { \ 170e4c060dbSTony Lindgren return (GET_TI_CLASS == (id)) ? 1 : 0; \ 171e4c060dbSTony Lindgren } 172e4c060dbSTony Lindgren 173e4c060dbSTony Lindgren #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) 174e4c060dbSTony Lindgren 175e4c060dbSTony Lindgren #define IS_OMAP_SUBCLASS(subclass, id) \ 176e4c060dbSTony Lindgren static inline int is_omap ##subclass (void) \ 177e4c060dbSTony Lindgren { \ 178e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 179e4c060dbSTony Lindgren } 180e4c060dbSTony Lindgren 181e4c060dbSTony Lindgren #define IS_TI_SUBCLASS(subclass, id) \ 182e4c060dbSTony Lindgren static inline int is_ti ##subclass (void) \ 183e4c060dbSTony Lindgren { \ 184e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 185e4c060dbSTony Lindgren } 186e4c060dbSTony Lindgren 187e4c060dbSTony Lindgren #define IS_AM_SUBCLASS(subclass, id) \ 188e4c060dbSTony Lindgren static inline int is_am ##subclass (void) \ 189e4c060dbSTony Lindgren { \ 190e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 191e4c060dbSTony Lindgren } 192e4c060dbSTony Lindgren 193e4c060dbSTony Lindgren IS_OMAP_CLASS(24xx, 0x24) 194e4c060dbSTony Lindgren IS_OMAP_CLASS(34xx, 0x34) 195e4c060dbSTony Lindgren IS_OMAP_CLASS(44xx, 0x44) 196e4c060dbSTony Lindgren IS_AM_CLASS(35xx, 0x35) 197e4c060dbSTony Lindgren IS_OMAP_CLASS(54xx, 0x54) 198e4c060dbSTony Lindgren IS_AM_CLASS(33xx, 0x33) 199*c664d0a9SAfzal Mohammed IS_AM_CLASS(43xx, 0x43) 200e4c060dbSTony Lindgren 201e4c060dbSTony Lindgren IS_TI_CLASS(81xx, 0x81) 202e4c060dbSTony Lindgren 203e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(242x, 0x242) 204e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(243x, 0x243) 205e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(343x, 0x343) 206e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(363x, 0x363) 207e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(443x, 0x443) 208e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(446x, 0x446) 209e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(447x, 0x447) 210e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(543x, 0x543) 211e4c060dbSTony Lindgren 212e4c060dbSTony Lindgren IS_TI_SUBCLASS(816x, 0x816) 213e4c060dbSTony Lindgren IS_TI_SUBCLASS(814x, 0x814) 214e4c060dbSTony Lindgren IS_AM_SUBCLASS(335x, 0x335) 215*c664d0a9SAfzal Mohammed IS_AM_SUBCLASS(437x, 0x437) 216e4c060dbSTony Lindgren 217e4c060dbSTony Lindgren #define cpu_is_omap24xx() 0 218e4c060dbSTony Lindgren #define cpu_is_omap242x() 0 219e4c060dbSTony Lindgren #define cpu_is_omap243x() 0 220e4c060dbSTony Lindgren #define cpu_is_omap34xx() 0 221e4c060dbSTony Lindgren #define cpu_is_omap343x() 0 222e4c060dbSTony Lindgren #define cpu_is_ti81xx() 0 223e4c060dbSTony Lindgren #define cpu_is_ti816x() 0 224e4c060dbSTony Lindgren #define cpu_is_ti814x() 0 225e4c060dbSTony Lindgren #define soc_is_am35xx() 0 226e4c060dbSTony Lindgren #define soc_is_am33xx() 0 227e4c060dbSTony Lindgren #define soc_is_am335x() 0 228*c664d0a9SAfzal Mohammed #define soc_is_am43xx() 0 229*c664d0a9SAfzal Mohammed #define soc_is_am437x() 0 230e4c060dbSTony Lindgren #define cpu_is_omap44xx() 0 231e4c060dbSTony Lindgren #define cpu_is_omap443x() 0 232e4c060dbSTony Lindgren #define cpu_is_omap446x() 0 233e4c060dbSTony Lindgren #define cpu_is_omap447x() 0 234e4c060dbSTony Lindgren #define soc_is_omap54xx() 0 235e4c060dbSTony Lindgren #define soc_is_omap543x() 0 236e4c060dbSTony Lindgren 237e4c060dbSTony Lindgren #if defined(MULTI_OMAP2) 238e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP2) 239e4c060dbSTony Lindgren # undef cpu_is_omap24xx 240e4c060dbSTony Lindgren # define cpu_is_omap24xx() is_omap24xx() 241e4c060dbSTony Lindgren # endif 242e4c060dbSTony Lindgren # if defined (CONFIG_SOC_OMAP2420) 243e4c060dbSTony Lindgren # undef cpu_is_omap242x 244e4c060dbSTony Lindgren # define cpu_is_omap242x() is_omap242x() 245e4c060dbSTony Lindgren # endif 246e4c060dbSTony Lindgren # if defined (CONFIG_SOC_OMAP2430) 247e4c060dbSTony Lindgren # undef cpu_is_omap243x 248e4c060dbSTony Lindgren # define cpu_is_omap243x() is_omap243x() 249e4c060dbSTony Lindgren # endif 250e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP3) 251e4c060dbSTony Lindgren # undef cpu_is_omap34xx 252e4c060dbSTony Lindgren # undef cpu_is_omap343x 253e4c060dbSTony Lindgren # define cpu_is_omap34xx() is_omap34xx() 254e4c060dbSTony Lindgren # define cpu_is_omap343x() is_omap343x() 255e4c060dbSTony Lindgren # endif 256e4c060dbSTony Lindgren #else 257e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP2) 258e4c060dbSTony Lindgren # undef cpu_is_omap24xx 259e4c060dbSTony Lindgren # define cpu_is_omap24xx() 1 260e4c060dbSTony Lindgren # endif 261e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP2420) 262e4c060dbSTony Lindgren # undef cpu_is_omap242x 263e4c060dbSTony Lindgren # define cpu_is_omap242x() 1 264e4c060dbSTony Lindgren # endif 265e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP2430) 266e4c060dbSTony Lindgren # undef cpu_is_omap243x 267e4c060dbSTony Lindgren # define cpu_is_omap243x() 1 268e4c060dbSTony Lindgren # endif 269e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP3) 270e4c060dbSTony Lindgren # undef cpu_is_omap34xx 271e4c060dbSTony Lindgren # define cpu_is_omap34xx() 1 272e4c060dbSTony Lindgren # endif 273e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP3430) 274e4c060dbSTony Lindgren # undef cpu_is_omap343x 275e4c060dbSTony Lindgren # define cpu_is_omap343x() 1 276e4c060dbSTony Lindgren # endif 277e4c060dbSTony Lindgren #endif 278e4c060dbSTony Lindgren 279e4c060dbSTony Lindgren /* 280e4c060dbSTony Lindgren * Macros to detect individual cpu types. 281e4c060dbSTony Lindgren * These are only rarely needed. 282e4c060dbSTony Lindgren * cpu_is_omap2420(): True for OMAP2420 283e4c060dbSTony Lindgren * cpu_is_omap2422(): True for OMAP2422 284e4c060dbSTony Lindgren * cpu_is_omap2423(): True for OMAP2423 285e4c060dbSTony Lindgren * cpu_is_omap2430(): True for OMAP2430 286e4c060dbSTony Lindgren * cpu_is_omap3430(): True for OMAP3430 287e4c060dbSTony Lindgren */ 288e4c060dbSTony Lindgren #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) 289e4c060dbSTony Lindgren 290e4c060dbSTony Lindgren #define IS_OMAP_TYPE(type, id) \ 291e4c060dbSTony Lindgren static inline int is_omap ##type (void) \ 292e4c060dbSTony Lindgren { \ 293e4c060dbSTony Lindgren return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ 294e4c060dbSTony Lindgren } 295e4c060dbSTony Lindgren 296e4c060dbSTony Lindgren IS_OMAP_TYPE(2420, 0x2420) 297e4c060dbSTony Lindgren IS_OMAP_TYPE(2422, 0x2422) 298e4c060dbSTony Lindgren IS_OMAP_TYPE(2423, 0x2423) 299e4c060dbSTony Lindgren IS_OMAP_TYPE(2430, 0x2430) 300e4c060dbSTony Lindgren IS_OMAP_TYPE(3430, 0x3430) 301e4c060dbSTony Lindgren 302e4c060dbSTony Lindgren #define cpu_is_omap2420() 0 303e4c060dbSTony Lindgren #define cpu_is_omap2422() 0 304e4c060dbSTony Lindgren #define cpu_is_omap2423() 0 305e4c060dbSTony Lindgren #define cpu_is_omap2430() 0 306e4c060dbSTony Lindgren #define cpu_is_omap3430() 0 307e4c060dbSTony Lindgren #define cpu_is_omap3630() 0 308e4c060dbSTony Lindgren #define soc_is_omap5430() 0 309e4c060dbSTony Lindgren 310e4c060dbSTony Lindgren /* These are needed for the common code */ 311e4c060dbSTony Lindgren #ifdef CONFIG_ARCH_OMAP2PLUS 312e4c060dbSTony Lindgren #define cpu_is_omap7xx() 0 313e4c060dbSTony Lindgren #define cpu_is_omap15xx() 0 314e4c060dbSTony Lindgren #define cpu_is_omap16xx() 0 315e4c060dbSTony Lindgren #define cpu_is_omap1510() 0 316e4c060dbSTony Lindgren #define cpu_is_omap1610() 0 317e4c060dbSTony Lindgren #define cpu_is_omap1611() 0 318e4c060dbSTony Lindgren #define cpu_is_omap1621() 0 319e4c060dbSTony Lindgren #define cpu_is_omap1710() 0 320e4c060dbSTony Lindgren #define cpu_class_is_omap1() 0 321e4c060dbSTony Lindgren #define cpu_class_is_omap2() 1 322e4c060dbSTony Lindgren #endif 323e4c060dbSTony Lindgren 324e4c060dbSTony Lindgren #if defined(CONFIG_ARCH_OMAP2) 325e4c060dbSTony Lindgren # undef cpu_is_omap2420 326e4c060dbSTony Lindgren # undef cpu_is_omap2422 327e4c060dbSTony Lindgren # undef cpu_is_omap2423 328e4c060dbSTony Lindgren # undef cpu_is_omap2430 329e4c060dbSTony Lindgren # define cpu_is_omap2420() is_omap2420() 330e4c060dbSTony Lindgren # define cpu_is_omap2422() is_omap2422() 331e4c060dbSTony Lindgren # define cpu_is_omap2423() is_omap2423() 332e4c060dbSTony Lindgren # define cpu_is_omap2430() is_omap2430() 333e4c060dbSTony Lindgren #endif 334e4c060dbSTony Lindgren 335e4c060dbSTony Lindgren #if defined(CONFIG_ARCH_OMAP3) 336e4c060dbSTony Lindgren # undef cpu_is_omap3430 337e4c060dbSTony Lindgren # undef cpu_is_ti81xx 338e4c060dbSTony Lindgren # undef cpu_is_ti816x 339e4c060dbSTony Lindgren # undef cpu_is_ti814x 340e4c060dbSTony Lindgren # undef soc_is_am35xx 341e4c060dbSTony Lindgren # define cpu_is_omap3430() is_omap3430() 342e4c060dbSTony Lindgren # undef cpu_is_omap3630 343e4c060dbSTony Lindgren # define cpu_is_omap3630() is_omap363x() 344e4c060dbSTony Lindgren # define cpu_is_ti81xx() is_ti81xx() 345e4c060dbSTony Lindgren # define cpu_is_ti816x() is_ti816x() 346e4c060dbSTony Lindgren # define cpu_is_ti814x() is_ti814x() 347e4c060dbSTony Lindgren # define soc_is_am35xx() is_am35xx() 348e4c060dbSTony Lindgren #endif 349e4c060dbSTony Lindgren 350e4c060dbSTony Lindgren # if defined(CONFIG_SOC_AM33XX) 351e4c060dbSTony Lindgren # undef soc_is_am33xx 352e4c060dbSTony Lindgren # undef soc_is_am335x 353e4c060dbSTony Lindgren # define soc_is_am33xx() is_am33xx() 354e4c060dbSTony Lindgren # define soc_is_am335x() is_am335x() 355e4c060dbSTony Lindgren #endif 356e4c060dbSTony Lindgren 357*c664d0a9SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX 358*c664d0a9SAfzal Mohammed # undef soc_is_am43xx 359*c664d0a9SAfzal Mohammed # undef soc_is_am437x 360*c664d0a9SAfzal Mohammed # define soc_is_am43xx() is_am43xx() 361*c664d0a9SAfzal Mohammed # define soc_is_am437x() is_am437x() 362*c664d0a9SAfzal Mohammed #endif 363*c664d0a9SAfzal Mohammed 364e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP4) 365e4c060dbSTony Lindgren # undef cpu_is_omap44xx 366e4c060dbSTony Lindgren # undef cpu_is_omap443x 367e4c060dbSTony Lindgren # undef cpu_is_omap446x 368e4c060dbSTony Lindgren # undef cpu_is_omap447x 369e4c060dbSTony Lindgren # define cpu_is_omap44xx() is_omap44xx() 370e4c060dbSTony Lindgren # define cpu_is_omap443x() is_omap443x() 371e4c060dbSTony Lindgren # define cpu_is_omap446x() is_omap446x() 372e4c060dbSTony Lindgren # define cpu_is_omap447x() is_omap447x() 373e4c060dbSTony Lindgren # endif 374e4c060dbSTony Lindgren 375e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP5) 376e4c060dbSTony Lindgren # undef soc_is_omap54xx 377e4c060dbSTony Lindgren # undef soc_is_omap543x 378e4c060dbSTony Lindgren # define soc_is_omap54xx() is_omap54xx() 379e4c060dbSTony Lindgren # define soc_is_omap543x() is_omap543x() 380e4c060dbSTony Lindgren #endif 381e4c060dbSTony Lindgren 382e4c060dbSTony Lindgren /* Various silicon revisions for omap2 */ 383e4c060dbSTony Lindgren #define OMAP242X_CLASS 0x24200024 384e4c060dbSTony Lindgren #define OMAP2420_REV_ES1_0 OMAP242X_CLASS 385e4c060dbSTony Lindgren #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8)) 386e4c060dbSTony Lindgren 387e4c060dbSTony Lindgren #define OMAP243X_CLASS 0x24300024 388e4c060dbSTony Lindgren #define OMAP2430_REV_ES1_0 OMAP243X_CLASS 389e4c060dbSTony Lindgren 390e4c060dbSTony Lindgren #define OMAP343X_CLASS 0x34300034 391e4c060dbSTony Lindgren #define OMAP3430_REV_ES1_0 OMAP343X_CLASS 392e4c060dbSTony Lindgren #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8)) 393e4c060dbSTony Lindgren #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8)) 394e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8)) 395e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8)) 396e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8)) 397e4c060dbSTony Lindgren 398e4c060dbSTony Lindgren #define OMAP363X_CLASS 0x36300034 399e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_0 OMAP363X_CLASS 400e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8)) 401e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8)) 402e4c060dbSTony Lindgren 403e4c060dbSTony Lindgren #define TI816X_CLASS 0x81600034 404e4c060dbSTony Lindgren #define TI8168_REV_ES1_0 TI816X_CLASS 405e4c060dbSTony Lindgren #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8)) 406e4c060dbSTony Lindgren 407e4c060dbSTony Lindgren #define TI814X_CLASS 0x81400034 408e4c060dbSTony Lindgren #define TI8148_REV_ES1_0 TI814X_CLASS 409e4c060dbSTony Lindgren #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8)) 410e4c060dbSTony Lindgren #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8)) 411e4c060dbSTony Lindgren 412e4c060dbSTony Lindgren #define AM35XX_CLASS 0x35170034 413e4c060dbSTony Lindgren #define AM35XX_REV_ES1_0 AM35XX_CLASS 414e4c060dbSTony Lindgren #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8)) 415e4c060dbSTony Lindgren 416e4c060dbSTony Lindgren #define AM335X_CLASS 0x33500033 417e4c060dbSTony Lindgren #define AM335X_REV_ES1_0 AM335X_CLASS 4185af044f4SAnilKumar Ch #define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8)) 419d240ef30SVaibhav Hiremath #define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8)) 420e4c060dbSTony Lindgren 421*c664d0a9SAfzal Mohammed #define AM437X_CLASS 0x43700000 422*c664d0a9SAfzal Mohammed #define AM437X_REV_ES1_0 AM437X_CLASS 423*c664d0a9SAfzal Mohammed 424e4c060dbSTony Lindgren #define OMAP443X_CLASS 0x44300044 425e4c060dbSTony Lindgren #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) 426e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8)) 427e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8)) 428e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8)) 429e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8)) 430e4c060dbSTony Lindgren 431e4c060dbSTony Lindgren #define OMAP446X_CLASS 0x44600044 432e4c060dbSTony Lindgren #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8)) 433e4c060dbSTony Lindgren #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8)) 434e4c060dbSTony Lindgren 435e4c060dbSTony Lindgren #define OMAP447X_CLASS 0x44700044 436e4c060dbSTony Lindgren #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8)) 437e4c060dbSTony Lindgren 438e4c060dbSTony Lindgren #define OMAP54XX_CLASS 0x54000054 439e4c060dbSTony Lindgren #define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8)) 4405a898a78SSantosh Shilimkar #define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8)) 441e4c060dbSTony Lindgren #define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8)) 4425a898a78SSantosh Shilimkar #define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8)) 443e4c060dbSTony Lindgren 444e4c060dbSTony Lindgren void omap2xxx_check_revision(void); 445e4c060dbSTony Lindgren void omap3xxx_check_revision(void); 446e4c060dbSTony Lindgren void omap4xxx_check_revision(void); 447e4c060dbSTony Lindgren void omap5xxx_check_revision(void); 448e4c060dbSTony Lindgren void omap3xxx_check_features(void); 449e4c060dbSTony Lindgren void ti81xx_check_features(void); 450e4c060dbSTony Lindgren void omap4xxx_check_features(void); 451e4c060dbSTony Lindgren 452e4c060dbSTony Lindgren /* 453e4c060dbSTony Lindgren * Runtime detection of OMAP3 features 454e4c060dbSTony Lindgren * 455e4c060dbSTony Lindgren * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip 456e4c060dbSTony Lindgren * family have OS-level control over the I/O chain clock. This is 457e4c060dbSTony Lindgren * to avoid a window during which wakeups could potentially be lost 458e4c060dbSTony Lindgren * during powerdomain transitions. If this bit is set, it 459e4c060dbSTony Lindgren * indicates that the chip does support OS-level control of this 460e4c060dbSTony Lindgren * feature. 461e4c060dbSTony Lindgren */ 462e4c060dbSTony Lindgren extern u32 omap_features; 463e4c060dbSTony Lindgren 464e4c060dbSTony Lindgren #define OMAP3_HAS_L2CACHE BIT(0) 465e4c060dbSTony Lindgren #define OMAP3_HAS_IVA BIT(1) 466e4c060dbSTony Lindgren #define OMAP3_HAS_SGX BIT(2) 467e4c060dbSTony Lindgren #define OMAP3_HAS_NEON BIT(3) 468e4c060dbSTony Lindgren #define OMAP3_HAS_ISP BIT(4) 469e4c060dbSTony Lindgren #define OMAP3_HAS_192MHZ_CLK BIT(5) 470e4c060dbSTony Lindgren #define OMAP3_HAS_IO_WAKEUP BIT(6) 471e4c060dbSTony Lindgren #define OMAP3_HAS_SDRC BIT(7) 472e4c060dbSTony Lindgren #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8) 47342a1cc9cSIvan Khoronzhuk #define OMAP4_HAS_PERF_SILICON BIT(9) 474e4c060dbSTony Lindgren 475e4c060dbSTony Lindgren 476e4c060dbSTony Lindgren #define OMAP3_HAS_FEATURE(feat,flag) \ 477e4c060dbSTony Lindgren static inline unsigned int omap3_has_ ##feat(void) \ 478e4c060dbSTony Lindgren { \ 479e4c060dbSTony Lindgren return omap_features & OMAP3_HAS_ ##flag; \ 480e4c060dbSTony Lindgren } \ 481e4c060dbSTony Lindgren 482e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(l2cache, L2CACHE) 483e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(sgx, SGX) 484e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(iva, IVA) 485e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(neon, NEON) 486e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(isp, ISP) 487e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) 488e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) 489e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(sdrc, SDRC) 490e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL) 491e4c060dbSTony Lindgren 492e4c060dbSTony Lindgren /* 493e4c060dbSTony Lindgren * Runtime detection of OMAP4 features 494e4c060dbSTony Lindgren */ 495e4c060dbSTony Lindgren #define OMAP4_HAS_FEATURE(feat, flag) \ 496e4c060dbSTony Lindgren static inline unsigned int omap4_has_ ##feat(void) \ 497e4c060dbSTony Lindgren { \ 498e4c060dbSTony Lindgren return omap_features & OMAP4_HAS_ ##flag; \ 499e4c060dbSTony Lindgren } \ 500e4c060dbSTony Lindgren 50142a1cc9cSIvan Khoronzhuk OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON) 502e4c060dbSTony Lindgren 503816a65efSTony Lindgren /* 504816a65efSTony Lindgren * We need to make sure omap initcalls don't run when 505816a65efSTony Lindgren * multiplatform kernels are booted on other SoCs. 506816a65efSTony Lindgren */ 507816a65efSTony Lindgren #define omap_initcall(level, fn) \ 508816a65efSTony Lindgren static int __init __used __##fn(void) \ 509816a65efSTony Lindgren { \ 510816a65efSTony Lindgren if (!soc_is_omap()) \ 511816a65efSTony Lindgren return 0; \ 512816a65efSTony Lindgren return fn(); \ 513816a65efSTony Lindgren } \ 514816a65efSTony Lindgren level(__##fn); 515816a65efSTony Lindgren 516816a65efSTony Lindgren #define omap_early_initcall(fn) omap_initcall(early_initcall, fn) 517816a65efSTony Lindgren #define omap_core_initcall(fn) omap_initcall(core_initcall, fn) 518816a65efSTony Lindgren #define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn) 519816a65efSTony Lindgren #define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn) 520816a65efSTony Lindgren #define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn) 521816a65efSTony Lindgren #define omap_device_initcall(fn) omap_initcall(device_initcall, fn) 522816a65efSTony Lindgren #define omap_late_initcall(fn) omap_initcall(late_initcall, fn) 523e7e17c53SKevin Hilman #define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn) 524816a65efSTony Lindgren 525e4c060dbSTony Lindgren #endif /* __ASSEMBLY__ */ 526e4c060dbSTony Lindgren 527