1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 2 /* 3 * OMAP cpu type detection 3 * OMAP cpu type detection 4 * 4 * 5 * Copyright (C) 2004, 2008 Nokia Corporation 5 * Copyright (C) 2004, 2008 Nokia Corporation 6 * 6 * 7 * Copyright (C) 2009-11 Texas Instruments. 7 * Copyright (C) 2009-11 Texas Instruments. 8 * 8 * 9 * Written by Tony Lindgren <tony.lindgren@nok 9 * Written by Tony Lindgren <tony.lindgren@nokia.com> 10 * 10 * 11 * Added OMAP4/5 specific defines - Santosh Sh 11 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com> 12 */ 12 */ 13 13 14 #ifndef __ASM_ARCH_OMAP_CPU_H 14 #ifndef __ASM_ARCH_OMAP_CPU_H 15 #define __ASM_ARCH_OMAP_CPU_H 15 #define __ASM_ARCH_OMAP_CPU_H 16 16 17 /* 17 /* 18 * Test if multicore OMAP support is needed 18 * Test if multicore OMAP support is needed 19 */ 19 */ 20 #undef MULTI_OMAP1 20 #undef MULTI_OMAP1 21 #undef OMAP_NAME 21 #undef OMAP_NAME 22 22 23 #ifdef CONFIG_ARCH_OMAP15XX 23 #ifdef CONFIG_ARCH_OMAP15XX 24 # ifdef OMAP_NAME 24 # ifdef OMAP_NAME 25 # undef MULTI_OMAP1 25 # undef MULTI_OMAP1 26 # define MULTI_OMAP1 26 # define MULTI_OMAP1 27 # else 27 # else 28 # define OMAP_NAME omap1510 28 # define OMAP_NAME omap1510 29 # endif 29 # endif 30 #endif 30 #endif 31 #ifdef CONFIG_ARCH_OMAP16XX 31 #ifdef CONFIG_ARCH_OMAP16XX 32 # ifdef OMAP_NAME 32 # ifdef OMAP_NAME 33 # undef MULTI_OMAP1 33 # undef MULTI_OMAP1 34 # define MULTI_OMAP1 34 # define MULTI_OMAP1 35 # else 35 # else 36 # define OMAP_NAME omap16xx 36 # define OMAP_NAME omap16xx 37 # endif 37 # endif 38 #endif 38 #endif 39 39 40 /* 40 /* 41 * omap_rev bits: 41 * omap_rev bits: 42 * CPU id bits (0730, 1510, 1710, 2422...) 42 * CPU id bits (0730, 1510, 1710, 2422...) [31:16] 43 * CPU revision (See _REV_ defined in cpu.h) 43 * CPU revision (See _REV_ defined in cpu.h) [15:08] 44 * CPU class bits (15xx, 16xx, 24xx, 34xx...) 44 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00] 45 */ 45 */ 46 unsigned int omap_rev(void); 46 unsigned int omap_rev(void); 47 47 48 /* 48 /* 49 * Get the CPU revision for OMAP devices 49 * Get the CPU revision for OMAP devices 50 */ 50 */ 51 #define GET_OMAP_REVISION() ((omap_rev() > 51 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) 52 52 53 /* 53 /* 54 * Macros to group OMAP into cpu classes. 54 * Macros to group OMAP into cpu classes. 55 * These can be used in most places. 55 * These can be used in most places. 56 * cpu_is_omap15xx(): True for OMAP1510, OMA 56 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 57 * cpu_is_omap16xx(): True for OMAP1610, OMA 57 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 58 */ 58 */ 59 #define GET_OMAP_CLASS (omap_rev() & 0xff) 59 #define GET_OMAP_CLASS (omap_rev() & 0xff) 60 60 61 #define IS_OMAP_CLASS(class, id) 61 #define IS_OMAP_CLASS(class, id) \ 62 static inline int is_omap ##class (void) 62 static inline int is_omap ##class (void) \ 63 { 63 { \ 64 return (GET_OMAP_CLASS == (id)) ? 1 : 64 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ 65 } 65 } 66 66 67 #define GET_OMAP_SUBCLASS ((omap_rev() > 67 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff) 68 68 69 #define IS_OMAP_SUBCLASS(subclass, id) 69 #define IS_OMAP_SUBCLASS(subclass, id) \ 70 static inline int is_omap ##subclass (void) 70 static inline int is_omap ##subclass (void) \ 71 { 71 { \ 72 return (GET_OMAP_SUBCLASS == (id)) ? 1 72 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ 73 } 73 } 74 74 75 IS_OMAP_CLASS(15xx, 0x15) 75 IS_OMAP_CLASS(15xx, 0x15) 76 IS_OMAP_CLASS(16xx, 0x16) 76 IS_OMAP_CLASS(16xx, 0x16) 77 77 78 #define cpu_is_omap15xx() 0 78 #define cpu_is_omap15xx() 0 79 #define cpu_is_omap16xx() 0 79 #define cpu_is_omap16xx() 0 80 80 81 #if defined(MULTI_OMAP1) 81 #if defined(MULTI_OMAP1) 82 # if defined(CONFIG_ARCH_OMAP15XX) 82 # if defined(CONFIG_ARCH_OMAP15XX) 83 # undef cpu_is_omap15xx 83 # undef cpu_is_omap15xx 84 # define cpu_is_omap15xx() is_oma 84 # define cpu_is_omap15xx() is_omap15xx() 85 # endif 85 # endif 86 # if defined(CONFIG_ARCH_OMAP16XX) 86 # if defined(CONFIG_ARCH_OMAP16XX) 87 # undef cpu_is_omap16xx 87 # undef cpu_is_omap16xx 88 # define cpu_is_omap16xx() is_oma 88 # define cpu_is_omap16xx() is_omap16xx() 89 # endif 89 # endif 90 #else 90 #else 91 # if defined(CONFIG_ARCH_OMAP15XX) 91 # if defined(CONFIG_ARCH_OMAP15XX) 92 # undef cpu_is_omap15xx 92 # undef cpu_is_omap15xx 93 # define cpu_is_omap15xx() 1 93 # define cpu_is_omap15xx() 1 94 # endif 94 # endif 95 # if defined(CONFIG_ARCH_OMAP16XX) 95 # if defined(CONFIG_ARCH_OMAP16XX) 96 # undef cpu_is_omap16xx 96 # undef cpu_is_omap16xx 97 # define cpu_is_omap16xx() 1 97 # define cpu_is_omap16xx() 1 98 # endif 98 # endif 99 #endif 99 #endif 100 100 101 /* 101 /* 102 * Macros to detect individual cpu types. 102 * Macros to detect individual cpu types. 103 * These are only rarely needed. 103 * These are only rarely needed. 104 * cpu_is_omap310(): True for OMAP310 104 * cpu_is_omap310(): True for OMAP310 105 * cpu_is_omap1510(): True for OMAP1510 105 * cpu_is_omap1510(): True for OMAP1510 106 * cpu_is_omap1610(): True for OMAP1610 106 * cpu_is_omap1610(): True for OMAP1610 107 * cpu_is_omap1611(): True for OMAP1611 107 * cpu_is_omap1611(): True for OMAP1611 108 * cpu_is_omap5912(): True for OMAP5912 108 * cpu_is_omap5912(): True for OMAP5912 109 * cpu_is_omap1621(): True for OMAP1621 109 * cpu_is_omap1621(): True for OMAP1621 110 * cpu_is_omap1710(): True for OMAP1710 110 * cpu_is_omap1710(): True for OMAP1710 111 */ 111 */ 112 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 112 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) 113 113 114 #define IS_OMAP_TYPE(type, id) 114 #define IS_OMAP_TYPE(type, id) \ 115 static inline int is_omap ##type (void) 115 static inline int is_omap ##type (void) \ 116 { 116 { \ 117 return (GET_OMAP_TYPE == (id)) ? 1 : 0 117 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ 118 } 118 } 119 119 120 IS_OMAP_TYPE(310, 0x0310) 120 IS_OMAP_TYPE(310, 0x0310) 121 IS_OMAP_TYPE(1510, 0x1510) 121 IS_OMAP_TYPE(1510, 0x1510) 122 IS_OMAP_TYPE(1610, 0x1610) 122 IS_OMAP_TYPE(1610, 0x1610) 123 IS_OMAP_TYPE(1611, 0x1611) 123 IS_OMAP_TYPE(1611, 0x1611) 124 IS_OMAP_TYPE(5912, 0x1611) 124 IS_OMAP_TYPE(5912, 0x1611) 125 IS_OMAP_TYPE(1621, 0x1621) 125 IS_OMAP_TYPE(1621, 0x1621) 126 IS_OMAP_TYPE(1710, 0x1710) 126 IS_OMAP_TYPE(1710, 0x1710) 127 127 128 #define cpu_is_omap310() 0 128 #define cpu_is_omap310() 0 129 #define cpu_is_omap1510() 0 129 #define cpu_is_omap1510() 0 130 #define cpu_is_omap1610() 0 130 #define cpu_is_omap1610() 0 131 #define cpu_is_omap5912() 0 131 #define cpu_is_omap5912() 0 132 #define cpu_is_omap1611() 0 132 #define cpu_is_omap1611() 0 133 #define cpu_is_omap1621() 0 133 #define cpu_is_omap1621() 0 134 #define cpu_is_omap1710() 0 134 #define cpu_is_omap1710() 0 135 135 136 #define cpu_class_is_omap1() 1 136 #define cpu_class_is_omap1() 1 137 137 138 /* 138 /* 139 * Whether we have MULTI_OMAP1 or not, we stil 139 * Whether we have MULTI_OMAP1 or not, we still need to distinguish 140 * between 310 vs. 1510 and 1611B/5912 vs. 171 140 * between 310 vs. 1510 and 1611B/5912 vs. 1710. 141 */ 141 */ 142 142 143 #if defined(CONFIG_ARCH_OMAP15XX) 143 #if defined(CONFIG_ARCH_OMAP15XX) 144 # undef cpu_is_omap310 144 # undef cpu_is_omap310 145 # undef cpu_is_omap1510 145 # undef cpu_is_omap1510 146 # define cpu_is_omap310() is_oma 146 # define cpu_is_omap310() is_omap310() 147 # define cpu_is_omap1510() is_oma 147 # define cpu_is_omap1510() is_omap1510() 148 #endif 148 #endif 149 149 150 #if defined(CONFIG_ARCH_OMAP16XX) 150 #if defined(CONFIG_ARCH_OMAP16XX) 151 # undef cpu_is_omap1610 151 # undef cpu_is_omap1610 152 # undef cpu_is_omap1611 152 # undef cpu_is_omap1611 153 # undef cpu_is_omap5912 153 # undef cpu_is_omap5912 154 # undef cpu_is_omap1621 154 # undef cpu_is_omap1621 155 # undef cpu_is_omap1710 155 # undef cpu_is_omap1710 156 # define cpu_is_omap1610() is_oma 156 # define cpu_is_omap1610() is_omap1610() 157 # define cpu_is_omap1611() is_oma 157 # define cpu_is_omap1611() is_omap1611() 158 # define cpu_is_omap5912() is_oma 158 # define cpu_is_omap5912() is_omap5912() 159 # define cpu_is_omap1621() is_oma 159 # define cpu_is_omap1621() is_omap1621() 160 # define cpu_is_omap1710() is_oma 160 # define cpu_is_omap1710() is_omap1710() 161 #endif 161 #endif 162 162 163 #endif 163 #endif 164 164
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.