]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/asm-arm/arch-omap/cpu.h
[PATCH] ARM: OMAP: Clean up cpu.h, part 3
[linux-2.6-omap-h63xx.git] / include / asm-arm / arch-omap / cpu.h
1 /*
2  * linux/include/asm-arm/arch-omap/cpu.h
3  *
4  * OMAP cpu type detection
5  *
6  * Copyright (C) 2004 Nokia Corporation
7  *
8  * Written by Tony Lindgren <tony.lindgren@nokia.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */
25
26 #ifndef __ASM_ARCH_OMAP_CPU_H
27 #define __ASM_ARCH_OMAP_CPU_H
28
29 extern unsigned int system_rev;
30
31 #define OMAP_DIE_ID_0           0xfffe1800
32 #define OMAP_DIE_ID_1           0xfffe1804
33 #define OMAP_PRODUCTION_ID_0    0xfffe2000
34 #define OMAP_PRODUCTION_ID_1    0xfffe2004
35 #define OMAP32_ID_0             0xfffed400
36 #define OMAP32_ID_1             0xfffed404
37
38 /*
39  * Test if multicore OMAP support is needed
40  */
41 #undef MULTI_OMAP1
42 #undef MULTI_OMAP2
43 #undef OMAP_NAME
44
45 #ifdef CONFIG_ARCH_OMAP730
46 # ifdef OMAP_NAME
47 #  undef  MULTI_OMAP1
48 #  define MULTI_OMAP1
49 # else
50 #  define OMAP_NAME omap730
51 # endif
52 #endif
53 #ifdef CONFIG_ARCH_OMAP1510
54 # ifdef OMAP_NAME
55 #  undef  MULTI_OMAP1
56 #  define MULTI_OMAP1
57 # else
58 #  define OMAP_NAME omap1510
59 # endif
60 #endif
61 #ifdef CONFIG_ARCH_OMAP16XX
62 # ifdef OMAP_NAME
63 #  undef  MULTI_OMAP1
64 #  define MULTI_OMAP1
65 # else
66 #  define OMAP_NAME omap16xx
67 # endif
68 #endif
69 #ifdef CONFIG_ARCH_OMAP24XX
70 # if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
71 #  error "OMAP1 and OMAP2 can't be selected at the same time"
72 # else
73 #  undef  MULTI_OMAP2
74 #  define OMAP_NAME omap24xx
75 # endif
76 #endif
77
78 /*
79  * Macros to group OMAP into cpu classes.
80  * These can be used in most places.
81  * cpu_is_omap7xx():    True for OMAP730
82  * cpu_is_omap15xx():   True for OMAP1510 and OMAP5910
83  * cpu_is_omap16xx():   True for OMAP1610, OMAP5912 and OMAP1710
84  * cpu_is_omap24xx():   True for OMAP2420
85  */
86 #define GET_OMAP_CLASS  (system_rev & 0xff)
87
88 #define IS_OMAP_CLASS(class, id)                        \
89 static inline int is_omap ##class (void)                \
90 {                                                       \
91         return (GET_OMAP_CLASS == (id)) ? 1 : 0;        \
92 }
93
94 IS_OMAP_CLASS(7xx, 0x07)
95 IS_OMAP_CLASS(15xx, 0x15)
96 IS_OMAP_CLASS(16xx, 0x16)
97 IS_OMAP_CLASS(24xx, 0x24)
98
99 #define cpu_is_omap7xx()                0
100 #define cpu_is_omap15xx()               0
101 #define cpu_is_omap16xx()               0
102 #define cpu_is_omap24xx()               0
103
104 #if defined(MULTI_OMAP1)
105 #  if defined(CONFIG_ARCH_OMAP730)
106 #   undef  cpu_is_omap7xx
107 #   define cpu_is_omap7xx()             is_omap7xx()
108 #  endif
109 #  if defined(CONFIG_ARCH_OMAP1510)
110 #   undef  cpu_is_omap15xx
111 #   define cpu_is_omap15xx()            is_omap15xx()
112 #  endif
113 #  if defined(CONFIG_ARCH_OMAP16XX)
114 #   undef  cpu_is_omap16xx
115 #   define cpu_is_omap16xx()            is_omap16xx()
116 #  endif
117 # endif
118 #else
119 # if defined(CONFIG_ARCH_OMAP730)
120 #  undef  cpu_is_omap7xx
121 #  define cpu_is_omap7xx()              1
122 # endif
123 # if defined(CONFIG_ARCH_OMAP1510)
124 #  undef  cpu_is_omap15xx
125 #  define cpu_is_omap15xx()             1
126 # endif
127 # if defined(CONFIG_ARCH_OMAP16XX)
128 #  undef  cpu_is_omap16xx()
129 #  define cpu_is_omap16xx()             1
130 # endif
131 # if defined(CONFIG_ARCH_OMAP24XX)
132 #  undef  cpu_is_omap24xx
133 #  define cpu_is_omap24xx()             1
134 # endif
135 #endif
136
137 /*
138  * Macros to detect individual cpu types.
139  * These are only rarely needed.
140  * cpu_is_omap730():    True for OMAP730
141  * cpu_is_omap1510():   True for OMAP1510
142  * cpu_is_omap1610():   True for OMAP1610
143  * cpu_is_omap5912():   True for OMAP5912
144  * cpu_is_omap1710():   True for OMAP1710
145  * cpu_is_omap2420():   True for OMAP2420
146  */
147 #define GET_OMAP_TYPE   ((system_rev >> 24) & 0xff)
148
149 #define IS_OMAP_TYPE(type, id)                          \
150 static inline int is_omap ##type (void)                 \
151 {                                                       \
152         return (GET_OMAP_TYPE == (id)) ? 1 : 0;         \
153 }
154
155 IS_OMAP_TYPE(730, 0x07)
156 IS_OMAP_TYPE(1510, 0x15)
157 IS_OMAP_TYPE(1610, 0x16)
158 IS_OMAP_TYPE(5912, 0x16)
159 IS_OMAP_TYPE(1710, 0x17)
160 IS_OMAP_TYPE(2420, 0x24)
161
162 #define cpu_is_omap730()                0
163 #define cpu_is_omap1510()               0
164 #define cpu_is_omap1610()               0
165 #define cpu_is_omap5912()               0
166 #define cpu_is_omap1710()               0
167 #define cpu_is_omap2420()               0
168
169 #if defined(MULTI_OMAP1)
170 # if defined(CONFIG_ARCH_OMAP730)
171 #  undef  cpu_is_omap730
172 #  define cpu_is_omap730()              is_omap730()
173 # endif
174 # if defined(CONFIG_ARCH_OMAP1510)
175 #  undef  cpu_is_omap1510
176 #  define cpu_is_omap1510()             is_omap1510()
177 # endif
178 #else
179 # if defined(CONFIG_ARCH_OMAP730)
180 #  undef  cpu_is_omap730
181 #  define cpu_is_omap730()              1
182 # endif
183 # if defined(CONFIG_ARCH_OMAP1510)
184 #  undef  cpu_is_omap1510
185 #  define cpu_is_omap1510()             1
186 # endif
187 #endif
188
189 /*
190  * Whether we have MULTI_OMAP1 or not, we still need to distinguish
191  * between 1611B/5912 and 1710.
192  */
193 #if defined(CONFIG_ARCH_OMAP16XX)
194 # undef  cpu_is_omap1610
195 # undef  cpu_is_omap5912
196 # undef  cpu_is_omap1710
197 # define cpu_is_omap1610()              is_omap1610()
198 # define cpu_is_omap5912()              is_omap5912()
199 # define cpu_is_omap1710()              is_omap1710()
200 #endif
201
202 # if defined(CONFIG_ARCH_OMAP2420)
203 #  undef  cpu_is_omap2420
204 #  define cpu_is_omap2420()             1
205 # endif
206 #endif
207
208 #endif