1 #ifndef CYGONCE_HAL_INTEGRATOR_H
2 #define CYGONCE_HAL_INTEGRATOR_H
4 /*=============================================================================
8 // HAL Description of INTEGRATOR board
10 //=============================================================================
11 //####ECOSGPLCOPYRIGHTBEGIN####
12 // -------------------------------------------
13 // This file is part of eCos, the Embedded Configurable Operating System.
14 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
16 // eCos is free software; you can redistribute it and/or modify it under
17 // the terms of the GNU General Public License as published by the Free
18 // Software Foundation; either version 2 or (at your option) any later version.
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 // You should have received a copy of the GNU General Public License along
26 // with eCos; if not, write to the Free Software Foundation, Inc.,
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29 // As a special exception, if other files instantiate templates or use macros
30 // or inline functions from this file, or you compile this file and link it
31 // with other works to produce a work based on this file, this file does not
32 // by itself cause the resulting work to be covered by the GNU General Public
33 // License. However the source code for this file must still be made available
34 // in accordance with section (3) of the GNU General Public License.
36 // This exception does not invalidate any other reasons why a work based on
37 // this file might be covered by the GNU General Public License.
39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40 // at http://sources.redhat.com/ecos/ecos-license/
41 // -------------------------------------------
42 //####ECOSGPLCOPYRIGHTEND####
43 //=============================================================================
44 //#####DESCRIPTIONBEGIN####
46 // Author(s): Philippe Robin
48 // Date: November 7, 2000
51 // Usage: #include <cyg/hal/hal_integrator.h>
53 //####DESCRIPTIONEND####
55 //===========================================================================*/
58 #define INTEGRATOR_HDR_BASE 0x10000000
59 #define INTEGRATOR_HDR_CTRL_OFFSET 0x0C
60 #define INTEGRATOR_HDR_CTRL_REMAP 0x04
62 #define INTEGRATOR_BOOT_ROM_BASE 0x20000000
63 #define INTEGRATOR_HDR0_SDRAM_BASE 0x80000000
65 #define INTEGRATOR_DBG_ALPHA_OFFSET 0x00
66 #define INTEGRATOR_DBG_LEDS_OFFSET 0x04
67 #define INTEGRATOR_DBG_SWITCH_OFFSET 0x08
69 #define INTEGRATOR_DBG_BASE 0x1A000000
70 #define INTEGRATOR_DBG_ALPHA (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_ALPHA_OFFSET)
71 #define INTEGRATOR_DBG_LEDS (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_LEDS_OFFSET)
72 #define INTEGRATOR_DBG_SWITCH (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_SWITCH_OFFSET)
74 #define INTEGRATOR_UART0_BASE 0x16000000 /* UART 0 */
75 #define INTEGRATOR_UART1_BASE 0x17000000 /* UART 1 */
77 #define INTEGRATOR_IRQCONT_BASE 0x14000000
79 #define INTEGRATOR_IRQSTATUS 0x00
80 #define INTEGRATOR_IRQRAWSTATUS 0x04
81 #define INTEGRATOR_IRQENABLE 0x08
82 #define INTEGRATOR_IRQENABLESET 0x08
83 #define INTEGRATOR_IRQENABLECLEAR 0x0C
85 #define INTEGRATOR_IRQSOFT 0x10
86 #define INTEGRATOR_IRQSOFTSET 0x10
87 #define INTEGRATOR_IRQSOFTCLEAR 0x14
89 #define INTEGRATOR_FIQSTATUS 0x20
90 #define INTEGRATOR_FIQRAWSTATUS 0x24
91 #define INTEGRATOR_FIQENABLE 0x28
92 #define INTEGRATOR_FIQENABLESET 0x28
93 #define INTEGRATOR_FIQENABLECLEAR 0x2C
95 #define INTEGRATOR_IRQCONT_IRQSTATUS (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_IRQSTATUS)
96 #define INTEGRATOR_IRQCONT_IRQRAWSTATUS (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_IRQRAWSTATUS)
97 #define INTEGRATOR_IRQCONT_IRQENABLE (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_IRQENABLE)
98 #define INTEGRATOR_IRQCONT_IRQENABLESET (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_IRQENABLESET)
99 #define INTEGRATOR_IRQCONT_IRQENABLECLEAR (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_IRQENABLECLEAR)
100 #define INTEGRATOR_IRQCONT_IRQSOFT (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_IRQSOFT)
101 #define INTEGRATOR_IRQCONT_IRQSOFTSET (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_IRQSOFTSET)
102 #define INTEGRATOR_IRQCONT_IRQSOFTCLEAR (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_IRQSOFTCLEAR)
103 #define INTEGRATOR_IRQCONT_FIQSTATUS (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_FIQSTATUS)
104 #define INTEGRATOR_IRQCONT_FIQRAWSTATUS (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_FIQRAWSTATUS)
105 #define INTEGRATOR_IRQCONT_FIQENABLE (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_FIQENABLE)
106 #define INTEGRATOR_IRQCONT_FIQENABLESET (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_FIQENABLESET)
107 #define INTEGRATOR_IRQCONT_FIQENABLECLEAR (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_FIQENABLECLEAR)
108 #define INTEGRATOR_IRQCONT_FIQSOFT (INTEGRATOR_IRQCONT_BASE + INTEGRATOR_FIQSOFT)
110 // Interrupt controller registers
111 #define CYG_DEVICE_ICTL_BASE INTEGRATOR_IRQCONT_BASE
112 #define CYG_DEVICE_IRQ_Status \
113 ((volatile cyg_uint32 *) (CYG_DEVICE_ICTL_BASE + INTEGRATOR_IRQSTATUS))
114 // Current status, read only
115 #define CYG_DEVICE_IRQ_Enable \
116 ((volatile cyg_uint32 *) (CYG_DEVICE_ICTL_BASE + INTEGRATOR_IRQENABLE))
117 // Enable status, read only
118 #define CYG_DEVICE_IRQ_EnableSet \
119 ((volatile cyg_uint32 *) (CYG_DEVICE_ICTL_BASE + INTEGRATOR_IRQENABLESET))
120 // Enable (1's only), write only
121 #define CYG_DEVICE_IRQ_EnableClear \
122 ((volatile cyg_uint32 *) (CYG_DEVICE_ICTL_BASE + INTEGRATOR_IRQENABLECLEAR))
123 // Disable (1's only), write only
126 #define INTEGRATOR_CT_BASE 0x13000000 /* Counter/Timers */
128 #define INTEGRATOR_TIMER0_BASE INTEGRATOR_CT_BASE
129 #define INTEGRATOR_TIMER1_BASE (INTEGRATOR_CT_BASE + 0x100)
130 #define INTEGRATOR_TIMER2_BASE (INTEGRATOR_CT_BASE + 0x200)
132 #define CYG_DEVICE_TIMER_BASE INTEGRATOR_TIMER2_BASE
134 #define CYG_DEVICE_TIMER_LOAD \
135 ((volatile cyg_uint32 *) (CYG_DEVICE_TIMER_BASE + 0x00))
136 // Load value, read/write
137 #define CYG_DEVICE_TIMER_CURRENT \
138 ((volatile cyg_uint32 *) (CYG_DEVICE_TIMER_BASE + 0x04))
139 // Current value, read
140 #define CYG_DEVICE_TIMER_CONTROL \
141 ((volatile cyg_uint32 *) (CYG_DEVICE_TIMER_BASE + 0x08))
142 // Control register, read/write
143 #define CYG_DEVICE_TIMER_CLEAR \
144 ((volatile cyg_uint32 *) (CYG_DEVICE_TIMER_BASE + 0x0C))
145 // Clears interrrupt, write only
147 // Clock/timer control register
148 #define CTL_ENABLE 0x80 // Bit 7: 1 - counter enabled
149 #define CTL_DISABLE 0x00 // 0 - counter disabled
150 #define CTL_FREERUN 0x00 // Bit 6: 0 - free running counter
151 #define CTL_PERIODIC 0x40 // 1 - periodic timer mode
152 #define CTL_SCALE_1 0x00 // Bits 32: 00 - Scale clock by 1
153 #define CTL_SCALE_16 0x04 // 01 - Scale by 16
154 #define CTL_SCALE_256 0x08 // 10 - Scale by 256
156 /*-------------------------------------------------------------------------------
157 * From AMBA UART (PL010) Block Specification (ARM-0001-CUST-DSPC-A03)
158 * -------------------------------------------------------------------------------
159 * UART Register Offsets.
161 #define AMBA_UARTDR 0x00 /* Data read or written from the interface. */
162 #define AMBA_UARTRSR 0x04 /* Receive status register (Read). */
163 #define AMBA_UARTECR 0x04 /* Error clear register (Write). */
164 #define AMBA_UARTLCR_H 0x08 /* Line control register, high byte. */
165 #define AMBA_UARTLCR_M 0x0C /* Line control register, middle byte. */
166 #define AMBA_UARTLCR_L 0x10 /* Line control register, low byte. */
167 #define AMBA_UARTCR 0x14 /* Control register. */
168 #define AMBA_UARTFR 0x18 /* Flag register (Read only). */
169 #define AMBA_UARTIIR 0x1C /* Interrupt indentification register (Read). */
170 #define AMBA_UARTICR 0x1C /* Interrupt clear register (Write). */
171 #define AMBA_UARTILPR 0x20 /* IrDA low power counter register. */
173 #define AMBA_UARTRSR_OE 0x08
174 #define AMBA_UARTRSR_BE 0x04
175 #define AMBA_UARTRSR_PE 0x02
176 #define AMBA_UARTRSR_FE 0x01
178 #define AMBA_UARTFR_TXFF 0x20
179 #define AMBA_UARTFR_RXFE 0x10
180 #define AMBA_UARTFR_BUSY 0x08
181 #define AMBA_UARTFR_TMSK (AMBA_UARTFR_TXFF + AMBA_UARTFR_BUSY)
183 #define AMBA_UARTCR_RTIE 0x40
184 #define AMBA_UARTCR_TIE 0x20
185 #define AMBA_UARTCR_RIE 0x10
186 #define AMBA_UARTCR_MSIE 0x08
187 #define AMBA_UARTCR_IIRLP 0x04
188 #define AMBA_UARTCR_SIREN 0x02
189 #define AMBA_UARTCR_UARTEN 0x01
191 #define AMBA_UARTLCR_H_WLEN_8 0x60
192 #define AMBA_UARTLCR_H_WLEN_7 0x40
193 #define AMBA_UARTLCR_H_WLEN_6 0x20
194 #define AMBA_UARTLCR_H_WLEN_5 0x00
195 #define AMBA_UARTLCR_H_FEN 0x10
196 #define AMBA_UARTLCR_H_STP2 0x08
197 #define AMBA_UARTLCR_H_EPS 0x04
198 #define AMBA_UARTLCR_H_PEN 0x02
199 #define AMBA_UARTLCR_H_BRK 0x01
201 #define AMBA_UARTIIR_RTIS 0x08
202 #define AMBA_UARTIIR_TIS 0x04
203 #define AMBA_UARTIIR_RIS 0x02
204 #define AMBA_UARTIIR_MIS 0x01
206 #define ARM_BAUD_460800 1
207 #define ARM_BAUD_230400 3
208 #define ARM_BAUD_115200 7
209 #define ARM_BAUD_57600 15
210 #define ARM_BAUD_38400 23
211 #define ARM_BAUD_19200 47
212 #define ARM_BAUD_14400 63
213 #define ARM_BAUD_9600 95
214 #define ARM_BAUD_4800 191
215 #define ARM_BAUD_2400 383
216 #define ARM_BAUD_1200 767
219 #define INTEGRATOR_PCI_BASE 0x40000000
220 #define INTEGRATOR_PCI_SIZE 0x3FFFFFFF
222 // memory map as seen by the CPU on the local bus
223 #define CPU_PCI_IO_ADRS 0x60000000 // PCI I/O space base
224 #define CPU_PCI_IO_SIZE 0x10000
226 #define CPU_PCI_CNFG_ADRS 0x61000000 // PCI config space
227 #define CPU_PCI_CNFG_SIZE 0x1000000
229 #define PCI_MEM_BASE 0x40000000 // 512M to xxx
230 // unused 256M from A0000000-AFFFFFFF might be used for I2O ???
231 #define PCI_IO_BASE 0x60000000 // 16M to xxx
232 // unused (128-16)M from B1000000-B7FFFFFF
233 #define PCI_CONFIG_BASE 0x61000000 // 16M to xxx
234 // unused ((128-16)M - 64K) from XXX
236 #define PCI_V3_BASE 0x62000000
238 // V3 PCI bridge controller
239 #define V3_BASE 0x62000000 // V360EPC registers
241 #define V3_PCI_VENDOR 0x00000000
242 #define V3_PCI_DEVICE 0x00000002
243 #define V3_PCI_CMD 0x00000004
244 #define V3_PCI_STAT 0x00000006
245 #define V3_PCI_CC_REV 0x00000008
246 #define V3_PCI_HDR_CF 0x0000000C
247 #define V3_PCI_IO_BASE 0x00000010
248 #define V3_PCI_BASE0 0x00000014
249 #define V3_PCI_BASE1 0x00000018
250 #define V3_PCI_SUB_VENDOR 0x0000002C
251 #define V3_PCI_SUB_ID 0x0000002E
252 #define V3_PCI_ROM 0x00000030
253 #define V3_PCI_BPARAM 0x0000003C
254 #define V3_PCI_MAP0 0x00000040
255 #define V3_PCI_MAP1 0x00000044
256 #define V3_PCI_INT_STAT 0x00000048
257 #define V3_PCI_INT_CFG 0x0000004C
258 #define V3_LB_BASE0 0x00000054
259 #define V3_LB_BASE1 0x00000058
260 #define V3_LB_MAP0 0x0000005E
261 #define V3_LB_MAP1 0x00000062
262 #define V3_LB_BASE2 0x00000064
263 #define V3_LB_MAP2 0x00000066
264 #define V3_LB_SIZE 0x00000068
265 #define V3_LB_IO_BASE 0x0000006E
266 #define V3_FIFO_CFG 0x00000070
267 #define V3_FIFO_PRIORITY 0x00000072
268 #define V3_FIFO_STAT 0x00000074
269 #define V3_LB_ISTAT 0x00000076
270 #define V3_LB_IMASK 0x00000077
271 #define V3_SYSTEM 0x00000078
272 #define V3_LB_CFG 0x0000007A
273 #define V3_PCI_CFG 0x0000007C
274 #define V3_DMA_PCI_ADR0 0x00000080
275 #define V3_DMA_PCI_ADR1 0x00000090
276 #define V3_DMA_LOCAL_ADR0 0x00000084
277 #define V3_DMA_LOCAL_ADR1 0x00000094
278 #define V3_DMA_LENGTH0 0x00000088
279 #define V3_DMA_LENGTH1 0x00000098
280 #define V3_DMA_CSR0 0x0000008B
281 #define V3_DMA_CSR1 0x0000009B
282 #define V3_DMA_CTLB_ADR0 0x0000008C
283 #define V3_DMA_CTLB_ADR1 0x0000009C
284 #define V3_DMA_DELAY 0x000000E0
285 #define V3_MAIL_DATA 0x000000C0
286 #define V3_PCI_MAIL_IEWR 0x000000D0
287 #define V3_PCI_MAIL_IERD 0x000000D2
288 #define V3_LB_MAIL_IEWR 0x000000D4
289 #define V3_LB_MAIL_IERD 0x000000D6
290 #define V3_MAIL_WR_STAT 0x000000D8
291 #define V3_MAIL_RD_STAT 0x000000DA
292 #define V3_QBA_MAP 0x000000DC
294 // SYSTEM register bits
295 #define V3_SYSTEM_M_RST_OUT (1 << 15)
296 #define V3_SYSTEM_M_LOCK (1 << 14)
299 #define V3_PCI_CFG_M_RETRY_EN (1 << 10)
300 #define V3_PCI_CFG_M_AD_LOW1 (1 << 9)
301 #define V3_PCI_CFG_M_AD_LOW0 (1 << 8)
303 // PCI MAP register bits (PCI -> Local bus)
304 #define V3_PCI_MAP_M_MAP_ADR 0xFFF00000
305 #define V3_PCI_MAP_M_RD_POST_INH (1 << 15)
306 #define V3_PCI_MAP_M_ROM_SIZE (1 << 11 | 1 << 10)
307 #define V3_PCI_MAP_M_SWAP (1 << 9 | 1 << 8)
308 #define V3_PCI_MAP_M_ADR_SIZE 0x000000F0
309 #define V3_PCI_MAP_M_REG_EN (1 << 1)
310 #define V3_PCI_MAP_M_ENABLE (1 << 0)
312 // 9 => 512M window size
313 #define V3_PCI_MAP_M_ADR_SIZE_512M 0x00000090
315 // A => 1024M window size
316 #define V3_PCI_MAP_M_ADR_SIZE_1024M 0x000000A0
318 // LB_BASE register bits (Local bus -> PCI)
319 #define V3_LB_BASE_M_MAP_ADR 0xFFF00000
320 #define V3_LB_BASE_M_SWAP (1 << 8 | 1 << 9)
321 #define V3_LB_BASE_M_ADR_SIZE 0x000000F0
322 #define V3_LB_BASE_M_PREFETCH (1 << 3)
323 #define V3_LB_BASE_M_ENABLE (1 << 0)
325 // PCI COMMAND REGISTER bits
326 #define V3_COMMAND_M_FBB_EN (1 << 9)
327 #define V3_COMMAND_M_SERR_EN (1 << 8)
328 #define V3_COMMAND_M_PAR_EN (1 << 6)
329 #define V3_COMMAND_M_MASTER_EN (1 << 2)
330 #define V3_COMMAND_M_MEM_EN (1 << 1)
331 #define V3_COMMAND_M_IO_EN (1 << 0)
333 #define INTEGRATOR_SC_BASE 0x11000000
334 #define INTEGRATOR_SC_PCIENABLE_OFFSET 0x18
335 #define INTEGRATOR_SC_PCIENABLE \
336 (INTEGRATOR_SC_BASE + INTEGRATOR_SC_PCIENABLE_OFFSET)
340 #define SZ_256M 0x10000000
342 // Integrator EBI register definitions
344 #define INTEGRATOR_EBI_BASE 0x12000000
346 #define INTEGRATOR_EBI_CSR0_OFFSET 0x00
347 #define INTEGRATOR_EBI_CSR1_OFFSET 0x04
348 #define INTEGRATOR_EBI_CSR2_OFFSET 0x08
349 #define INTEGRATOR_EBI_CSR3_OFFSET 0x0C
350 #define INTEGRATOR_EBI_LOCK_OFFSET 0x20
352 #define INTEGRATOR_EBI_CSR0 (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_CSR0_OFFSET)
353 #define INTEGRATOR_EBI_CSR1 (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET)
354 #define INTEGRATOR_EBI_CSR2 (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_CSR2_OFFSET)
355 #define INTEGRATOR_EBI_CSR3 (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_CSR3_OFFSET)
356 #define INTEGRATOR_EBI_LOCK (INTEGRATOR_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET)
358 #define INTEGRATOR_EBI_8_BIT 0x00
359 #define INTEGRATOR_EBI_16_BIT 0x01
360 #define INTEGRATOR_EBI_32_BIT 0x02
361 #define INTEGRATOR_EBI_WRITE_ENABLE 0x04
362 #define INTEGRATOR_EBI_SYNC 0x08
363 #define INTEGRATOR_EBI_WS_2 0x00
364 #define INTEGRATOR_EBI_WS_3 0x10
365 #define INTEGRATOR_EBI_WS_4 0x20
366 #define INTEGRATOR_EBI_WS_5 0x30
367 #define INTEGRATOR_EBI_WS_6 0x40
368 #define INTEGRATOR_EBI_WS_7 0x50
369 #define INTEGRATOR_EBI_WS_8 0x60
370 #define INTEGRATOR_EBI_WS_9 0x70
371 #define INTEGRATOR_EBI_WS_10 0x80
372 #define INTEGRATOR_EBI_WS_11 0x90
373 #define INTEGRATOR_EBI_WS_12 0xA0
374 #define INTEGRATOR_EBI_WS_13 0xB0
375 #define INTEGRATOR_EBI_WS_14 0xC0
376 #define INTEGRATOR_EBI_WS_15 0xD0
377 #define INTEGRATOR_EBI_WS_16 0xE0
378 #define INTEGRATOR_EBI_WS_17 0xF0
380 #define FL_SC_CONTROL 0x06 // Enable Flash Write and Vpp
386 #define INTEGRATOR_SC_ID_OFFSET 0x00
387 #define INTEGRATOR_SC_OSC_OFFSET 0x04
388 #define INTEGRATOR_SC_CTRLS_OFFSET 0x08
389 #define INTEGRATOR_SC_CTRLC_OFFSET 0x0C
390 #define INTEGRATOR_SC_DEC_OFFSET 0x10
391 #define INTEGRATOR_SC_ARB_OFFSET 0x14
392 #define INTEGRATOR_SC_PCIENABLE_OFFSET 0x18
393 #define INTEGRATOR_SC_LOCK_OFFSET 0x1C
395 #define INTEGRATOR_SC_BASE 0x11000000
396 #define INTEGRATOR_SC_ID (INTEGRATOR_SC_BASE + INTEGRATOR_SC_ID_OFFSET)
397 #define INTEGRATOR_SC_OSC (INTEGRATOR_SC_BASE + INTEGRATOR_SC_OSC_OFFSET)
398 #define INTEGRATOR_SC_CTRLS (INTEGRATOR_SC_BASE + INTEGRATOR_SC_CTRLS_OFFSET)
399 #define INTEGRATOR_SC_CTRLC (INTEGRATOR_SC_BASE + INTEGRATOR_SC_CTRLC_OFFSET)
400 #define INTEGRATOR_SC_DEC (INTEGRATOR_SC_BASE + INTEGRATOR_SC_DEC_OFFSET)
401 #define INTEGRATOR_SC_ARB (INTEGRATOR_SC_BASE + INTEGRATOR_SC_ARB_OFFSET)
402 #define INTEGRATOR_SC_PCIENABLE (INTEGRATOR_SC_BASE + INTEGRATOR_SC_PCIENABLE_OFFSET)
403 #define INTEGRATOR_SC_LOCK (INTEGRATOR_SC_BASE + INTEGRATOR_SC_LOCK_OFFSET)
405 #endif //CYGONCE_HAL_INTEGRATOR_H