xref: /netbsd/sys/arch/arm/footbridge/dc21285reg.h (revision c4a72b64)
1 /*	$NetBSD: dc21285reg.h,v 1.3 2002/11/03 21:43:30 chris Exp $	*/
2 
3 /*
4  * Copyright (c) 1997,1998 Mark Brinicombe.
5  * Copyright (c) 1997,1998 Causality Limited
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by Mark Brinicombe
19  *	for the NetBSD Project.
20  * 4. The name of the company nor the name of the author may be used to
21  *    endorse or promote products derived from this software without specific
22  *    prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
25  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  */
36 
37 /*
38  * DC21285 register definitions
39  */
40 
41 /* PCI registers in CSR space */
42 
43 #define VENDOR_ID		0x00
44 #define DC21285_VENDOR_ID	0x1011
45 #define DEVICE_ID		0x02
46 #define DC21285_DEVICE_ID	0x1065
47 #define REVISION		0x08
48 #define CLASS			0x0A
49 
50 /* Other PCI control / status registers */
51 
52 #define	OUTBOUND_INT_STATUS	0x030
53 #define	OUTBOUND_INT_MASK	0x034
54 #define	I2O_INBOUND_FIFO	0x040
55 #define I2O_OUTBOUND_FIFO	0x044
56 
57 /* Mailbox registers */
58 
59 #define	MAILBOX_0		0x050
60 #define	MAILBOX_1		0x054
61 #define	MAILBOX_2		0x058
62 #define	MAILBOX_3		0x05C
63 
64 #define	DOORBELL		0x060
65 #define	DOORBELL_SETUP		0x064
66 #define	ROM_WRITE_BYTE_ADDRESS	0x068
67 
68 /* DMA Channel registers */
69 
70 #define	DMA_CHAN_1_BYTE_COUNT	0x80
71 #define	DMA_CHAN_1_PCI_ADDR	0x84
72 #define	DMA_CHAN_1_SDRAM_ADDR	0x88
73 #define	DMA_CHAN_1_DESCRIPT	0x8C
74 #define	DMA_CHAN_1_CONTROL	0x90
75 #define	DMA_CHAN_2_BYTE_COUNT	0xA0
76 #define	DMA_CHAN_2_PCI_ADDR	0xA4
77 #define	DMA_CHAN_2_SDRAM_ADDR	0xA8
78 #define	DMA_CHAN_2_DESCRIPTOR	0xAC
79 #define	DMA_CHAN_2_CONTROL	0xB0
80 
81 /* Offsets into DMA descriptor */
82 
83 #define	DMA_BYTE_COUNT		0
84 #define	DMA_PCI_ADDRESS		4
85 #define	DMA_SDRAM_ADDRESS	8
86 #define	DMA_NEXT_DESCRIPTOR	12
87 
88 /* DMA byte count register bits */
89 
90 #define	DMA_INTERBURST_SHIFT	24
91 #define	DMA_PCI_TO_SDRAM	0
92 #define	DMA_SDRAM_TO_PCI	(1 << 30)
93 #define	DMA_END_CHAIN		(1 << 31)
94 
95 /* DMA control bits */
96 
97 #define	DMA_ENABLE		(1 << 0)
98 #define	DMA_TRANSFER_DONE	(1 << 2)
99 #define	DMA_ERROR		(1 << 3)
100 #define	DMA_REGISTOR_DESCRIPTOR	(1 << 4)
101 #define	DMA_PCI_MEM_READ	(0 << 5)
102 #define	DMA_PCI_MEM_READ_LINE	(1 << 5)
103 #define	DMA_PCI_MEM_READ_MULTI1	(2 << 5)
104 #define	DMA_PCI_MEM_READ_MULTI2	(3 << 5)
105 #define	DMA_CHAIN_DONE		(1 << 7)
106 #define	DMA_INTERBURST_4	(0 << 8)
107 #define	DMA_INTERBURST_8	(1 << 8)
108 #define	DMA_INTERBURST_16	(2 << 8)
109 #define	DMA_INTERBURST_32	(3 << 8)
110 #define	DMA_PCI_LENGTH_8	0
111 #define	DMA_PCI_LENGTH_16	(1 << 15)
112 #define	DMA_SDRAM_LENGTH_1	(0 << 16)
113 #define	DMA_SDRAM_LENGTH_2	(1 << 16)
114 #define	DMA_SDRAM_LENGTH_4	(2 << 16)
115 #define	DMA_SDRAM_LENGTH_8	(3 << 16)
116 #define	DMA_SDRAM_LENGTH_16	(4 << 16)
117 
118 /* CSR Base Address Mask */
119 
120 #define	CSR_BA_MASK		0x0F8
121 #define	CSR_MASK_128B		0x00000000
122 #define	CSR_MASK_512KB		0x00040000
123 #define	CSR_MASK_1MB		0x000C0000
124 #define	CSR_MASK_2MB		0x001C0000
125 #define	CSR_MASK_4MB		0x003C0000
126 #define	CSR_MASK_8MB		0x007C0000
127 #define	CSR_MASK_16MB		0x00FC0000
128 #define	CSR_MASK_32MB		0x01FC0000
129 #define	CSR_MASK_64MB		0x03FC0000
130 #define	CSR_MASK_128MB		0x07FC0000
131 #define	CSR_MASK_256MB		0x0FFC0000
132 #define	CSR_BA_OFFSET		0x0FC
133 
134 /* SDRAM Base Address Mask */
135 
136 #define	SDRAM_BA_MASK		0x100
137 #define	SDRAM_MASK_256KB	0x00000000
138 #define	SDRAM_MASK_512KB	0x00040000
139 #define	SDRAM_MASK_1MB		0x000C0000
140 #define	SDRAM_MASK_2MB		0x001C0000
141 #define	SDRAM_MASK_4MB		0x003C0000
142 #define	SDRAM_MASK_8MB		0x007C0000
143 #define	SDRAM_MASK_16MB		0x00FC0000
144 #define	SDRAM_MASK_32MB		0x01FC0000
145 #define	SDRAM_MASK_64MB		0x03FC0000
146 #define	SDRAM_MASK_128MB	0x07FC0000
147 #define	SDRAM_MASK_256MB	0x0FFC0000
148 #define	SDRAM_WINDOW_DISABLE	(1 << 31)
149 #define	SDRAM_BA_OFFSET		0x104
150 
151 /* Expansion ROM Base Address Mask */
152 
153 #define EXPANSION_ROM_BA_MASK	0x108
154 #define	ROM_MASK_1MB		0x00000000
155 #define	ROM_MASK_2MB		0x00100000
156 #define	ROM_MASK_4MB		0x00300000
157 #define	ROM_MASK_8MB		0x00700000
158 #define	ROM_MASK_16MB		0x00F00000
159 #define	ROM_WINDOW_DISABLE	(1 << 31)
160 
161 /* SDRAM configuration */
162 
163 #define	SDRAM_TIMING		0x10C
164 #define SDRAM_ARRAY_SIZE_0	0x0
165 #define	SDRAM_ARRAY_SIZE_1MB	0x1
166 #define	SDRAM_ARRAY_SIZE_2MB	0x2
167 #define	SDRAM_ARRAY_SIZE_4MB	0x3
168 #define	SDRAM_ARRAY_SIZE_8MB	0x4
169 #define	SDRAM_ARRAY_SIZE_16MB	0x5
170 #define	SDRAM_ARRAY_SIZE_32MB	0x6
171 #define	SDRAM_ARRAY_SIZE_64MB	0x7
172 #define	SDRAM_2_BANKS		0
173 #define	SDRAM_4_BANKS		(1 << 3)
174 #define	SDRAM_ADDRESS_MUX_SHIFT	4
175 #define	SDRAM_ARRAY_BASE_SHIFT	20
176 #define	SDRAM_ADDRESS_SIZE_0	0x110
177 #define	SDRAM_ADDRESS_SIZE_1	0x114
178 #define	SDRAM_ADDRESS_SIZE_2	0x118
179 #define	SDRAM_ADDRESS_SIZE_3	0x11C
180 
181 /* I2O registers */
182 
183 #define	I2O_INBOUND_FREE_HEAD	0x120
184 #define	I2O_INBOUND_POST_TAIL	0x124
185 #define	I2O_OUTBOUND_POST_HEAD	0x128
186 #define I2O_OUTBOUND_FREE_TAIL	0x12c
187 #define	I2O_INBOUND_FREE_COUNT	0x130
188 #define	I2O_OUTBOUND_POST_COUNT	0x134
189 #define	I2O_INBOUND_POST_COUNT	0x138
190 
191 /* Control register */
192 
193 #define	SA_CONTROL		0x13C
194 #define	INITIALIZE_COMPLETE	(1 << 0)
195 #define	ASSERT_SERR		(1 << 1)
196 #define	RECEIVED_SERR		(1 << 3)
197 #define	SA_SDRAM_PARITY_ERROR	(1 << 4)
198 #define	PCI_SDRAM_PARITY_ERROR	(1 << 5)
199 #define	DMA_SDRAM_PARITY_ERROR	(1 << 6)
200 #define	DISCARD_TIMER_EXPIRED	(1 << 8)
201 #define	PCI_NOT_RESET		(1 << 9)
202 #define	WATCHDOG_ENABLE		(1 << 13)
203 #define	I2O_SIZE_256		(0 << 10)
204 #define	I2O_SIZE_512		(1 << 10)
205 #define	I2O_SIZE_1024		(2 << 10)
206 #define	I2O_SIZE_2048		(3 << 10)
207 #define	I2O_SIZE_4096		(4 << 10)
208 #define	I2O_SIZE_8192		(5 << 10)
209 #define	I2O_SIZE_16384		(6 << 10)
210 #define	I2O_SIZE_32768		(7 << 10)
211 #define	ROM_WIDTH_8		(3 << 14)
212 #define	ROM_WIDTH_16		(1 << 14)
213 #define	ROM_WIDTH_32		(2 << 14)
214 #define	ROM_ACCESS_TIME_SHIFT	16
215 #define	ROM_BURST_TIME_SHIFT	20
216 #define	ROM_TRISTATE_TIME_SHIFT	24
217 #define	XCS_DIRECTION_SHIFT	28
218 #define	PCI_CENTRAL_FUNCTION	(1 << 31)
219 
220 #define	PCI_ADDRESS_EXTENSION	0x140
221 #define	PREFETCHABLE_MEM_RANGE	0x144
222 
223 /* XBUS / PCI Arbiter registers */
224 
225 #define	XBUS_CYCLE_ARBITER	0x148
226 #define	XBUS_CYCLE_0_SHIFT	0
227 #define	XBUS_CYCLE_1_SHIFT	3
228 #define	XBUS_CYCLE_2_SHIFT	6
229 #define	XBUS_CYCLE_3_SHIFT	9
230 #define	XBUS_CYCLE_STROBE_SHIFT	12
231 #define	XBUS_PCI_ARBITER	(1 << 23)
232 #define	XBUS_INT_IN_L0_LOW	0
233 #define	XBUS_INT_IN_L0_HIGH	(1 << 24)
234 #define	XBUS_INT_IN_L1_LOW	0
235 #define	XBUS_INT_IN_L1_HIGH	(1 << 25)
236 #define	XBUS_INT_IN_L2_LOW	0
237 #define	XBUS_INT_IN_L2_HIGH	(1 << 26)
238 #define	XBUS_INT_IN_L3_LOW	0
239 #define	XBUS_INT_IN_L3_HIGH	(1 << 27)
240 #define	XBUS_INT_XCS0_LOW	0
241 #define	XBUS_INT_XCS0_HIGH	(1 << 28)
242 #define	XBUS_INT_XCS1_LOW	0
243 #define	XBUS_INT_XCS1_HIGH	(1 << 29)
244 #define	XBUS_INT_XCS2_LOW	0
245 #define	XBUS_INT_XCS2_HIGH	(1 << 30)
246 #define	XBUS_PCI_INT_REQUEST	(1 << 31)
247 
248 #define	XBUS_IO_STROBE_MASK	0x14C
249 #define	XBUS_IO_STROBE_0_SHIFT	0
250 #define	XBUS_IO_STROBE_2_SHIFT	8
251 #define	XBUS_IO_STROBE_3_SHIFT	16
252 #define	XBUS_IO_STROBE_4_SHIFT	24
253 
254 #define	DOORBELL_PCI_MASK	0x150
255 #define	DOORBELL_SA_MASK	0x154
256 
257 /* UART registers */
258 
259 #define	UART_DATA		0x160
260 #define	UART_RX_STAT		0x164
261 #define	UART_PARITY_ERROR	0x01
262 #define	UART_FRAME_ERROR	0x02
263 #define	UART_OVERRUN_ERROR	0x04
264 #define	UART_RX_ERROR		(UART_PARITY_ERROR | UART_FRAME_ERROR \
265 				| UART_OVERRUN_ERROR)
266 #define	UART_H_UBRLCR		0x168
267 #define	UART_BREAK		0x01
268 #define	UART_PARITY_ENABLE	0x02
269 #define	UART_ODD_PARITY		0x00
270 #define	UART_EVEN_PARITY	0x04
271 #define	UART_STOP_BITS_1	0x00
272 #define	UART_STOP_BITS_2	0x08
273 #define	UART_ENABLE_FIFO	0x10
274 #define	UART_DATA_BITS_5	0x00
275 #define	UART_DATA_BITS_6	0x20
276 #define	UART_DATA_BITS_7	0x40
277 #define	UART_DATA_BITS_8	0x60
278 #define	UART_M_UBRLCR		0x16C
279 #define	UART_L_UBRLCR		0x170
280 #define UART_BRD(fclk, x)	(((fclk) / 4 / 16 / x) - 1)
281 
282 #define	UART_CONTROL		0x174
283 #define	UART_ENABLE		0x01
284 #define	UART_SIR_ENABLE		0x02
285 #define	UART_IRDA_ENABLE	0x04
286 #define	UART_FLAGS		0x178
287 #define	UART_TX_BUSY		0x08
288 #define	UART_RX_FULL		0x10
289 #define	UART_TX_EMPTY		0x20
290 
291 /* Interrupt numbers for IRQ and FIQ registers */
292 
293 #define	IRQ_RESERVED0		0x00
294 #define	IRQ_SOFTINT		0x01
295 #define	IRQ_SERIAL_RX		0x02
296 #define	IRQ_SERIAL_TX		0x03
297 #define	IRQ_TIMER_1		0x04
298 #define	IRQ_TIMER_2		0x05
299 #define	IRQ_TIMER_3		0x06
300 #define	IRQ_TIMER_4		0x07
301 #define	IRQ_IN_L0		0x08
302 #define	IRQ_IN_L1		0x09
303 #define	IRQ_IN_L2		0x0A
304 #define	IRQ_IN_L3		0x0B
305 #define	IRQ_XCS_L0		0x0C
306 #define	IRQ_XCS_L1		0x0D
307 #define	IRQ_XCS_L2		0x0E
308 #define	IRQ_DOORBELL		0x0F
309 #define	IRQ_DMA_1		0x10
310 #define	IRQ_DMA_2		0x11
311 #define	IRQ_PCI			0x12
312 #define	IRQ_PMCSR		0x13
313 #define	IRQ_RESERVED1		0x14
314 #define	IRQ_RESERVED2		0x15
315 #define	IRQ_BIST		0x16
316 #define	IRQ_SERR		0x17
317 #define	IRQ_SDRAM_PARITY	0x18
318 #define	IRQ_I2O			0x19
319 #define	IRQ_RESERVED3		0x1A
320 #define	IRQ_DISCARD_TIMER	0x1B
321 #define	IRQ_DATA_PARITY		0x1C
322 #define	IRQ_MASTER_ABORT	0x1D
323 #define	IRQ_TARGET_ABORT	0x1E
324 #define	IRQ_PARITY		0x1F
325 
326 /* IRQ and FIQ status / enable registers */
327 
328 #define	IRQ_STATUS		0x180
329 #define	IRQ_RAW_STATUS		0x184
330 #define IRQ_ENABLE		0x188
331 #define	IRQ_ENABLE_SET		0x188
332 #define	IRQ_ENABLE_CLEAR	0x18c
333 #define	IRQ_SOFT		0x190
334 
335 #define	FIQ_STATUS		0x280
336 #define	FIQ_RAW_STATUS		0x284
337 #define FIQ_ENABLE		0x288
338 #define	FIQ_ENABLE_SET		0x288
339 #define	FIQ_ENABLE_CLEAR	0x28c
340 #define	FIQ_SOFT		0x290
341 
342 /* Timer registers */
343 
344 /* Relative offsets and bases */
345 
346 #define	TIMER_LOAD		0x00
347 #define	TIMER_VALUE		0x04
348 #define	TIMER_CONTROL		0x08
349 #define	TIMER_CLEAR		0x0C
350 #define	TIMER_1_BASE		0x300
351 #define	TIMER_2_BASE		0x320
352 #define	TIMER_3_BASE		0x340
353 #define	TIMER_4_BASE		0x360
354 
355 /* Control register bits */
356 
357 #define	TIMER_FCLK		0x00
358 #define	TIMER_FCLK_16		0x04
359 #define	TIMER_FCLK_256		0x08
360 #define	TIMER_EXTERNAL		0x0C
361 #define	TIMER_MODE_FREERUN	0x00
362 #define	TIMER_MODE_PERIODIC	0x40
363 #define	TIMER_ENABLE		0x80
364 
365 /* Maximum timer value */
366 
367 #define TIMER_MAX		0x00FFFFFF
368 
369 /* Specific registers */
370 
371 #define	TIMER_1_LOAD		0x300
372 #define	TIMER_1_VALUE		0x304
373 #define	TIMER_1_CONTROL		0x308
374 #define	TIMER_1_CLEAR		0x30C
375 #define	TIMER_2_LOAD		0x320
376 #define	TIMER_2_VALUE		0x324
377 #define	TIMER_2_CONTROL		0x328
378 #define	TIMER_2_CLEAR		0x32C
379 #define	TIMER_3_LOAD		0x340
380 #define	TIMER_3_VALUE		0x344
381 #define	TIMER_3_CONTROL		0x348
382 #define	TIMER_3_CLEAR		0x34C
383 #define	TIMER_4_LOAD		0x360
384 #define	TIMER_4_VALUE		0x364
385 #define	TIMER_4_CONTROL		0x368
386 #define	TIMER_4_CLEAR		0x36C
387 
388 /* Miscellaneous definitions */
389 
390 #ifndef FCLK
391 #define FCLK 50000000
392 #endif
393