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