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 248af438fecSRajendra Nayak #define soc_is_dra74x() 0 249af438fecSRajendra Nayak #define soc_is_dra72x() 0 250e4c060dbSTony Lindgren 251e4c060dbSTony Lindgren #if defined(MULTI_OMAP2) 252e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP2) 253e4c060dbSTony Lindgren # undef cpu_is_omap24xx 254e4c060dbSTony Lindgren # define cpu_is_omap24xx() is_omap24xx() 255e4c060dbSTony Lindgren # endif 256e4c060dbSTony Lindgren # if defined (CONFIG_SOC_OMAP2420) 257e4c060dbSTony Lindgren # undef cpu_is_omap242x 258e4c060dbSTony Lindgren # define cpu_is_omap242x() is_omap242x() 259e4c060dbSTony Lindgren # endif 260e4c060dbSTony Lindgren # if defined (CONFIG_SOC_OMAP2430) 261e4c060dbSTony Lindgren # undef cpu_is_omap243x 262e4c060dbSTony Lindgren # define cpu_is_omap243x() is_omap243x() 263e4c060dbSTony Lindgren # endif 264e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP3) 265e4c060dbSTony Lindgren # undef cpu_is_omap34xx 266e4c060dbSTony Lindgren # undef cpu_is_omap343x 267e4c060dbSTony Lindgren # define cpu_is_omap34xx() is_omap34xx() 268e4c060dbSTony Lindgren # define cpu_is_omap343x() is_omap343x() 269e4c060dbSTony Lindgren # endif 270e4c060dbSTony Lindgren #else 271e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP2) 272e4c060dbSTony Lindgren # undef cpu_is_omap24xx 273e4c060dbSTony Lindgren # define cpu_is_omap24xx() 1 274e4c060dbSTony Lindgren # endif 275e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP2420) 276e4c060dbSTony Lindgren # undef cpu_is_omap242x 277e4c060dbSTony Lindgren # define cpu_is_omap242x() 1 278e4c060dbSTony Lindgren # endif 279e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP2430) 280e4c060dbSTony Lindgren # undef cpu_is_omap243x 281e4c060dbSTony Lindgren # define cpu_is_omap243x() 1 282e4c060dbSTony Lindgren # endif 283e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP3) 284e4c060dbSTony Lindgren # undef cpu_is_omap34xx 285e4c060dbSTony Lindgren # define cpu_is_omap34xx() 1 286e4c060dbSTony Lindgren # endif 287e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP3430) 288e4c060dbSTony Lindgren # undef cpu_is_omap343x 289e4c060dbSTony Lindgren # define cpu_is_omap343x() 1 290e4c060dbSTony Lindgren # endif 291e4c060dbSTony Lindgren #endif 292e4c060dbSTony Lindgren 293e4c060dbSTony Lindgren /* 294e4c060dbSTony Lindgren * Macros to detect individual cpu types. 295e4c060dbSTony Lindgren * These are only rarely needed. 296e4c060dbSTony Lindgren * cpu_is_omap2420(): True for OMAP2420 297e4c060dbSTony Lindgren * cpu_is_omap2422(): True for OMAP2422 298e4c060dbSTony Lindgren * cpu_is_omap2423(): True for OMAP2423 299e4c060dbSTony Lindgren * cpu_is_omap2430(): True for OMAP2430 300e4c060dbSTony Lindgren * cpu_is_omap3430(): True for OMAP3430 301e4c060dbSTony Lindgren */ 302e4c060dbSTony Lindgren #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) 303e4c060dbSTony Lindgren 304e4c060dbSTony Lindgren #define IS_OMAP_TYPE(type, id) \ 305e4c060dbSTony Lindgren static inline int is_omap ##type (void) \ 306e4c060dbSTony Lindgren { \ 307e4c060dbSTony Lindgren return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ 308e4c060dbSTony Lindgren } 309e4c060dbSTony Lindgren 310e4c060dbSTony Lindgren IS_OMAP_TYPE(2420, 0x2420) 311e4c060dbSTony Lindgren IS_OMAP_TYPE(2422, 0x2422) 312e4c060dbSTony Lindgren IS_OMAP_TYPE(2423, 0x2423) 313e4c060dbSTony Lindgren IS_OMAP_TYPE(2430, 0x2430) 314e4c060dbSTony Lindgren IS_OMAP_TYPE(3430, 0x3430) 315e4c060dbSTony Lindgren 316e4c060dbSTony Lindgren #define cpu_is_omap2420() 0 317e4c060dbSTony Lindgren #define cpu_is_omap2422() 0 318e4c060dbSTony Lindgren #define cpu_is_omap2423() 0 319e4c060dbSTony Lindgren #define cpu_is_omap2430() 0 320e4c060dbSTony Lindgren #define cpu_is_omap3430() 0 321e4c060dbSTony Lindgren #define cpu_is_omap3630() 0 322e4c060dbSTony Lindgren #define soc_is_omap5430() 0 323e4c060dbSTony Lindgren 324e4c060dbSTony Lindgren /* These are needed for the common code */ 325e4c060dbSTony Lindgren #ifdef CONFIG_ARCH_OMAP2PLUS 326e4c060dbSTony Lindgren #define cpu_is_omap7xx() 0 327e4c060dbSTony Lindgren #define cpu_is_omap15xx() 0 328e4c060dbSTony Lindgren #define cpu_is_omap16xx() 0 329e4c060dbSTony Lindgren #define cpu_is_omap1510() 0 330e4c060dbSTony Lindgren #define cpu_is_omap1610() 0 331e4c060dbSTony Lindgren #define cpu_is_omap1611() 0 332e4c060dbSTony Lindgren #define cpu_is_omap1621() 0 333e4c060dbSTony Lindgren #define cpu_is_omap1710() 0 334e4c060dbSTony Lindgren #define cpu_class_is_omap1() 0 335e4c060dbSTony Lindgren #define cpu_class_is_omap2() 1 336e4c060dbSTony Lindgren #endif 337e4c060dbSTony Lindgren 338e4c060dbSTony Lindgren #if defined(CONFIG_ARCH_OMAP2) 339e4c060dbSTony Lindgren # undef cpu_is_omap2420 340e4c060dbSTony Lindgren # undef cpu_is_omap2422 341e4c060dbSTony Lindgren # undef cpu_is_omap2423 342e4c060dbSTony Lindgren # undef cpu_is_omap2430 343e4c060dbSTony Lindgren # define cpu_is_omap2420() is_omap2420() 344e4c060dbSTony Lindgren # define cpu_is_omap2422() is_omap2422() 345e4c060dbSTony Lindgren # define cpu_is_omap2423() is_omap2423() 346e4c060dbSTony Lindgren # define cpu_is_omap2430() is_omap2430() 347e4c060dbSTony Lindgren #endif 348e4c060dbSTony Lindgren 349e4c060dbSTony Lindgren #if defined(CONFIG_ARCH_OMAP3) 350e4c060dbSTony Lindgren # undef cpu_is_omap3430 351e4c060dbSTony Lindgren # undef cpu_is_ti81xx 352e4c060dbSTony Lindgren # undef cpu_is_ti816x 353e4c060dbSTony Lindgren # undef cpu_is_ti814x 354e4c060dbSTony Lindgren # undef soc_is_am35xx 355e4c060dbSTony Lindgren # define cpu_is_omap3430() is_omap3430() 356e4c060dbSTony Lindgren # undef cpu_is_omap3630 357e4c060dbSTony Lindgren # define cpu_is_omap3630() is_omap363x() 358e4c060dbSTony Lindgren # define cpu_is_ti81xx() is_ti81xx() 359e4c060dbSTony Lindgren # define cpu_is_ti816x() is_ti816x() 360e4c060dbSTony Lindgren # define cpu_is_ti814x() is_ti814x() 361e4c060dbSTony Lindgren # define soc_is_am35xx() is_am35xx() 362e4c060dbSTony Lindgren #endif 363e4c060dbSTony Lindgren 364e4c060dbSTony Lindgren # if defined(CONFIG_SOC_AM33XX) 365e4c060dbSTony Lindgren # undef soc_is_am33xx 366e4c060dbSTony Lindgren # undef soc_is_am335x 367e4c060dbSTony Lindgren # define soc_is_am33xx() is_am33xx() 368e4c060dbSTony Lindgren # define soc_is_am335x() is_am335x() 369e4c060dbSTony Lindgren #endif 370e4c060dbSTony Lindgren 371c664d0a9SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX 372c664d0a9SAfzal Mohammed # undef soc_is_am43xx 373c664d0a9SAfzal Mohammed # undef soc_is_am437x 374c664d0a9SAfzal Mohammed # define soc_is_am43xx() is_am43xx() 375c664d0a9SAfzal Mohammed # define soc_is_am437x() is_am437x() 376c664d0a9SAfzal Mohammed #endif 377c664d0a9SAfzal Mohammed 378e4c060dbSTony Lindgren # if defined(CONFIG_ARCH_OMAP4) 379e4c060dbSTony Lindgren # undef cpu_is_omap44xx 380e4c060dbSTony Lindgren # undef cpu_is_omap443x 381e4c060dbSTony Lindgren # undef cpu_is_omap446x 382e4c060dbSTony Lindgren # undef cpu_is_omap447x 383e4c060dbSTony Lindgren # define cpu_is_omap44xx() is_omap44xx() 384e4c060dbSTony Lindgren # define cpu_is_omap443x() is_omap443x() 385e4c060dbSTony Lindgren # define cpu_is_omap446x() is_omap446x() 386e4c060dbSTony Lindgren # define cpu_is_omap447x() is_omap447x() 387e4c060dbSTony Lindgren # endif 388e4c060dbSTony Lindgren 389e4c060dbSTony Lindgren # if defined(CONFIG_SOC_OMAP5) 390e4c060dbSTony Lindgren # undef soc_is_omap54xx 391e4c060dbSTony Lindgren # undef soc_is_omap543x 392e4c060dbSTony Lindgren # define soc_is_omap54xx() is_omap54xx() 393e4c060dbSTony Lindgren # define soc_is_omap543x() is_omap543x() 394e4c060dbSTony Lindgren #endif 395e4c060dbSTony Lindgren 3966852215aSR Sricharan #if defined(CONFIG_SOC_DRA7XX) 3976852215aSR Sricharan #undef soc_is_dra7xx 398af438fecSRajendra Nayak #undef soc_is_dra74x 399af438fecSRajendra Nayak #undef soc_is_dra72x 4006852215aSR Sricharan #define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7")) 401af438fecSRajendra Nayak #define soc_is_dra74x() (of_machine_is_compatible("ti,dra74")) 402af438fecSRajendra Nayak #define soc_is_dra72x() (of_machine_is_compatible("ti,dra72")) 4036852215aSR Sricharan #endif 4046852215aSR Sricharan 405e4c060dbSTony Lindgren /* Various silicon revisions for omap2 */ 406e4c060dbSTony Lindgren #define OMAP242X_CLASS 0x24200024 407e4c060dbSTony Lindgren #define OMAP2420_REV_ES1_0 OMAP242X_CLASS 408e4c060dbSTony Lindgren #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8)) 409e4c060dbSTony Lindgren 410e4c060dbSTony Lindgren #define OMAP243X_CLASS 0x24300024 411e4c060dbSTony Lindgren #define OMAP2430_REV_ES1_0 OMAP243X_CLASS 412e4c060dbSTony Lindgren 413e4c060dbSTony Lindgren #define OMAP343X_CLASS 0x34300034 414e4c060dbSTony Lindgren #define OMAP3430_REV_ES1_0 OMAP343X_CLASS 415e4c060dbSTony Lindgren #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8)) 416e4c060dbSTony Lindgren #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8)) 417e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8)) 418e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8)) 419e4c060dbSTony Lindgren #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8)) 420e4c060dbSTony Lindgren 421e4c060dbSTony Lindgren #define OMAP363X_CLASS 0x36300034 422e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_0 OMAP363X_CLASS 423e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8)) 424e4c060dbSTony Lindgren #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8)) 425e4c060dbSTony Lindgren 426*c27964b5STony Lindgren #define TI816X_CLASS 0x81600081 427e4c060dbSTony Lindgren #define TI8168_REV_ES1_0 TI816X_CLASS 428e4c060dbSTony Lindgren #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8)) 429a5f93d9dSAida Mynzhasova #define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8)) 430a5f93d9dSAida Mynzhasova #define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8)) 431e4c060dbSTony Lindgren 432*c27964b5STony Lindgren #define TI814X_CLASS 0x81400081 433e4c060dbSTony Lindgren #define TI8148_REV_ES1_0 TI814X_CLASS 434e4c060dbSTony Lindgren #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8)) 435e4c060dbSTony Lindgren #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8)) 436e4c060dbSTony Lindgren 437e4c060dbSTony Lindgren #define AM35XX_CLASS 0x35170034 438e4c060dbSTony Lindgren #define AM35XX_REV_ES1_0 AM35XX_CLASS 439e4c060dbSTony Lindgren #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8)) 440e4c060dbSTony Lindgren 441e4c060dbSTony Lindgren #define AM335X_CLASS 0x33500033 442e4c060dbSTony Lindgren #define AM335X_REV_ES1_0 AM335X_CLASS 4435af044f4SAnilKumar Ch #define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8)) 444d240ef30SVaibhav Hiremath #define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8)) 445e4c060dbSTony Lindgren 446c664d0a9SAfzal Mohammed #define AM437X_CLASS 0x43700000 4474a2ed4c0SLokesh Vutla #define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8)) 4484a2ed4c0SLokesh Vutla #define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8)) 4494fdd54f0SLokesh Vutla #define AM437X_REV_ES1_2 (AM437X_CLASS | (0x12 << 8)) 450c664d0a9SAfzal Mohammed 451e4c060dbSTony Lindgren #define OMAP443X_CLASS 0x44300044 452e4c060dbSTony Lindgren #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) 453e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8)) 454e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8)) 455e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8)) 456e4c060dbSTony Lindgren #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8)) 457e4c060dbSTony Lindgren 458e4c060dbSTony Lindgren #define OMAP446X_CLASS 0x44600044 459e4c060dbSTony Lindgren #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8)) 460e4c060dbSTony Lindgren #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8)) 461e4c060dbSTony Lindgren 462e4c060dbSTony Lindgren #define OMAP447X_CLASS 0x44700044 463e4c060dbSTony Lindgren #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8)) 464e4c060dbSTony Lindgren 465e4c060dbSTony Lindgren #define OMAP54XX_CLASS 0x54000054 4665a898a78SSantosh Shilimkar #define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8)) 4675a898a78SSantosh Shilimkar #define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8)) 468e4c060dbSTony Lindgren 469733d20eeSNishanth Menon #define DRA7XX_CLASS 0x07000000 470733d20eeSNishanth Menon #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) 471733d20eeSNishanth Menon #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) 47273d20280SNishanth Menon #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8)) 473733d20eeSNishanth Menon 474e4c060dbSTony Lindgren void omap2xxx_check_revision(void); 475e4c060dbSTony Lindgren void omap3xxx_check_revision(void); 476e4c060dbSTony Lindgren void omap4xxx_check_revision(void); 477e4c060dbSTony Lindgren void omap5xxx_check_revision(void); 478733d20eeSNishanth Menon void dra7xxx_check_revision(void); 479e4c060dbSTony Lindgren void omap3xxx_check_features(void); 480e4c060dbSTony Lindgren void ti81xx_check_features(void); 4817bcad170SVaibhav Hiremath void am33xx_check_features(void); 482e4c060dbSTony Lindgren void omap4xxx_check_features(void); 483e4c060dbSTony Lindgren 484e4c060dbSTony Lindgren /* 485e4c060dbSTony Lindgren * Runtime detection of OMAP3 features 486e4c060dbSTony Lindgren * 487e4c060dbSTony Lindgren * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip 488e4c060dbSTony Lindgren * family have OS-level control over the I/O chain clock. This is 489e4c060dbSTony Lindgren * to avoid a window during which wakeups could potentially be lost 490e4c060dbSTony Lindgren * during powerdomain transitions. If this bit is set, it 491e4c060dbSTony Lindgren * indicates that the chip does support OS-level control of this 492e4c060dbSTony Lindgren * feature. 493e4c060dbSTony Lindgren */ 494e4c060dbSTony Lindgren extern u32 omap_features; 495e4c060dbSTony Lindgren 496e4c060dbSTony Lindgren #define OMAP3_HAS_L2CACHE BIT(0) 497e4c060dbSTony Lindgren #define OMAP3_HAS_IVA BIT(1) 498e4c060dbSTony Lindgren #define OMAP3_HAS_SGX BIT(2) 499e4c060dbSTony Lindgren #define OMAP3_HAS_NEON BIT(3) 500e4c060dbSTony Lindgren #define OMAP3_HAS_ISP BIT(4) 501e4c060dbSTony Lindgren #define OMAP3_HAS_192MHZ_CLK BIT(5) 502e4c060dbSTony Lindgren #define OMAP3_HAS_IO_WAKEUP BIT(6) 503e4c060dbSTony Lindgren #define OMAP3_HAS_SDRC BIT(7) 504e4c060dbSTony Lindgren #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8) 50542a1cc9cSIvan Khoronzhuk #define OMAP4_HAS_PERF_SILICON BIT(9) 506e4c060dbSTony Lindgren 507e4c060dbSTony Lindgren 508e4c060dbSTony Lindgren #define OMAP3_HAS_FEATURE(feat,flag) \ 509e4c060dbSTony Lindgren static inline unsigned int omap3_has_ ##feat(void) \ 510e4c060dbSTony Lindgren { \ 511e4c060dbSTony Lindgren return omap_features & OMAP3_HAS_ ##flag; \ 512e4c060dbSTony Lindgren } \ 513e4c060dbSTony Lindgren 514e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(l2cache, L2CACHE) 515e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(sgx, SGX) 516e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(iva, IVA) 517e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(neon, NEON) 518e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(isp, ISP) 519e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) 520e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) 521e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(sdrc, SDRC) 522e4c060dbSTony Lindgren OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL) 523e4c060dbSTony Lindgren 524e4c060dbSTony Lindgren /* 525e4c060dbSTony Lindgren * Runtime detection of OMAP4 features 526e4c060dbSTony Lindgren */ 527e4c060dbSTony Lindgren #define OMAP4_HAS_FEATURE(feat, flag) \ 528e4c060dbSTony Lindgren static inline unsigned int omap4_has_ ##feat(void) \ 529e4c060dbSTony Lindgren { \ 530e4c060dbSTony Lindgren return omap_features & OMAP4_HAS_ ##flag; \ 531e4c060dbSTony Lindgren } \ 532e4c060dbSTony Lindgren 53342a1cc9cSIvan Khoronzhuk OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON) 534e4c060dbSTony Lindgren 535816a65efSTony Lindgren /* 536816a65efSTony Lindgren * We need to make sure omap initcalls don't run when 537816a65efSTony Lindgren * multiplatform kernels are booted on other SoCs. 538816a65efSTony Lindgren */ 539816a65efSTony Lindgren #define omap_initcall(level, fn) \ 540816a65efSTony Lindgren static int __init __used __##fn(void) \ 541816a65efSTony Lindgren { \ 542816a65efSTony Lindgren if (!soc_is_omap()) \ 543816a65efSTony Lindgren return 0; \ 544816a65efSTony Lindgren return fn(); \ 545816a65efSTony Lindgren } \ 546816a65efSTony Lindgren level(__##fn); 547816a65efSTony Lindgren 548816a65efSTony Lindgren #define omap_early_initcall(fn) omap_initcall(early_initcall, fn) 549816a65efSTony Lindgren #define omap_core_initcall(fn) omap_initcall(core_initcall, fn) 550816a65efSTony Lindgren #define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn) 551816a65efSTony Lindgren #define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn) 552816a65efSTony Lindgren #define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn) 553816a65efSTony Lindgren #define omap_device_initcall(fn) omap_initcall(device_initcall, fn) 554816a65efSTony Lindgren #define omap_late_initcall(fn) omap_initcall(late_initcall, fn) 555e7e17c53SKevin Hilman #define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn) 556816a65efSTony Lindgren 557e4c060dbSTony Lindgren #endif /* __ASSEMBLY__ */ 558e4c060dbSTony Lindgren 559