blob: ec7eb675d9227fea8bb308873d25bda8d4a9ade7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
29extern unsigned int system_rev;
30
Tony Lindgren9ad58972005-11-10 14:26:53 +000031#define omap2_cpu_rev() ((system_rev >> 8) & 0x0f)
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
33/*
34 * Test if multicore OMAP support is needed
35 */
Tony Lindgren9839c6b2005-09-07 17:20:27 +010036#undef MULTI_OMAP1
37#undef MULTI_OMAP2
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#undef OMAP_NAME
39
40#ifdef CONFIG_ARCH_OMAP730
41# ifdef OMAP_NAME
Tony Lindgren9839c6b2005-09-07 17:20:27 +010042# undef MULTI_OMAP1
43# define MULTI_OMAP1
Linus Torvalds1da177e2005-04-16 15:20:36 -070044# else
45# define OMAP_NAME omap730
46# endif
47#endif
Tony Lindgren9ad58972005-11-10 14:26:53 +000048#ifdef CONFIG_ARCH_OMAP15XX
Linus Torvalds1da177e2005-04-16 15:20:36 -070049# ifdef OMAP_NAME
Tony Lindgren9839c6b2005-09-07 17:20:27 +010050# undef MULTI_OMAP1
51# define MULTI_OMAP1
Linus Torvalds1da177e2005-04-16 15:20:36 -070052# else
53# define OMAP_NAME omap1510
54# endif
55#endif
56#ifdef CONFIG_ARCH_OMAP16XX
57# ifdef OMAP_NAME
Tony Lindgren9839c6b2005-09-07 17:20:27 +010058# undef MULTI_OMAP1
59# define MULTI_OMAP1
Linus Torvalds1da177e2005-04-16 15:20:36 -070060# else
Tony Lindgren9839c6b2005-09-07 17:20:27 +010061# define OMAP_NAME omap16xx
Linus Torvalds1da177e2005-04-16 15:20:36 -070062# endif
63#endif
Tony Lindgren9839c6b2005-09-07 17:20:27 +010064#ifdef CONFIG_ARCH_OMAP24XX
65# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
66# error "OMAP1 and OMAP2 can't be selected at the same time"
Linus Torvalds1da177e2005-04-16 15:20:36 -070067# else
Tony Lindgren9839c6b2005-09-07 17:20:27 +010068# undef MULTI_OMAP2
69# define OMAP_NAME omap24xx
Linus Torvalds1da177e2005-04-16 15:20:36 -070070# endif
71#endif
72
73/*
Tony Lindgren9839c6b2005-09-07 17:20:27 +010074 * Macros to group OMAP into cpu classes.
75 * These can be used in most places.
76 * cpu_is_omap7xx(): True for OMAP730
Tony Lindgren9ad58972005-11-10 14:26:53 +000077 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
Tony Lindgren9839c6b2005-09-07 17:20:27 +010078 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
Tony Lindgren9ad58972005-11-10 14:26:53 +000079 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
80 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
81 * cpu_is_omap243x(): True for OMAP2430
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#define GET_OMAP_CLASS (system_rev & 0xff)
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085#define IS_OMAP_CLASS(class, id) \
86static inline int is_omap ##class (void) \
87{ \
88 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
89}
90
Tony Lindgren9ad58972005-11-10 14:26:53 +000091#define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff)
92
93#define IS_OMAP_SUBCLASS(subclass, id) \
94static inline int is_omap ##subclass (void) \
95{ \
96 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
97}
98
Linus Torvalds1da177e2005-04-16 15:20:36 -070099IS_OMAP_CLASS(7xx, 0x07)
100IS_OMAP_CLASS(15xx, 0x15)
101IS_OMAP_CLASS(16xx, 0x16)
102IS_OMAP_CLASS(24xx, 0x24)
103
Tony Lindgren9ad58972005-11-10 14:26:53 +0000104IS_OMAP_SUBCLASS(242x, 0x242)
105IS_OMAP_SUBCLASS(243x, 0x243)
106
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100107#define cpu_is_omap7xx() 0
108#define cpu_is_omap15xx() 0
109#define cpu_is_omap16xx() 0
110#define cpu_is_omap24xx() 0
Tony Lindgren9ad58972005-11-10 14:26:53 +0000111#define cpu_is_omap242x() 0
112#define cpu_is_omap243x() 0
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100113
114#if defined(MULTI_OMAP1)
115# if defined(CONFIG_ARCH_OMAP730)
116# undef cpu_is_omap7xx
117# define cpu_is_omap7xx() is_omap7xx()
118# endif
Tony Lindgren9ad58972005-11-10 14:26:53 +0000119# if defined(CONFIG_ARCH_OMAP15XX)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100120# undef cpu_is_omap15xx
121# define cpu_is_omap15xx() is_omap15xx()
122# endif
123# if defined(CONFIG_ARCH_OMAP16XX)
124# undef cpu_is_omap16xx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125# define cpu_is_omap16xx() is_omap16xx()
126# endif
127#else
128# if defined(CONFIG_ARCH_OMAP730)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100129# undef cpu_is_omap7xx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130# define cpu_is_omap7xx() 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131# endif
Tony Lindgren9ad58972005-11-10 14:26:53 +0000132# if defined(CONFIG_ARCH_OMAP15XX)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100133# undef cpu_is_omap15xx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134# define cpu_is_omap15xx() 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135# endif
136# if defined(CONFIG_ARCH_OMAP16XX)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100137# undef cpu_is_omap16xx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138# define cpu_is_omap16xx() 1
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100139# endif
140# if defined(CONFIG_ARCH_OMAP24XX)
141# undef cpu_is_omap24xx
Tony Lindgren9ad58972005-11-10 14:26:53 +0000142# undef cpu_is_omap242x
143# undef cpu_is_omap243x
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100144# define cpu_is_omap24xx() 1
Tony Lindgren9ad58972005-11-10 14:26:53 +0000145# define cpu_is_omap242x() is_omap242x()
146# define cpu_is_omap243x() is_omap243x()
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147# endif
148#endif
149
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100150/*
151 * Macros to detect individual cpu types.
152 * These are only rarely needed.
Tony Lindgren9ad58972005-11-10 14:26:53 +0000153 * cpu_is_omap330(): True for OMAP330
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100154 * cpu_is_omap730(): True for OMAP730
155 * cpu_is_omap1510(): True for OMAP1510
156 * cpu_is_omap1610(): True for OMAP1610
157 * cpu_is_omap1611(): True for OMAP1611
158 * cpu_is_omap5912(): True for OMAP5912
159 * cpu_is_omap1621(): True for OMAP1621
160 * cpu_is_omap1710(): True for OMAP1710
161 * cpu_is_omap2420(): True for OMAP2420
Tony Lindgren9ad58972005-11-10 14:26:53 +0000162 * cpu_is_omap2422(): True for OMAP2422
163 * cpu_is_omap2423(): True for OMAP2423
164 * cpu_is_omap2430(): True for OMAP2430
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100165 */
166#define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff)
167
168#define IS_OMAP_TYPE(type, id) \
169static inline int is_omap ##type (void) \
170{ \
171 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
172}
173
Tony Lindgren9ad58972005-11-10 14:26:53 +0000174IS_OMAP_TYPE(310, 0x0310)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100175IS_OMAP_TYPE(730, 0x0730)
176IS_OMAP_TYPE(1510, 0x1510)
177IS_OMAP_TYPE(1610, 0x1610)
178IS_OMAP_TYPE(1611, 0x1611)
179IS_OMAP_TYPE(5912, 0x1611)
180IS_OMAP_TYPE(1621, 0x1621)
181IS_OMAP_TYPE(1710, 0x1710)
182IS_OMAP_TYPE(2420, 0x2420)
Tony Lindgren9ad58972005-11-10 14:26:53 +0000183IS_OMAP_TYPE(2422, 0x2422)
184IS_OMAP_TYPE(2423, 0x2423)
185IS_OMAP_TYPE(2430, 0x2430)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100186
Tony Lindgren9ad58972005-11-10 14:26:53 +0000187#define cpu_is_omap310() 0
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100188#define cpu_is_omap730() 0
189#define cpu_is_omap1510() 0
190#define cpu_is_omap1610() 0
191#define cpu_is_omap5912() 0
192#define cpu_is_omap1611() 0
193#define cpu_is_omap1621() 0
194#define cpu_is_omap1710() 0
195#define cpu_is_omap2420() 0
Tony Lindgren9ad58972005-11-10 14:26:53 +0000196#define cpu_is_omap2422() 0
197#define cpu_is_omap2423() 0
198#define cpu_is_omap2430() 0
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100199
200#if defined(MULTI_OMAP1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201# if defined(CONFIG_ARCH_OMAP730)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100202# undef cpu_is_omap730
203# define cpu_is_omap730() is_omap730()
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204# endif
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100205#else
206# if defined(CONFIG_ARCH_OMAP730)
207# undef cpu_is_omap730
208# define cpu_is_omap730() 1
209# endif
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100210#endif
211
212/*
213 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
Tony Lindgren9ad58972005-11-10 14:26:53 +0000214 * between 330 vs. 1510 and 1611B/5912 vs. 1710.
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100215 */
Tony Lindgren9ad58972005-11-10 14:26:53 +0000216#if defined(CONFIG_ARCH_OMAP15XX)
217# undef cpu_is_omap310
218# undef cpu_is_omap1510
219# define cpu_is_omap310() is_omap310()
220# define cpu_is_omap1510() is_omap1510()
221#endif
222
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100223#if defined(CONFIG_ARCH_OMAP16XX)
224# undef cpu_is_omap1610
225# undef cpu_is_omap1611
226# undef cpu_is_omap5912
227# undef cpu_is_omap1621
228# undef cpu_is_omap1710
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229# define cpu_is_omap1610() is_omap1610()
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100230# define cpu_is_omap1611() is_omap1611()
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231# define cpu_is_omap5912() is_omap5912()
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100232# define cpu_is_omap1621() is_omap1621()
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233# define cpu_is_omap1710() is_omap1710()
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100234#endif
235
Tony Lindgren9ad58972005-11-10 14:26:53 +0000236#if defined(CONFIG_ARCH_OMAP24XX)
237# undef cpu_is_omap2420
238# undef cpu_is_omap2422
239# undef cpu_is_omap2423
240# undef cpu_is_omap2430
241# define cpu_is_omap2420() is_omap2420()
242# define cpu_is_omap2422() is_omap2422()
243# define cpu_is_omap2423() is_omap2423()
244# define cpu_is_omap2430() is_omap2430()
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245#endif
246
Tony Lindgren9ad58972005-11-10 14:26:53 +0000247/* Macros to detect if we have OMAP1 or OMAP2 */
248#define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \
249 cpu_is_omap16xx())
250#define cpu_class_is_omap2() cpu_is_omap24xx()
251
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252#endif