blob: 1119e2b53e724fb9773c35dcaf793cc7b7df62e0 [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
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 */
Tony Lindgren9839c6b2005-09-07 17:20:27 +010041#undef MULTI_OMAP1
42#undef MULTI_OMAP2
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#undef OMAP_NAME
44
45#ifdef CONFIG_ARCH_OMAP730
46# ifdef OMAP_NAME
Tony Lindgren9839c6b2005-09-07 17:20:27 +010047# undef MULTI_OMAP1
48# define MULTI_OMAP1
Linus Torvalds1da177e2005-04-16 15:20:36 -070049# else
50# define OMAP_NAME omap730
51# endif
52#endif
53#ifdef CONFIG_ARCH_OMAP1510
54# ifdef OMAP_NAME
Tony Lindgren9839c6b2005-09-07 17:20:27 +010055# undef MULTI_OMAP1
56# define MULTI_OMAP1
Linus Torvalds1da177e2005-04-16 15:20:36 -070057# else
58# define OMAP_NAME omap1510
59# endif
60#endif
61#ifdef CONFIG_ARCH_OMAP16XX
62# ifdef OMAP_NAME
Tony Lindgren9839c6b2005-09-07 17:20:27 +010063# undef MULTI_OMAP1
64# define MULTI_OMAP1
Linus Torvalds1da177e2005-04-16 15:20:36 -070065# else
Tony Lindgren9839c6b2005-09-07 17:20:27 +010066# define OMAP_NAME omap16xx
Linus Torvalds1da177e2005-04-16 15:20:36 -070067# endif
68#endif
Tony Lindgren9839c6b2005-09-07 17:20:27 +010069#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"
Linus Torvalds1da177e2005-04-16 15:20:36 -070072# else
Tony Lindgren9839c6b2005-09-07 17:20:27 +010073# undef MULTI_OMAP2
74# define OMAP_NAME omap24xx
Linus Torvalds1da177e2005-04-16 15:20:36 -070075# endif
76#endif
77
78/*
Tony Lindgren9839c6b2005-09-07 17:20:27 +010079 * 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070086#define GET_OMAP_CLASS (system_rev & 0xff)
87
Linus Torvalds1da177e2005-04-16 15:20:36 -070088#define IS_OMAP_CLASS(class, id) \
89static inline int is_omap ##class (void) \
90{ \
91 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
92}
93
Linus Torvalds1da177e2005-04-16 15:20:36 -070094IS_OMAP_CLASS(7xx, 0x07)
95IS_OMAP_CLASS(15xx, 0x15)
96IS_OMAP_CLASS(16xx, 0x16)
97IS_OMAP_CLASS(24xx, 0x24)
98
Tony Lindgren9839c6b2005-09-07 17:20:27 +010099#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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115# define cpu_is_omap16xx() is_omap16xx()
116# endif
117#else
118# if defined(CONFIG_ARCH_OMAP730)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100119# undef cpu_is_omap7xx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120# define cpu_is_omap7xx() 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121# endif
122# if defined(CONFIG_ARCH_OMAP1510)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100123# undef cpu_is_omap15xx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124# define cpu_is_omap15xx() 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125# endif
126# if defined(CONFIG_ARCH_OMAP16XX)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100127# undef cpu_is_omap16xx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128# define cpu_is_omap16xx() 1
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100129# endif
130# if defined(CONFIG_ARCH_OMAP24XX)
131# undef cpu_is_omap24xx
132# define cpu_is_omap24xx() 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133# endif
134#endif
135
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100136/*
137 * Macros to detect individual cpu types.
138 * These are only rarely needed.
139 * cpu_is_omap730(): True for OMAP730
140 * cpu_is_omap1510(): True for OMAP1510
141 * cpu_is_omap1610(): True for OMAP1610
142 * cpu_is_omap1611(): True for OMAP1611
143 * cpu_is_omap5912(): True for OMAP5912
144 * cpu_is_omap1621(): True for OMAP1621
145 * cpu_is_omap1710(): True for OMAP1710
146 * cpu_is_omap2420(): True for OMAP2420
147 */
148#define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff)
149
150#define IS_OMAP_TYPE(type, id) \
151static inline int is_omap ##type (void) \
152{ \
153 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
154}
155
156IS_OMAP_TYPE(730, 0x0730)
157IS_OMAP_TYPE(1510, 0x1510)
158IS_OMAP_TYPE(1610, 0x1610)
159IS_OMAP_TYPE(1611, 0x1611)
160IS_OMAP_TYPE(5912, 0x1611)
161IS_OMAP_TYPE(1621, 0x1621)
162IS_OMAP_TYPE(1710, 0x1710)
163IS_OMAP_TYPE(2420, 0x2420)
164
165#define cpu_is_omap730() 0
166#define cpu_is_omap1510() 0
167#define cpu_is_omap1610() 0
168#define cpu_is_omap5912() 0
169#define cpu_is_omap1611() 0
170#define cpu_is_omap1621() 0
171#define cpu_is_omap1710() 0
172#define cpu_is_omap2420() 0
173
174#if defined(MULTI_OMAP1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175# if defined(CONFIG_ARCH_OMAP730)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100176# undef cpu_is_omap730
177# define cpu_is_omap730() is_omap730()
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178# endif
179# if defined(CONFIG_ARCH_OMAP1510)
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100180# undef cpu_is_omap1510
181# define cpu_is_omap1510() is_omap1510()
182# endif
183#else
184# if defined(CONFIG_ARCH_OMAP730)
185# undef cpu_is_omap730
186# define cpu_is_omap730() 1
187# endif
188# if defined(CONFIG_ARCH_OMAP1510)
189# undef cpu_is_omap1510
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190# define cpu_is_omap1510() 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191# endif
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100192#endif
193
194/*
195 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
196 * between 1611B/5912 and 1710.
197 */
198#if defined(CONFIG_ARCH_OMAP16XX)
199# undef cpu_is_omap1610
200# undef cpu_is_omap1611
201# undef cpu_is_omap5912
202# undef cpu_is_omap1621
203# undef cpu_is_omap1710
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204# define cpu_is_omap1610() is_omap1610()
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100205# define cpu_is_omap1611() is_omap1611()
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206# define cpu_is_omap5912() is_omap5912()
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100207# define cpu_is_omap1621() is_omap1621()
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208# define cpu_is_omap1710() is_omap1710()
Tony Lindgren9839c6b2005-09-07 17:20:27 +0100209#endif
210
211#if defined(CONFIG_ARCH_OMAP2420)
212# undef cpu_is_omap2420
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213# define cpu_is_omap2420() 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214#endif
215
216#endif