Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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
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 */
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) \
89static inline int is_omap ##class (void) \
90{ \
91 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
92}
93
94IS_OMAP_CLASS(7xx, 0x07)
95IS_OMAP_CLASS(15xx, 0x15)
96IS_OMAP_CLASS(16xx, 0x16)
97IS_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#else
118# if defined(CONFIG_ARCH_OMAP730)
119# undef cpu_is_omap7xx
120# define cpu_is_omap7xx() 1
121# endif
122# if defined(CONFIG_ARCH_OMAP1510)
123# undef cpu_is_omap15xx
124# define cpu_is_omap15xx() 1
125# endif
126# if defined(CONFIG_ARCH_OMAP16XX)
127# undef cpu_is_omap16xx
128# define cpu_is_omap16xx() 1
129# endif
130# if defined(CONFIG_ARCH_OMAP24XX)
131# undef cpu_is_omap24xx
132# define cpu_is_omap24xx() 1
133# endif
134#endif
135
136/*
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)
175# if defined(CONFIG_ARCH_OMAP730)
176# undef cpu_is_omap730
177# define cpu_is_omap730() is_omap730()
178# endif
179# if defined(CONFIG_ARCH_OMAP1510)
180# 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
190# define cpu_is_omap1510() 1
191# endif
192#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
204# define cpu_is_omap1610() is_omap1610()
205# define cpu_is_omap1611() is_omap1611()
206# define cpu_is_omap5912() is_omap5912()
207# define cpu_is_omap1621() is_omap1621()
208# define cpu_is_omap1710() is_omap1710()
209#endif
210
211#if defined(CONFIG_ARCH_OMAP2420)
212# undef cpu_is_omap2420
213# define cpu_is_omap2420() 1
214#endif
215
216#endif