Merge branch 'master' of /home/stefan/git/u-boot/u-boot into next
[platform/kernel/u-boot.git] / include / asm-ppc / ppc4xx-uic.h
1 /*
2  *  Copyright (C) 2002 Scott McNutt <smcnutt@artesyncp.com>
3  *
4  * (C) Copyright 2008
5  * Stefan Roese, DENX Software Engineering, sr@denx.de.
6  *
7  * See file CREDITS for list of people who contributed to this
8  * project.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License as
12  * published by the Free Software Foundation; either version 2 of
13  * the License, or (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,
23  * MA 02111-1307 USA
24  */
25
26 #ifndef _PPC4xx_UIC_H_
27 #define _PPC4xx_UIC_H_
28
29 /*
30  * Define the number of UIC's
31  */
32 #if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
33     defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
34     defined(CONFIG_460SX)
35 #define UIC_MAX         4
36 #elif defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
37     defined(CONFIG_405EX)
38 #define UIC_MAX         3
39 #elif defined(CONFIG_440GP) || defined(CONFIG_440SP) || \
40     defined(CONFIG_440EP) || defined(CONFIG_440GR)
41 #define UIC_MAX         2
42 #else
43 #define UIC_MAX         1
44 #endif
45
46 /*
47  * UIC register
48  */
49 #define UIC_SR  0x0                     /* UIC status                   */
50 #define UIC_ER  0x2                     /* UIC enable                   */
51 #define UIC_CR  0x3                     /* UIC critical                 */
52 #define UIC_PR  0x4                     /* UIC polarity                 */
53 #define UIC_TR  0x5                     /* UIC triggering               */
54 #define UIC_MSR 0x6                     /* UIC masked status            */
55 #define UIC_VR  0x7                     /* UIC vector                   */
56 #define UIC_VCR 0x8                     /* UIC vector configuration     */
57
58 /*
59  * On 440GX we use the UICB0 as UIC0. Its the root UIC where all other UIC's
60  * are cascaded on. With this trick we can use the common UIC code for 440GX
61  * too.
62  */
63 #if defined(CONFIG_440GX)
64 #define UIC0_DCR_BASE 0x200
65 #define UIC1_DCR_BASE 0xc0
66 #define UIC2_DCR_BASE 0xd0
67 #define UIC3_DCR_BASE 0x210
68 #else
69 #define UIC0_DCR_BASE 0xc0
70 #define UIC1_DCR_BASE 0xd0
71 #define UIC2_DCR_BASE 0xe0
72 #define UIC3_DCR_BASE 0xf0
73 #endif
74
75 #define uic0sr  (UIC0_DCR_BASE+0x0)     /* UIC0 status                  */
76 #define uic0er  (UIC0_DCR_BASE+0x2)     /* UIC0 enable                  */
77 #define uic0cr  (UIC0_DCR_BASE+0x3)     /* UIC0 critical                */
78 #define uic0pr  (UIC0_DCR_BASE+0x4)     /* UIC0 polarity                */
79 #define uic0tr  (UIC0_DCR_BASE+0x5)     /* UIC0 triggering              */
80 #define uic0msr (UIC0_DCR_BASE+0x6)     /* UIC0 masked status           */
81 #define uic0vr  (UIC0_DCR_BASE+0x7)     /* UIC0 vector                  */
82 #define uic0vcr (UIC0_DCR_BASE+0x8)     /* UIC0 vector configuration    */
83
84 #define uic1sr  (UIC1_DCR_BASE+0x0)     /* UIC1 status                  */
85 #define uic1er  (UIC1_DCR_BASE+0x2)     /* UIC1 enable                  */
86 #define uic1cr  (UIC1_DCR_BASE+0x3)     /* UIC1 critical                */
87 #define uic1pr  (UIC1_DCR_BASE+0x4)     /* UIC1 polarity                */
88 #define uic1tr  (UIC1_DCR_BASE+0x5)     /* UIC1 triggering              */
89 #define uic1msr (UIC1_DCR_BASE+0x6)     /* UIC1 masked status           */
90 #define uic1vr  (UIC1_DCR_BASE+0x7)     /* UIC1 vector                  */
91 #define uic1vcr (UIC1_DCR_BASE+0x8)     /* UIC1 vector configuration    */
92
93 #define uic2sr  (UIC2_DCR_BASE+0x0)     /* UIC2 status-Read Clear       */
94 #define uic2srs (UIC2_DCR_BASE+0x1)     /* UIC2 status-Read Set         */
95 #define uic2er  (UIC2_DCR_BASE+0x2)     /* UIC2 enable                  */
96 #define uic2cr  (UIC2_DCR_BASE+0x3)     /* UIC2 critical                */
97 #define uic2pr  (UIC2_DCR_BASE+0x4)     /* UIC2 polarity                */
98 #define uic2tr  (UIC2_DCR_BASE+0x5)     /* UIC2 triggering              */
99 #define uic2msr (UIC2_DCR_BASE+0x6)     /* UIC2 masked status           */
100 #define uic2vr  (UIC2_DCR_BASE+0x7)     /* UIC2 vector                  */
101 #define uic2vcr (UIC2_DCR_BASE+0x8)     /* UIC2 vector configuration    */
102
103 #define uic3sr  (UIC3_DCR_BASE+0x0)     /* UIC3 status-Read Clear       */
104 #define uic3srs (UIC3_DCR_BASE+0x1)     /* UIC3 status-Read Set         */
105 #define uic3er  (UIC3_DCR_BASE+0x2)     /* UIC3 enable                  */
106 #define uic3cr  (UIC3_DCR_BASE+0x3)     /* UIC3 critical                */
107 #define uic3pr  (UIC3_DCR_BASE+0x4)     /* UIC3 polarity                */
108 #define uic3tr  (UIC3_DCR_BASE+0x5)     /* UIC3 triggering              */
109 #define uic3msr (UIC3_DCR_BASE+0x6)     /* UIC3 masked status           */
110 #define uic3vr  (UIC3_DCR_BASE+0x7)     /* UIC3 vector                  */
111 #define uic3vcr (UIC3_DCR_BASE+0x8)     /* UIC3 vector configuration    */
112
113 /* The following is for compatibility with 405 code */
114 #define uicsr   uic0sr
115 #define uicer   uic0er
116 #define uiccr   uic0cr
117 #define uicpr   uic0pr
118 #define uictr   uic0tr
119 #define uicmsr  uic0msr
120 #define uicvr   uic0vr
121 #define uicvcr  uic0vcr
122
123 /*
124  * Now the interrupt vector definitions. They are different for most of
125  * the 4xx variants, so we need some more #ifdef's here. No mask
126  * definitions anymore here. For this please use the UIC_MASK macro below.
127  *
128  * Note: Please only define the interrupts really used in U-Boot here.
129  * Those are the cascading and EMAC/MAL related interrupt.
130  */
131
132 #if defined(CONFIG_405EP) || defined(CONFIG_405GP)
133 #define VECNUM_MAL_SERR         10
134 #define VECNUM_MAL_TXEOB        11
135 #define VECNUM_MAL_RXEOB        12
136 #define VECNUM_MAL_TXDE         13
137 #define VECNUM_MAL_RXDE         14
138 #define VECNUM_ETH0             15
139 #define VECNUM_ETH1_OFFS        2
140 #define VECNUM_EIRQ6            29
141 #endif /* defined(CONFIG_405EP) */
142
143 #if defined(CONFIG_405EZ)
144 #define VECNUM_USBDEV           15
145 #define VECNUM_ETH0             16
146 #define VECNUM_MAL_SERR         18
147 #define VECNUM_MAL_TXDE         18
148 #define VECNUM_MAL_RXDE         18
149 #define VECNUM_MAL_TXEOB        19
150 #define VECNUM_MAL_RXEOB        21
151 #endif /* CONFIG_405EX */
152
153 #if defined(CONFIG_405EX)
154 /* UIC 0 */
155 #define VECNUM_MAL_TXEOB        10
156 #define VECNUM_MAL_RXEOB        11
157 #define VECNUM_ETH0             24
158 #define VECNUM_ETH1_OFFS        1
159 #define VECNUM_UIC2NCI          28
160 #define VECNUM_UIC2CI           29
161 #define VECNUM_UIC1NCI          30
162 #define VECNUM_UIC1CI           31
163
164 /* UIC 1 */
165 #define VECNUM_MAL_SERR         (32 + 0)
166 #define VECNUM_MAL_TXDE         (32 + 1)
167 #define VECNUM_MAL_RXDE         (32 + 2)
168 #endif /* CONFIG_405EX */
169
170 #if defined(CONFIG_440GP) || \
171     defined(CONFIG_440EP) || defined(CONFIG_440GR)
172 /* UIC 0 */
173 #define VECNUM_MAL_TXEOB        10
174 #define VECNUM_MAL_RXEOB        11
175 #define VECNUM_UIC1NCI          30
176 #define VECNUM_UIC1CI           31
177
178 /* UIC 1 */
179 #define VECNUM_MAL_SERR         (32 + 0)
180 #define VECNUM_MAL_TXDE         (32 + 1)
181 #define VECNUM_MAL_RXDE         (32 + 2)
182 #define VECNUM_USBDEV           (32 + 23)
183 #define VECNUM_ETH0             (32 + 28)
184 #define VECNUM_ETH1_OFFS        2
185 #endif /* CONFIG_440GP */
186
187 #if defined(CONFIG_440GX)
188 /* UICB 0 (440GX only) */
189 /*
190  * All those defines below are off-by-one, so that the common UIC code
191  * can be used. So VECNUM_UIC1CI refers to VECNUM_UIC0CI etc.
192  */
193 #define VECNUM_UIC1CI           0
194 #define VECNUM_UIC1NCI          1
195 #define VECNUM_UIC2CI           2
196 #define VECNUM_UIC2NCI          3
197 #define VECNUM_UIC3CI           4
198 #define VECNUM_UIC3NCI          5
199
200 /* UIC 0, used as UIC1 on 440GX because of UICB0 */
201 #define VECNUM_MAL_TXEOB        (32 + 10)
202 #define VECNUM_MAL_RXEOB        (32 + 11)
203
204 /* UIC 1, used as UIC2 on 440GX because of UICB0 */
205 #define VECNUM_MAL_SERR         (64 + 0)
206 #define VECNUM_MAL_TXDE         (64 + 1)
207 #define VECNUM_MAL_RXDE         (64 + 2)
208 #define VECNUM_ETH0             (64 + 28)
209 #define VECNUM_ETH1_OFFS        2
210 #endif /* CONFIG_440GX */
211
212 #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
213 /* UIC 0 */
214 #define VECNUM_MAL_TXEOB        10
215 #define VECNUM_MAL_RXEOB        11
216 #define VECNUM_USBDEV           20
217 #define VECNUM_ETH0             24
218 #define VECNUM_ETH1_OFFS        1
219 #define VECNUM_UIC2NCI          28
220 #define VECNUM_UIC2CI           29
221 #define VECNUM_UIC1NCI          30
222 #define VECNUM_UIC1CI           31
223
224 /* UIC 1 */
225 #define VECNUM_MAL_SERR         (32 + 0)
226 #define VECNUM_MAL_TXDE         (32 + 1)
227 #define VECNUM_MAL_RXDE         (32 + 2)
228
229 /* UIC 2 */
230 #define VECNUM_EIRQ2            (64 + 3)
231 #endif /* CONFIG_440EPX */
232
233 #if defined(CONFIG_440SP)
234 /* UIC 0 */
235 #define VECNUM_UIC1NCI          30
236 #define VECNUM_UIC1CI           31
237
238 /* UIC 1 */
239 #define VECNUM_MAL_SERR         (32 + 1)
240 #define VECNUM_MAL_TXDE         (32 + 2)
241 #define VECNUM_MAL_RXDE         (32 + 3)
242 #define VECNUM_MAL_TXEOB        (32 + 6)
243 #define VECNUM_MAL_RXEOB        (32 + 7)
244 #define VECNUM_ETH0             (32 + 28)
245 #endif /* CONFIG_440SP */
246
247 #if defined(CONFIG_440SPE)
248 /* UIC 0 */
249 #define VECNUM_UIC2NCI          10
250 #define VECNUM_UIC2CI           11
251 #define VECNUM_UIC3NCI          16
252 #define VECNUM_UIC3CI           17
253 #define VECNUM_UIC1NCI          30
254 #define VECNUM_UIC1CI           31
255
256 /* UIC 1 */
257 #define VECNUM_MAL_SERR         (32 + 1)
258 #define VECNUM_MAL_TXDE         (32 + 2)
259 #define VECNUM_MAL_RXDE         (32 + 3)
260 #define VECNUM_MAL_TXEOB        (32 + 6)
261 #define VECNUM_MAL_RXEOB        (32 + 7)
262 #define VECNUM_ETH0             (32 + 28)
263 #endif /* CONFIG_440SPE */
264
265 #if defined(CONFIG_460EX) || defined(CONFIG_460GT)
266 /* UIC 0 */
267 #define VECNUM_UIC2NCI          10
268 #define VECNUM_UIC2CI           11
269 #define VECNUM_UIC3NCI          16
270 #define VECNUM_UIC3CI           17
271 #define VECNUM_UIC1NCI          30
272 #define VECNUM_UIC1CI           31
273
274 /* UIC 2 */
275 #define VECNUM_MAL_SERR         (64 + 3)
276 #define VECNUM_MAL_TXDE         (64 + 4)
277 #define VECNUM_MAL_RXDE         (64 + 5)
278 #define VECNUM_MAL_TXEOB        (64 + 6)
279 #define VECNUM_MAL_RXEOB        (64 + 7)
280 #define VECNUM_ETH0             (64 + 16)
281 #define VECNUM_ETH1_OFFS        1
282 #endif /* CONFIG_460EX */
283
284 #if defined(CONFIG_460SX)
285 /* UIC 0 */
286 #define VECNUM_UIC2NCI          10
287 #define VECNUM_UIC2CI           11
288 #define VECNUM_UIC3NCI          16
289 #define VECNUM_UIC3CI           17
290 #define VECNUM_ETH0             19
291 #define VECNUM_ETH1_OFFS        1
292 #define VECNUM_UIC1NCI          30
293 #define VECNUM_UIC1CI           31
294
295 /* UIC 1 */
296 #define VECNUM_MAL_SERR         (32 + 1)
297 #define VECNUM_MAL_TXDE         (32 + 2)
298 #define VECNUM_MAL_RXDE         (32 + 3)
299 #define VECNUM_MAL_TXEOB        (32 + 6)
300 #define VECNUM_MAL_RXEOB        (32 + 7)
301 #endif /* CONFIG_460EX */
302
303 #if !defined(VECNUM_ETH1_OFFS)
304 #define VECNUM_ETH1_OFFS        1
305 #endif
306
307 /*
308  * Mask definitions (used for example in 4xx_enet.c)
309  */
310 #define UIC_MASK(vec)           (0x80000000 >> ((vec) & 0x1f))
311 /* UIC_NR won't work for 440GX because of its specific UIC DCR addresses */
312 #define UIC_NR(vec)             ((vec) >> 5)
313
314 #endif /* _PPC4xx_UIC_H_ */