Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * OMAP cpu type detection
0004  *
0005  * Copyright (C) 2004, 2008 Nokia Corporation
0006  *
0007  * Copyright (C) 2009-11 Texas Instruments.
0008  *
0009  * Written by Tony Lindgren <tony.lindgren@nokia.com>
0010  *
0011  * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
0012  */
0013 
0014 #ifndef __ASM_ARCH_OMAP_CPU_H
0015 #define __ASM_ARCH_OMAP_CPU_H
0016 
0017 /*
0018  * Test if multicore OMAP support is needed
0019  */
0020 #undef MULTI_OMAP1
0021 #undef OMAP_NAME
0022 
0023 #ifdef CONFIG_ARCH_OMAP730
0024 # ifdef OMAP_NAME
0025 #  undef  MULTI_OMAP1
0026 #  define MULTI_OMAP1
0027 # else
0028 #  define OMAP_NAME omap730
0029 # endif
0030 #endif
0031 #ifdef CONFIG_ARCH_OMAP850
0032 # ifdef OMAP_NAME
0033 #  undef  MULTI_OMAP1
0034 #  define MULTI_OMAP1
0035 # else
0036 #  define OMAP_NAME omap850
0037 # endif
0038 #endif
0039 #ifdef CONFIG_ARCH_OMAP15XX
0040 # ifdef OMAP_NAME
0041 #  undef  MULTI_OMAP1
0042 #  define MULTI_OMAP1
0043 # else
0044 #  define OMAP_NAME omap1510
0045 # endif
0046 #endif
0047 #ifdef CONFIG_ARCH_OMAP16XX
0048 # ifdef OMAP_NAME
0049 #  undef  MULTI_OMAP1
0050 #  define MULTI_OMAP1
0051 # else
0052 #  define OMAP_NAME omap16xx
0053 # endif
0054 #endif
0055 
0056 /*
0057  * omap_rev bits:
0058  * CPU id bits  (0730, 1510, 1710, 2422...) [31:16]
0059  * CPU revision (See _REV_ defined in cpu.h)    [15:08]
0060  * CPU class bits (15xx, 16xx, 24xx, 34xx...)   [07:00]
0061  */
0062 unsigned int omap_rev(void);
0063 
0064 /*
0065  * Get the CPU revision for OMAP devices
0066  */
0067 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
0068 
0069 /*
0070  * Macros to group OMAP into cpu classes.
0071  * These can be used in most places.
0072  * cpu_is_omap7xx():    True for OMAP730, OMAP850
0073  * cpu_is_omap15xx():   True for OMAP1510, OMAP5910 and OMAP310
0074  * cpu_is_omap16xx():   True for OMAP1610, OMAP5912 and OMAP1710
0075  */
0076 #define GET_OMAP_CLASS  (omap_rev() & 0xff)
0077 
0078 #define IS_OMAP_CLASS(class, id)            \
0079 static inline int is_omap ##class (void)        \
0080 {                           \
0081     return (GET_OMAP_CLASS == (id)) ? 1 : 0;    \
0082 }
0083 
0084 #define GET_OMAP_SUBCLASS   ((omap_rev() >> 20) & 0x0fff)
0085 
0086 #define IS_OMAP_SUBCLASS(subclass, id)          \
0087 static inline int is_omap ##subclass (void)     \
0088 {                           \
0089     return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
0090 }
0091 
0092 IS_OMAP_CLASS(7xx, 0x07)
0093 IS_OMAP_CLASS(15xx, 0x15)
0094 IS_OMAP_CLASS(16xx, 0x16)
0095 
0096 #define cpu_is_omap7xx()        0
0097 #define cpu_is_omap15xx()       0
0098 #define cpu_is_omap16xx()       0
0099 
0100 #if defined(MULTI_OMAP1)
0101 # if defined(CONFIG_ARCH_OMAP730)
0102 #  undef  cpu_is_omap7xx
0103 #  define cpu_is_omap7xx()      is_omap7xx()
0104 # endif
0105 # if defined(CONFIG_ARCH_OMAP850)
0106 #  undef  cpu_is_omap7xx
0107 #  define cpu_is_omap7xx()      is_omap7xx()
0108 # endif
0109 # if defined(CONFIG_ARCH_OMAP15XX)
0110 #  undef  cpu_is_omap15xx
0111 #  define cpu_is_omap15xx()     is_omap15xx()
0112 # endif
0113 # if defined(CONFIG_ARCH_OMAP16XX)
0114 #  undef  cpu_is_omap16xx
0115 #  define cpu_is_omap16xx()     is_omap16xx()
0116 # endif
0117 #else
0118 # if defined(CONFIG_ARCH_OMAP730)
0119 #  undef  cpu_is_omap7xx
0120 #  define cpu_is_omap7xx()      1
0121 # endif
0122 # if defined(CONFIG_ARCH_OMAP850)
0123 #  undef  cpu_is_omap7xx
0124 #  define cpu_is_omap7xx()      1
0125 # endif
0126 # if defined(CONFIG_ARCH_OMAP15XX)
0127 #  undef  cpu_is_omap15xx
0128 #  define cpu_is_omap15xx()     1
0129 # endif
0130 # if defined(CONFIG_ARCH_OMAP16XX)
0131 #  undef  cpu_is_omap16xx
0132 #  define cpu_is_omap16xx()     1
0133 # endif
0134 #endif
0135 
0136 /*
0137  * Macros to detect individual cpu types.
0138  * These are only rarely needed.
0139  * cpu_is_omap310():    True for OMAP310
0140  * cpu_is_omap1510():   True for OMAP1510
0141  * cpu_is_omap1610():   True for OMAP1610
0142  * cpu_is_omap1611():   True for OMAP1611
0143  * cpu_is_omap5912():   True for OMAP5912
0144  * cpu_is_omap1621():   True for OMAP1621
0145  * cpu_is_omap1710():   True for OMAP1710
0146  */
0147 #define GET_OMAP_TYPE   ((omap_rev() >> 16) & 0xffff)
0148 
0149 #define IS_OMAP_TYPE(type, id)              \
0150 static inline int is_omap ##type (void)         \
0151 {                           \
0152     return (GET_OMAP_TYPE == (id)) ? 1 : 0;     \
0153 }
0154 
0155 IS_OMAP_TYPE(310, 0x0310)
0156 IS_OMAP_TYPE(1510, 0x1510)
0157 IS_OMAP_TYPE(1610, 0x1610)
0158 IS_OMAP_TYPE(1611, 0x1611)
0159 IS_OMAP_TYPE(5912, 0x1611)
0160 IS_OMAP_TYPE(1621, 0x1621)
0161 IS_OMAP_TYPE(1710, 0x1710)
0162 
0163 #define cpu_is_omap310()        0
0164 #define cpu_is_omap1510()       0
0165 #define cpu_is_omap1610()       0
0166 #define cpu_is_omap5912()       0
0167 #define cpu_is_omap1611()       0
0168 #define cpu_is_omap1621()       0
0169 #define cpu_is_omap1710()       0
0170 
0171 #define cpu_class_is_omap1()        1
0172 
0173 /*
0174  * Whether we have MULTI_OMAP1 or not, we still need to distinguish
0175  * between 310 vs. 1510 and 1611B/5912 vs. 1710.
0176  */
0177 
0178 #if defined(CONFIG_ARCH_OMAP15XX)
0179 # undef  cpu_is_omap310
0180 # undef  cpu_is_omap1510
0181 # define cpu_is_omap310()       is_omap310()
0182 # define cpu_is_omap1510()      is_omap1510()
0183 #endif
0184 
0185 #if defined(CONFIG_ARCH_OMAP16XX)
0186 # undef  cpu_is_omap1610
0187 # undef  cpu_is_omap1611
0188 # undef  cpu_is_omap5912
0189 # undef  cpu_is_omap1621
0190 # undef  cpu_is_omap1710
0191 # define cpu_is_omap1610()      is_omap1610()
0192 # define cpu_is_omap1611()      is_omap1611()
0193 # define cpu_is_omap5912()      is_omap5912()
0194 # define cpu_is_omap1621()      is_omap1621()
0195 # define cpu_is_omap1710()      is_omap1710()
0196 #endif
0197 
0198 #endif