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: 132e4c060dbSTony Lindgren * CPU id bits (0730, 1510, 1710, 2422...) [31:16] 133e4c060dbSTony Lindgren * CPU revision (See _REV_ defined in cpu.h) [15:08] 134e4c060dbSTony Lindgren * CPU 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 /* 144e4c060dbSTony Lindgren * Get the CPU 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. 151e4c060dbSTony Lindgren * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 152e4c060dbSTony Lindgren * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 153e4c060dbSTony Lindgren * cpu_is_omap243x(): True for OMAP2430 154e4c060dbSTony Lindgren * cpu_is_omap343x(): True for OMAP3430 155e4c060dbSTony Lindgren * cpu_is_omap443x(): True for OMAP4430 156e4c060dbSTony Lindgren * cpu_is_omap446x(): True for OMAP4460 157e4c060dbSTony Lindgren * cpu_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 184e4c060dbSTony Lindgren #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) 185e4c060dbSTony Lindgren 186e4c060dbSTony Lindgren #define IS_OMAP_SUBCLASS(subclass, id) \ 187e4c060dbSTony Lindgren static inline int is_omap ##subclass (void) \ 188e4c060dbSTony Lindgren { \ 189e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 190e4c060dbSTony Lindgren } 191e4c060dbSTony Lindgren 192e4c060dbSTony Lindgren #define IS_TI_SUBCLASS(subclass, id) \ 193e4c060dbSTony Lindgren static inline int is_ti ##subclass (void) \ 194e4c060dbSTony Lindgren { \ 195e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 196e4c060dbSTony Lindgren } 197e4c060dbSTony Lindgren 198e4c060dbSTony Lindgren #define IS_AM_SUBCLASS(subclass, id) \ 199e4c060dbSTony Lindgren static inline int is_am ##subclass (void) \ 200e4c060dbSTony Lindgren { \ 201e4c060dbSTony Lindgren return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 202e4c060dbSTony Lindgren } 203e4c060dbSTony Lindgren 204e4c060dbSTony Lindgren IS_OMAP_CLASS(24xx, 0x24) 205e4c060dbSTony Lindgren IS_OMAP_CLASS(34xx, 0x34) 206e4c060dbSTony Lindgren IS_OMAP_CLASS(44xx, 0x44) 207e4c060dbSTony Lindgren IS_AM_CLASS(35xx, 0x35) 208e4c060dbSTony Lindgren IS_OMAP_CLASS(54xx, 0x54) 209e4c060dbSTony Lindgren IS_AM_CLASS(33xx, 0x33) 210c664d0a9SAfzal Mohammed IS_AM_CLASS(43xx, 0x43) 211e4c060dbSTony Lindgren 212e4c060dbSTony Lindgren IS_TI_CLASS(81xx, 0x81) 213e4c060dbSTony Lindgren 214e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(242x, 0x242) 215e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(243x, 0x243) 216e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(343x, 0x343) 217e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(363x, 0x363) 218e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(443x, 0x443) 219e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(446x, 0x446) 220e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(447x, 0x447) 221e4c060dbSTony Lindgren IS_OMAP_SUBCLASS(543x, 0x543) 222e4c060dbSTony Lindgren 223e4c060dbSTony Lindgren IS_TI_SUBCLASS(816x, 0x816) 224e4c060dbSTony Lindgren IS_TI_SUBCLASS(814x, 0x814) 225e4c060dbSTony Lindgren IS_AM_SUBCLASS(335x, 0x335) 226c664d0a9SAfzal Mohammed IS_AM_SUBCLASS(437x, 0x437) 227e4c060dbSTony Lindgren 228e4c060dbSTony Lindgren #define cpu_is_omap24xx() 0 229e4c060dbSTony Lindgren #define cpu_is_omap242x() 0 230e4c060dbSTony Lindgren #define cpu_is_omap243x() 0 231e4c060dbSTony Lindgren #define cpu_is_omap34xx() 0 232e4c060dbSTony Lindgren #define cpu_is_omap343x() 0 233e4c060dbSTony Lindgren #define cpu_is_ti81xx() 0 234e4c060dbSTony Lindgren #define cpu_is_ti816x() 0 235e4c060dbSTony Lindgren #define cpu_is_ti814x() 0 236e4c060dbSTony Lindgren #define soc_is_am35xx() 0 237e4c060dbSTony Lindgren #define soc_is_am33xx() 0 238e4c060dbSTony Lindgren #define soc_is_am335x() 0 239c664d0a9SAfzal Mohammed #define soc_is_am43xx() 0 240c664d0a9SAfzal Mohammed #define soc_is_am437x() 0 241e4c060dbSTony Lindgren #define cpu_is_omap44xx() 0 242e4c060dbSTony Lindgren #define cpu_is_omap443x() 0 243e4c060dbSTony Lindgren #define cpu_is_omap446x() 0 244e4c060dbSTony Lindgren #define cpu_is_omap447x() 0 245e4c060dbSTony Lindgren #define soc_is_omap54xx() 0 246e4c060dbSTony Lindgren #define soc_is_omap543x() 0 2476852215aSR Sricharan #define soc_is_dra7xx() 0 248e4c060dbSTony Lindgren 249e4c060dbSTony Lindgren #if defined(MULTI_OMAP2) 250e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP2) 251e4c060dbSTony Lindgren # undef cpu_is_omap24xx 252e4c060dbSTony Lindgren # define cpu_is_omap24xx() is_omap24xx() 253e4c060dbSTony Lindgren # endif 254e4c060dbSTony Lindgren # if defined (CONFIG_SOC_OMAP2420) 255e4c060dbSTony Lindgren # undef cpu_is_omap242x 256e4c060dbSTony Lindgren # define cpu_is_omap242x() is_omap242x() 257e4c060dbSTony Lindgren # endif 258e4c060dbSTony Lindgren # if defined (CONFIG_SOC_OMAP2430) 259e4c060dbSTony Lindgren # undef cpu_is_omap243x 260e4c060dbSTony Lindgren # define cpu_is_omap243x() is_omap243x() 261e4c060dbSTony Lindgren # endif 262e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP3) 263e4c060dbSTony Lindgren # undef cpu_is_omap34xx 264e4c060dbSTony Lindgren # undef cpu_is_omap343x 265e4c060dbSTony Lindgren # define cpu_is_omap34xx() is_omap34xx() 266e4c060dbSTony Lindgren # define cpu_is_omap343x() is_omap343x() 267e4c060dbSTony Lindgren # endif 268e4c060dbSTony Lindgren #else 269e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP2) 270e4c060dbSTony Lindgren # undef cpu_is_omap24xx 271e4c060dbSTony Lindgren # define cpu_is_omap24xx() 1 272e4c060dbSTony Lindgren # endif 273e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP2420) 274e4c060dbSTony Lindgren # undef cpu_is_omap242x 275e4c060dbSTony Lindgren # define cpu_is_omap242x() 1 276e4c060dbSTony Lindgren # endif 277e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP2430) 278e4c060dbSTony Lindgren # undef cpu_is_omap243x 279e4c060dbSTony Lindgren # define cpu_is_omap243x() 1 280e4c060dbSTony Lindgren # endif 281e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP3) 282e4c060dbSTony Lindgren # undef cpu_is_omap34xx 283e4c060dbSTony Lindgren # define cpu_is_omap34xx() 1 284e4c060dbSTony Lindgren # endif 285e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP3430) 286e4c060dbSTony Lindgren # undef cpu_is_omap343x 287e4c060dbSTony Lindgren # define cpu_is_omap343x() 1 288e4c060dbSTony Lindgren # endif 289e4c060dbSTony Lindgren #endif 290e4c060dbSTony Lindgren 291e4c060dbSTony Lindgren /* 292e4c060dbSTony Lindgren * Macros to detect individual cpu types. 293e4c060dbSTony Lindgren * These are only rarely needed. 294e4c060dbSTony Lindgren * cpu_is_omap2420(): True for OMAP2420 295e4c060dbSTony Lindgren * cpu_is_omap2422(): True for OMAP2422 296e4c060dbSTony Lindgren * cpu_is_omap2423(): True for OMAP2423 297e4c060dbSTony Lindgren * cpu_is_omap2430(): True for OMAP2430 298e4c060dbSTony Lindgren * cpu_is_omap3430(): True for OMAP3430 299e4c060dbSTony Lindgren */ 300e4c060dbSTony Lindgren #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) 301e4c060dbSTony Lindgren 302e4c060dbSTony Lindgren #define IS_OMAP_TYPE(type, id) \ 303e4c060dbSTony Lindgren static inline int is_omap ##type (void) \ 304e4c060dbSTony Lindgren { \ 305e4c060dbSTony Lindgren return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ 306e4c060dbSTony Lindgren } 307e4c060dbSTony Lindgren 308e4c060dbSTony Lindgren IS_OMAP_TYPE(2420, 0x2420) 309e4c060dbSTony Lindgren IS_OMAP_TYPE(2422, 0x2422) 310e4c060dbSTony Lindgren IS_OMAP_TYPE(2423, 0x2423) 311e4c060dbSTony Lindgren IS_OMAP_TYPE(2430, 0x2430) 312e4c060dbSTony Lindgren IS_OMAP_TYPE(3430, 0x3430) 313e4c060dbSTony Lindgren 314e4c060dbSTony Lindgren #define cpu_is_omap2420() 0 315e4c060dbSTony Lindgren #define cpu_is_omap2422() 0 316e4c060dbSTony Lindgren #define cpu_is_omap2423() 0 317e4c060dbSTony Lindgren #define cpu_is_omap2430() 0 318e4c060dbSTony Lindgren #define cpu_is_omap3430() 0 319e4c060dbSTony Lindgren #define cpu_is_omap3630() 0 320e4c060dbSTony Lindgren #define soc_is_omap5430() 0 321e4c060dbSTony Lindgren 322e4c060dbSTony Lindgren /* These are needed for the common code */ 323e4c060dbSTony Lindgren #ifdef CONFIG_ARCH_OMAP2PLUS 324e4c060dbSTony Lindgren #define cpu_is_omap7xx() 0 325e4c060dbSTony Lindgren #define cpu_is_omap15xx() 0 326e4c060dbSTony Lindgren #define cpu_is_omap16xx() 0 327e4c060dbSTony Lindgren #define cpu_is_omap1510() 0 328e4c060dbSTony Lindgren #define cpu_is_omap1610() 0 329e4c060dbSTony Lindgren #define cpu_is_omap1611() 0 330e4c060dbSTony Lindgren #define cpu_is_omap1621() 0 331e4c060dbSTony Lindgren #define cpu_is_omap1710() 0 332e4c060dbSTony Lindgren #define cpu_class_is_omap1() 0 333e4c060dbSTony Lindgren #define cpu_class_is_omap2() 1 334e4c060dbSTony Lindgren #endif 335e4c060dbSTony Lindgren 336e4c060dbSTony Lindgren #if defined(CONFIG_ARCH_OMAP2) 337e4c060dbSTony Lindgren # undef cpu_is_omap2420 338e4c060dbSTony Lindgren # undef cpu_is_omap2422 339e4c060dbSTony Lindgren # undef cpu_is_omap2423 340e4c060dbSTony Lindgren # undef cpu_is_omap2430 341e4c060dbSTony Lindgren # define cpu_is_omap2420() is_omap2420() 342e4c060dbSTony Lindgren # define cpu_is_omap2422() is_omap2422() 343e4c060dbSTony Lindgren # define cpu_is_omap2423() is_omap2423() 344e4c060dbSTony Lindgren # define cpu_is_omap2430() is_omap2430() 345e4c060dbSTony Lindgren #endif 346e4c060dbSTony Lindgren 347e4c060dbSTony Lindgren #if defined(CONFIG_ARCH_OMAP3) 348e4c060dbSTony Lindgren # undef cpu_is_omap3430 349e4c060dbSTony Lindgren # undef cpu_is_ti81xx 350e4c060dbSTony Lindgren # undef cpu_is_ti816x 351e4c060dbSTony Lindgren # undef cpu_is_ti814x 352e4c060dbSTony Lindgren # undef soc_is_am35xx 353e4c060dbSTony Lindgren # define cpu_is_omap3430() is_omap3430() 354e4c060dbSTony Lindgren # undef cpu_is_omap3630 355e4c060dbSTony Lindgren # define cpu_is_omap3630() is_omap363x() 356e4c060dbSTony Lindgren # define cpu_is_ti81xx() is_ti81xx() 357e4c060dbSTony Lindgren # define cpu_is_ti816x() is_ti816x() 358e4c060dbSTony Lindgren # define cpu_is_ti814x() is_ti814x() 359e4c060dbSTony Lindgren # define soc_is_am35xx() is_am35xx() 360e4c060dbSTony Lindgren #endif 361e4c060dbSTony Lindgren 362e4c060dbSTony Lindgren # if defined(CONFIG_SOC_AM33XX) 363e4c060dbSTony Lindgren # undef soc_is_am33xx 364e4c060dbSTony Lindgren # undef soc_is_am335x 365e4c060dbSTony Lindgren # define soc_is_am33xx() is_am33xx() 366e4c060dbSTony Lindgren # define soc_is_am335x() is_am335x() 367e4c060dbSTony Lindgren #endif 368e4c060dbSTony Lindgren 369c664d0a9SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX 370c664d0a9SAfzal Mohammed # undef soc_is_am43xx 371c664d0a9SAfzal Mohammed # undef soc_is_am437x 372c664d0a9SAfzal Mohammed # define soc_is_am43xx() is_am43xx() 373c664d0a9SAfzal Mohammed # define soc_is_am437x() is_am437x() 374c664d0a9SAfzal Mohammed #endif 375c664d0a9SAfzal Mohammed 376e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP4) 377e4c060dbSTony Lindgren # undef cpu_is_omap44xx 378e4c060dbSTony Lindgren # undef cpu_is_omap443x 379e4c060dbSTony Lindgren # undef cpu_is_omap446x 380e4c060dbSTony Lindgren # undef cpu_is_omap447x 381e4c060dbSTony Lindgren # define cpu_is_omap44xx() is_omap44xx() 382e4c060dbSTony Lindgren # define cpu_is_omap443x() is_omap443x() 383e4c060dbSTony Lindgren # define cpu_is_omap446x() is_omap446x() 384e4c060dbSTony Lindgren # define cpu_is_omap447x() is_omap447x() 385e4c060dbSTony Lindgren # endif 386e4c060dbSTony Lindgren 387e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP5) 388e4c060dbSTony Lindgren # undef soc_is_omap54xx 389e4c060dbSTony Lindgren # undef soc_is_omap543x 390e4c060dbSTony Lindgren # define soc_is_omap54xx() is_omap54xx() 391e4c060dbSTony Lindgren # define soc_is_omap543x() is_omap543x() 392e4c060dbSTony Lindgren #endif 393e4c060dbSTony Lindgren 3946852215aSR Sricharan #if defined(CONFIG_SOC_DRA7XX) 3956852215aSR Sricharan #undef soc_is_dra7xx 3966852215aSR Sricharan #define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7")) 3976852215aSR Sricharan #endif 3986852215aSR Sricharan 399e4c060dbSTony Lindgren /* Various silicon revisions for omap2 */ 400e4c060dbSTony Lindgren #define OMAP242X_CLASS 0x24200024 401e4c060dbSTony Lindgren #define OMAP2420_REV_ES1_0 OMAP242X_CLASS 402e4c060dbSTony Lindgren #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8)) 403e4c060dbSTony Lindgren 404e4c060dbSTony Lindgren #define OMAP243X_CLASS 0x24300024 405e4c060dbSTony Lindgren #define OMAP2430_REV_ES1_0 OMAP243X_CLASS 406e4c060dbSTony Lindgren 407e4c060dbSTony Lindgren #define OMAP343X_CLASS 0x34300034 408e4c060dbSTony Lindgren #define OMAP3430_REV_ES1_0 OMAP343X_CLASS 409e4c060dbSTony Lindgren #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8)) 410e4c060dbSTony Lindgren #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8)) 411e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8)) 412e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8)) 413e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8)) 414e4c060dbSTony Lindgren 415e4c060dbSTony Lindgren #define OMAP363X_CLASS 0x36300034 416e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_0 OMAP363X_CLASS 417e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8)) 418e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8)) 419e4c060dbSTony Lindgren 420e4c060dbSTony Lindgren #define TI816X_CLASS 0x81600034 421e4c060dbSTony Lindgren #define TI8168_REV_ES1_0 TI816X_CLASS 422e4c060dbSTony Lindgren #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8)) 423a5f93d9dSAida Mynzhasova #define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8)) 424a5f93d9dSAida Mynzhasova #define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8)) 425e4c060dbSTony Lindgren 426e4c060dbSTony Lindgren #define TI814X_CLASS 0x81400034 427e4c060dbSTony Lindgren #define TI8148_REV_ES1_0 TI814X_CLASS 428e4c060dbSTony Lindgren #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8)) 429e4c060dbSTony Lindgren #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8)) 430e4c060dbSTony Lindgren 431e4c060dbSTony Lindgren #define AM35XX_CLASS 0x35170034 432e4c060dbSTony Lindgren #define AM35XX_REV_ES1_0 AM35XX_CLASS 433e4c060dbSTony Lindgren #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8)) 434e4c060dbSTony Lindgren 435e4c060dbSTony Lindgren #define AM335X_CLASS 0x33500033 436e4c060dbSTony Lindgren #define AM335X_REV_ES1_0 AM335X_CLASS 4375af044f4SAnilKumar Ch #define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8)) 438d240ef30SVaibhav Hiremath #define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8)) 439e4c060dbSTony Lindgren 440c664d0a9SAfzal Mohammed #define AM437X_CLASS 0x43700000 441*4a2ed4c0SLokesh Vutla #define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8)) 442*4a2ed4c0SLokesh Vutla #define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8)) 443c664d0a9SAfzal Mohammed 444e4c060dbSTony Lindgren #define OMAP443X_CLASS 0x44300044 445e4c060dbSTony Lindgren #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) 446e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8)) 447e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8)) 448e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8)) 449e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8)) 450e4c060dbSTony Lindgren 451e4c060dbSTony Lindgren #define OMAP446X_CLASS 0x44600044 452e4c060dbSTony Lindgren #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8)) 453e4c060dbSTony Lindgren #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8)) 454e4c060dbSTony Lindgren 455e4c060dbSTony Lindgren #define OMAP447X_CLASS 0x44700044 456e4c060dbSTony Lindgren #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8)) 457e4c060dbSTony Lindgren 458e4c060dbSTony Lindgren #define OMAP54XX_CLASS 0x54000054 4595a898a78SSantosh Shilimkar #define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8)) 4605a898a78SSantosh Shilimkar #define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8)) 461e4c060dbSTony Lindgren 462e4c060dbSTony Lindgren void omap2xxx_check_revision(void); 463e4c060dbSTony Lindgren void omap3xxx_check_revision(void); 464e4c060dbSTony Lindgren void omap4xxx_check_revision(void); 465e4c060dbSTony Lindgren void omap5xxx_check_revision(void); 466e4c060dbSTony Lindgren void omap3xxx_check_features(void); 467e4c060dbSTony Lindgren void ti81xx_check_features(void); 4687bcad170SVaibhav Hiremath void am33xx_check_features(void); 469e4c060dbSTony Lindgren void omap4xxx_check_features(void); 470e4c060dbSTony Lindgren 471e4c060dbSTony Lindgren /* 472e4c060dbSTony Lindgren * Runtime detection of OMAP3 features 473e4c060dbSTony Lindgren * 474e4c060dbSTony Lindgren * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip 475e4c060dbSTony Lindgren * family have OS-level control over the I/O chain clock. This is 476e4c060dbSTony Lindgren * to avoid a window during which wakeups could potentially be lost 477e4c060dbSTony Lindgren * during powerdomain transitions. If this bit is set, it 478e4c060dbSTony Lindgren * indicates that the chip does support OS-level control of this 479e4c060dbSTony Lindgren * feature. 480e4c060dbSTony Lindgren */ 481e4c060dbSTony Lindgren extern u32 omap_features; 482e4c060dbSTony Lindgren 483e4c060dbSTony Lindgren #define OMAP3_HAS_L2CACHE BIT(0) 484e4c060dbSTony Lindgren #define OMAP3_HAS_IVA BIT(1) 485e4c060dbSTony Lindgren #define OMAP3_HAS_SGX BIT(2) 486e4c060dbSTony Lindgren #define OMAP3_HAS_NEON BIT(3) 487e4c060dbSTony Lindgren #define OMAP3_HAS_ISP BIT(4) 488e4c060dbSTony Lindgren #define OMAP3_HAS_192MHZ_CLK BIT(5) 489e4c060dbSTony Lindgren #define OMAP3_HAS_IO_WAKEUP BIT(6) 490e4c060dbSTony Lindgren #define OMAP3_HAS_SDRC BIT(7) 491e4c060dbSTony Lindgren #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8) 49242a1cc9cSIvan Khoronzhuk #define OMAP4_HAS_PERF_SILICON BIT(9) 493e4c060dbSTony Lindgren 494e4c060dbSTony Lindgren 495e4c060dbSTony Lindgren #define OMAP3_HAS_FEATURE(feat,flag) \ 496e4c060dbSTony Lindgren static inline unsigned int omap3_has_ ##feat(void) \ 497e4c060dbSTony Lindgren { \ 498e4c060dbSTony Lindgren return omap_features & OMAP3_HAS_ ##flag; \ 499e4c060dbSTony Lindgren } \ 500e4c060dbSTony Lindgren 501e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(l2cache, L2CACHE) 502e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(sgx, SGX) 503e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(iva, IVA) 504e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(neon, NEON) 505e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(isp, ISP) 506e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) 507e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) 508e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(sdrc, SDRC) 509e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL) 510e4c060dbSTony Lindgren 511e4c060dbSTony Lindgren /* 512e4c060dbSTony Lindgren * Runtime detection of OMAP4 features 513e4c060dbSTony Lindgren */ 514e4c060dbSTony Lindgren #define OMAP4_HAS_FEATURE(feat, flag) \ 515e4c060dbSTony Lindgren static inline unsigned int omap4_has_ ##feat(void) \ 516e4c060dbSTony Lindgren { \ 517e4c060dbSTony Lindgren return omap_features & OMAP4_HAS_ ##flag; \ 518e4c060dbSTony Lindgren } \ 519e4c060dbSTony Lindgren 52042a1cc9cSIvan Khoronzhuk OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON) 521e4c060dbSTony Lindgren 522816a65efSTony Lindgren /* 523816a65efSTony Lindgren * We need to make sure omap initcalls don't run when 524816a65efSTony Lindgren * multiplatform kernels are booted on other SoCs. 525816a65efSTony Lindgren */ 526816a65efSTony Lindgren #define omap_initcall(level, fn) \ 527816a65efSTony Lindgren static int __init __used __##fn(void) \ 528816a65efSTony Lindgren { \ 529816a65efSTony Lindgren if (!soc_is_omap()) \ 530816a65efSTony Lindgren return 0; \ 531816a65efSTony Lindgren return fn(); \ 532816a65efSTony Lindgren } \ 533816a65efSTony Lindgren level(__##fn); 534816a65efSTony Lindgren 535816a65efSTony Lindgren #define omap_early_initcall(fn) omap_initcall(early_initcall, fn) 536816a65efSTony Lindgren #define omap_core_initcall(fn) omap_initcall(core_initcall, fn) 537816a65efSTony Lindgren #define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn) 538816a65efSTony Lindgren #define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn) 539816a65efSTony Lindgren #define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn) 540816a65efSTony Lindgren #define omap_device_initcall(fn) omap_initcall(device_initcall, fn) 541816a65efSTony Lindgren #define omap_late_initcall(fn) omap_initcall(late_initcall, fn) 542e7e17c53SKevin Hilman #define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn) 543816a65efSTony Lindgren 544e4c060dbSTony Lindgren #endif /* __ASSEMBLY__ */ 545e4c060dbSTony Lindgren 546