OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [arm/] [ebsa285/] [v2_0/] [include/] [hal_ebsa285.h] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_EBSA285_H
2
#define CYGONCE_HAL_EBSA285_H
3
 
4
/*=============================================================================
5
//
6
//      hal_ebsa285.h
7
//
8
//      HAL Description of SA-110 and 21285 control registers
9
//      and ARM memory control in general.
10
//
11
//=============================================================================
12
//####ECOSGPLCOPYRIGHTBEGIN####
13
// -------------------------------------------
14
// This file is part of eCos, the Embedded Configurable Operating System.
15
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
16
//
17
// eCos is free software; you can redistribute it and/or modify it under
18
// the terms of the GNU General Public License as published by the Free
19
// Software Foundation; either version 2 or (at your option) any later version.
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
22
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with eCos; if not, write to the Free Software Foundation, Inc.,
28
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29
//
30
// As a special exception, if other files instantiate templates or use macros
31
// or inline functions from this file, or you compile this file and link it
32
// with other works to produce a work based on this file, this file does not
33
// by itself cause the resulting work to be covered by the GNU General Public
34
// License. However the source code for this file must still be made available
35
// in accordance with section (3) of the GNU General Public License.
36
//
37
// This exception does not invalidate any other reasons why a work based on
38
// this file might be covered by the GNU General Public License.
39
//
40
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
41
// at http://sources.redhat.com/ecos/ecos-license/
42
// -------------------------------------------
43
//####ECOSGPLCOPYRIGHTEND####
44
//=============================================================================
45
//#####DESCRIPTIONBEGIN####
46
//
47
// Author(s):    hmt
48
// Contributors: hmt
49
// Date:         1999-04-19
50
// Purpose:      Intel EBSA285 hardware description
51
// Description:
52
// Usage:        #include <cyg/hal/hal_ebsa285.h>
53
//
54
//####DESCRIPTIONEND####
55
//
56
//===========================================================================*/
57
 
58
// Note: these defintions match the documentation, thus no attempt is made
59
// to santise (mangle) the names against namespace pollution.  Also, care should be
60
// taken to keep this clean for use in assembly code (no "C" constructs).
61
 
62
 
63
#define SZ_1K           0x00000400
64
#define SZ_2K           0x00000800
65
#define SZ_4K           0x00001000
66
#define SZ_8K           0x00002000
67
#define SZ_16K          0x00004000
68
#define SZ_32K          0x00008000
69
#define SZ_64K          0x00010000
70
#define SZ_128K         0x00020000
71
#define SZ_256K         0x00040000
72
#define SZ_512K         0x00080000
73
#define SZ_1M           0x00100000
74
#define SZ_2M           0x00200000
75
#define SZ_4M           0x00400000
76
#define SZ_8M           0x00800000
77
#define SZ_16M          0x01000000
78
#define SZ_32M          0x02000000
79
#define SZ_64M          0x04000000
80
#define SZ_128M         0x08000000
81
#define SZ_256M         0x10000000
82
#define SZ_512M         0x20000000
83
#define SZ_1G           0x40000000
84
 
85
#ifdef __ASSEMBLER__
86
 
87
#define REG8_VAL(a)  (a)
88
#define REG16_VAL(a) (a)
89
#define REG32_VAL(a) (a)
90
 
91
#define REG8_PTR(a)  (a)
92
#define REG16_PTR(a) (a)
93
#define REG32_PTR(a) (a)
94
 
95
#else /* __ASSEMBLER__ */
96
 
97
#define REG8_VAL(a)  ((unsigned char)(a))
98
#define REG16_VAL(a) ((unsigned short)(a))
99
#define REG32_VAL(a) ((unsigned int)(a))
100
 
101
#define REG8_PTR(a)  ((volatile unsigned char *)(a))
102
#define REG16_PTR(a) ((volatile unsigned long *)(a))
103
#define REG32_PTR(a) ((volatile unsigned long *)(a))
104
 
105
#endif /* __ASSEMBLER__ */
106
 
107
//
108
// Memory Layout
109
//
110
#define EBSA285_RAM_BANK0_BASE 0x00000000
111
 
112
/*
113
 * SA-110 Cache and MMU Control Registers
114
 *
115
 * Accessed through coprocessor instructions.
116
 */
117
#define SA110_ID_REGISTER                        0
118
#define SA110_CONTROL_REGISTER                   1
119
#define SA110_TRANSLATION_TABLE_BASE_REGISTER    2
120
#define SA110_DOMAIN_ACCESS_CONTROL_REGISTER     3
121
#define SA110_FAULT_STATUS_REGISTER              5
122
#define SA110_FAULT_ADDRESS_REGISTER             6
123
#define SA110_CACHE_OPERATIONS_REGISTER          7
124
#define SA110_TLB_OPERATIONS_REGISTER            8
125
#define SA110_TEST_CLOCK_AND_IDLE_REGISTER       15
126
 
127
/*
128
 * SA-110 Cache and MMU Definitions
129
 */
130
#define SA110_ICACHE_SIZE                       SZ_16K
131
#define SA110_DCACHE_SIZE                       SZ_16K
132
#define SA110_ICACHE_LINESIZE_BYTES             32
133
#define SA110_DCACHE_LINESIZE_BYTES             32
134
#define SA110_ICACHE_LINESIZE_WORDS             8
135
#define SA110_DCACHE_LINESIZE_WORDS             8
136
#define SA110_ICACHE_WAYS                       32
137
#define SA110_DCACHE_WAYS                       32
138
#define SA110_ICACHE_LINE_BASE(p)               REG32_PTR((unsigned long)(p) & \
139
                                                           ~(SA110_ICACHE_LINESIZE_BYTES - 1))
140
#define SA110_DCACHE_LINE_BASE(p)               REG32_PTR((unsigned long)(p) & \
141
                                                           ~(SA110_DCACHE_LINESIZE_BYTES - 1))
142
 
143
#define SA110_ZEROS_BANK_BASE                  (0x50000000)
144
 
145
#define ARM_FIRST_LEVEL_PAGE_TABLE_SIZE         SZ_16K
146
 
147
 
148
 
149
/*
150
 * SA-110 Cache and MMU ID Register value
151
 */
152
#define SA110_ID_MASK                            0xFFFFFFF0
153
#define SA110_ID_VALUE                           0x4401a100
154
 
155
/*
156
 * SA-110 Cache Control Register Bit Fields and Masks
157
 */
158
#define SA110_MMU_DISABLED                       0x00000000
159
#define SA110_MMU_ENABLED                        0x00000001
160
#define SA110_MMU_MASK                           0x00000001
161
#define SA110_ADDRESS_FAULT_DISABLED             0x00000000
162
#define SA110_ADDRESS_FAULT_ENABLED              0x00000002
163
#define SA110_ADDRESS_FAULT_MASK                 0x00000002
164
#define SA110_DATA_CACHE_DISABLED                0x00000000
165
#define SA110_DATA_CACHE_ENABLED                 0x00000004
166
#define SA110_DATA_CACHE_MASK                    0x00000004
167
#define SA110_WRITE_BUFFER_DISABLED              0x00000000
168
#define SA110_WRITE_BUFFER_ENABLED               0x00000008
169
#define SA110_WRITE_BUFFER_MASK                  0x00000008
170
#define SA110_LITTLE_ENDIAN                      0x00000000
171
#define SA110_BIG_ENDIAN                         0x00000080
172
#define SA110_ACCESS_CHECKS_SYSTEM               0x00000100
173
#define SA110_ACCESS_CHECKS_ROM                  0x00000200
174
#define SA110_INSTRUCTION_CACHE_DISABLED         0x00000000
175
#define SA110_INSTRUCTION_CACHE_ENABLED          0x00001000
176
#define SA110_INSTRUCTION_CACHE_MASK             0x00001000
177
 
178
/*
179
 * SA-110 Translation Table Base Bit Masks
180
 */
181
#define SA110_TRANSLATION_TABLE_MASK             0xFFFFC000
182
 
183
/*
184
 * SA-110 Domain Access Control Bit Masks
185
 */
186
#define SA110_DOMAIN_0_MASK                      0x00000003
187
#define SA110_DOMAIN_1_MASK                      0x0000000C
188
#define SA110_DOMAIN_2_MASK                      0x00000030
189
#define SA110_DOMAIN_3_MASK                      0x000000C0
190
#define SA110_DOMAIN_4_MASK                      0x00000300
191
#define SA110_DOMAIN_5_MASK                      0x00000C00
192
#define SA110_DOMAIN_6_MASK                      0x00003000
193
#define SA110_DOMAIN_7_MASK                      0x0000C000
194
#define SA110_DOMAIN_8_MASK                      0x00030000
195
#define SA110_DOMAIN_9_MASK                      0x000C0000
196
#define SA110_DOMAIN_10_MASK                     0x00300000
197
#define SA110_DOMAIN_11_MASK                     0x00C00000
198
#define SA110_DOMAIN_12_MASK                     0x03000000
199
#define SA110_DOMAIN_13_MASK                     0x0C000000
200
#define SA110_DOMAIN_14_MASK                     0x30000000
201
#define SA110_DOMAIN_15_MASK                     0xC0000000
202
 
203
/*
204
 * SA-110 Fault Status Bit Masks
205
 */
206
#define SA110_FAULT_STATUS_MASK                  0x0000000F
207
#define SA110_DOMAIN_MASK                        0x000000F0
208
 
209
/*
210
 * SA-110 Cache Control Operations Definitions
211
 */
212
#define SA110_FLUSH_CACHE_INST_DATA_OPCODE       0x0
213
#define SA110_FLUSH_CACHE_INST_DATA_RM           0x7
214
#define SA110_FLUSH_CACHE_INST_OPCODE            0x0
215
#define SA110_FLUSH_CACHE_INST_RM                0x5
216
#define SA110_FLUSH_CACHE_DATA_OPCODE            0x0
217
#define SA110_FLUSH_CACHE_DATA_RM                0x6
218
#define SA110_FLUSH_CACHE_DATA_SINGLE_OPCODE     0x1
219
#define SA110_FLUSH_CACHE_DATA_SINGLE_RM         0x6
220
#define SA110_CLEAN_CACHE_DATA_ENTRY_OPCODE      0x1
221
#define SA110_CLEAN_CACHE_DATA_ENTRY_RM          0xA
222
#define SA110_DRAIN_CACHE_WRITE_BUFFER_OPCODE    0x4
223
#define SA110_DRAIN_CACHE_WRITE_BUFFER_RM        0xA
224
 
225
/*
226
 * SA-110 TLB Operations Definitions
227
 */
228
#define SA110_FLUSH_INST_DATA_TLB_OPCODE         0x0
229
#define SA110_FLUSH_INST_DATA_TLB_RM             0x7
230
#define SA110_FLUSH_INST_TLB_OPCODE              0x0
231
#define SA110_FLUSH_INST_TLB_RM                  0x5
232
#define SA110_FLUSH_DATA_TLB_OPCODE              0x0
233
#define SA110_FLUSH_DATA_TLB_RM                  0x6
234
#define SA110_FLUSH_DATA_ENTRY_TLB_OPCODE        0x1
235
#define SA110_FLUSH_DATA_ENTRY_TLB_RM            0x6
236
 
237
/*
238
 * SA-110 Test, Clock and Idle Control Definition
239
 */
240
#define SA110_ICACHE_ODD_WORD_LOADING_OPCODE     0x1
241
#define SA110_ICACHE_ODD_WORD_LOADING_RM         0x1
242
#define SA110_ICACHE_EVEN_WORD_LOADING_OPCODE    0x1
243
#define SA110_ICACHE_EVEN_WORD_LOADING_RM        0x2
244
#define SA110_ICACHE_CLEAR_LFSR_OPCODE           0x1
245
#define SA110_ICACHE_CLEAR_LFSR_RM               0x4
246
#define SA110_ENABLE_CLOCK_SWITCHING_OPCODE      0x2
247
#define SA110_ENABLE_CLOCK_SWITCHING_RM          0x1
248
#define SA110_DISABLE_CLOCK_SWITCHING_OPCODE     0x2
249
#define SA110_DISABLE_CLOCK_SWITCHING_RM         0x2
250
#define SA110_DISABLE_mCLK_OUTPUT_OPCODE         0x2
251
#define SA110_DISABLE_mCLK_OUTPUT_RM             0x4
252
#define SA110_WAIT_FOR_INTERRUPT_OPCODE          0x2
253
#define SA110_WAIT_FOR_INTERRUPT_RM              0x8
254
 
255
 
256
/*
257
 * SA-110 Control and Status Register Base Definitions
258
 */
259
#define SA110_CONTROL_STATUS_BASE                0x42000000
260
#define SA110_REGISTER(x)                        REG32_PTR(SA110_CONTROL_STATUS_BASE + (x))
261
 
262
#define SA110_PCI_CONFIG0_BASE                   0x7b000000
263
#define SA110_PCI_CONFIG1_BASE                   0x7a000000
264
 
265
/*
266
 * These are standard PCI configuration offsets with base at
267
 * SA110_CONTROL_STATUS_BASE - a memory-mapped version of the board's
268
 * own PCI configuration registers.
269
 * (see io_pci_cfg.h for other registers)
270
 */
271
 
272
#define SA110_PCI_CFG_COMMAND_o                 0x04
273
#define SA110_PCI_CFG_INT_LINE_o                0x3c
274
#define SA110_PCI_CFG_CSR_MEM_BAR_o             0x10 // BAR[0]
275
#define SA110_PCI_CFG_CSR_IO_BAR_o              0x14 // BAR[1]
276
#define SA110_PCI_CFG_SDRAM_BAR_o               0x18 // BAR[2]
277
 
278
#define SA110_PCI_CFG_COMMAND       SA110_REGISTER(SA110_PCI_CFG_COMMAND_o)
279
#define SA110_PCI_CFG_INT_LINE      SA110_REGISTER(SA110_PCI_CFG_INT_LINE_o)
280
#define SA110_PCI_CFG_CSR_MEM_BAR   SA110_REGISTER(SA110_PCI_CFG_CSR_MEM_BAR_o)
281
#define SA110_PCI_CFG_CSR_IO_BAR    SA110_REGISTER(SA110_PCI_CFG_CSR_IO_BAR_o) 
282
#define SA110_PCI_CFG_SDRAM_BAR     SA110_REGISTER(SA110_PCI_CFG_SDRAM_BAR_o)
283
 
284
/*
285
 * These live in the same space as the PCI config registers, but
286
 * are specific to the 21285.
287
 */
288
 
289
#define SA110_OUT_INT_STATUS_o                  0x30
290
#define SA110_OUT_INT_MASK_o                    0x34
291
#define SA110_INBOUND_FIFO_o                    0x40
292
#define SA110_OUTBOUND_FIFO_o                   0x44
293
#define SA110_MAILBOX0_o                        0x50
294
#define SA110_MAILBOX1_o                        0x54
295
#define SA110_MAILBOX2_o                        0x58
296
#define SA110_MAILBOX3_o                        0x5C
297
#define SA110_DOORBELL_o                        0x60
298
#define SA110_DOORBELL_SETUP_o                  0x64
299
 
300
#define SA110_OUT_INT_STATUS                    SA110_REGISTER(SA110_OUT_INT_STATUS_o)
301
 
302
#define SA110_PCI_ADDR_EXT_o                    0x140
303
#define SA110_DOORBELL_PCI_MASK_o               0x150
304
#define SA110_DOORBELL_SA_MASK_o                0x154
305
 
306
#define SA110_PCI_ADDR_EXT                      SA110_REGISTER(SA110_PCI_ADDR_EXT_o)
307
#define SA110_DOORBELL_PCI_MASK                 SA110_REGISTER(SA110_DOORBELL_PCI_MASK_o)
308
#define SA110_DOORBELL_SA_MASK                  SA110_REGISTER(SA110_DOORBELL_SA_MASK_o)
309
 
310
 
311
#define SA110_OUT_INT_STATUS_DOORBELL_INT     0x4
312
#define SA110_OUT_INT_STATUS_OUTBOUND_INT     0x8
313
 
314
/*
315
 * SA-110 CSR Register Definitions
316
 */
317
#define SA110_CSR_BASE_ADDRESS_MASK_o            0xF8
318
#define SA110_CSR_BASE_ADDRESS_OFFSET_o          0xFC
319
 
320
#define SA110_CSR_BASE_ADDRESS_MASK              SA110_REGISTER(SA110_CSR_BASE_ADDRESS_MASK_o)
321
#define SA110_CSR_BASE_ADDRESS_OFFSET            SA110_REGISTER(SA110_CSR_BASE_ADDRESS_OFFSET_o)
322
 
323
/*
324
 * SA-110 CSR Register Value Definitions
325
 */
326
#define SA110_CSR_WINDOW_SIZE_128                0x00000000
327
#define SA110_CSR_WINDOW_SIZE_512KB              0x00040000
328
#define SA110_CSR_WINDOW_SIZE_1MB                0x000C0000
329
#define SA110_CSR_WINDOW_SIZE_2MB                0x001C0000
330
#define SA110_CSR_WINDOW_SIZE_4MB                0x003C0000
331
#define SA110_CSR_WINDOW_SIZE_8MB                0x007C0000
332
#define SA110_CSR_WINDOW_SIZE_16MB               0x00FC0000
333
#define SA110_CSR_WINDOW_SIZE_32MB               0x01FC0000
334
#define SA110_CSR_WINDOW_SIZE_64MB               0x03FC0000
335
#define SA110_CSR_WINDOW_SIZE_128MB              0x07FC0000
336
#define SA110_CSR_WINDOW_SIZE_256MB              0x0FFC0000
337
 
338
/*
339
 * SA-110 SDRAM Register Definitions
340
 */
341
#define SA110_SDRAM_ARRAY_0_MODE_REGISTER_BASE   REG32_PTR(0x40000000)
342
#define SA110_SDRAM_ARRAY_1_MODE_REGISTER_BASE   REG32_PTR(0x40004000)
343
#define SA110_SDRAM_ARRAY_2_MODE_REGISTER_BASE   REG32_PTR(0x40008000)
344
#define SA110_SDRAM_ARRAY_3_MODE_REGISTER_BASE   REG32_PTR(0x4000C000)
345
 
346
#define SA110_SDRAM_BASE_ADDRESS_MASK_o          0x100
347
#define SA110_SDRAM_BASE_ADDRESS_OFFSET_o        0x104
348
#define SA110_EXP_ROM_BASE_ADDRESS_MASK_o        0x108
349
#define SA110_SDRAM_TIMING_o                     0x10C
350
#define SA110_SDRAM_ADDRESS_SIZE_ARRAY_0_o       0x110
351
#define SA110_SDRAM_ADDRESS_SIZE_ARRAY_1_o       0x114
352
#define SA110_SDRAM_ADDRESS_SIZE_ARRAY_2_o       0x118
353
#define SA110_SDRAM_ADDRESS_SIZE_ARRAY_3_o       0x11C
354
 
355
#define SA110_SDRAM_BASE_ADDRESS_MASK            SA110_REGISTER(SA110_SDRAM_BASE_ADDRESS_MASK_o)
356
#define SA110_SDRAM_BASE_ADDRESS_OFFSET          SA110_REGISTER(SA110_SDRAM_BASE_ADDRESS_OFFSET_o)
357
#define SA110_EXP_ROM_BASE_ADDRESS_MASK          SA110_REGISTER(SA110_EXP_ROM_BASE_ADDRESS_MASK_o)
358
#define SA110_SDRAM_TIMING                       SA110_REGISTER(SA110_SDRAM_TIMING_o)
359
#define SA110_SDRAM_ADDRESS_SIZE_ARRAY_0         SA110_REGISTER(SA110_SDRAM_ADDRESS_SIZE_ARRAY_0_o)
360
#define SA110_SDRAM_ADDRESS_SIZE_ARRAY_1         SA110_REGISTER(SA110_SDRAM_ADDRESS_SIZE_ARRAY_1_o)
361
#define SA110_SDRAM_ADDRESS_SIZE_ARRAY_2         SA110_REGISTER(SA110_SDRAM_ADDRESS_SIZE_ARRAY_2_o)
362
#define SA110_SDRAM_ADDRESS_SIZE_ARRAY_3         SA110_REGISTER(SA110_SDRAM_ADDRESS_SIZE_ARRAY_3_o)
363
 
364
#define SA110_SDRAM_SIZE_1M                     1
365
#define SA110_SDRAM_SIZE_2M                     2
366
#define SA110_SDRAM_SIZE_4M                     3
367
#define SA110_SDRAM_SIZE_8M                     4
368
#define SA110_SDRAM_SIZE_16M                    5
369
#define SA110_SDRAM_SIZE_32M                    6
370
#define SA110_SDRAM_SIZE_64M                    7
371
 
372
#define SA110_SDRAM_MUX_MODE0                   0x00
373
#define SA110_SDRAM_MUX_MODE1                   0x10
374
#define SA110_SDRAM_MUX_MODE2                   0x20
375
#define SA110_SDRAM_MUX_MODE3                   0x30
376
#define SA110_SDRAM_MUX_MODE4                   0x40
377
#define SA110_SDRAM_MUX_MODE_MASK               0x70
378
 
379
 
380
 
381
/*
382
 * SA-110 SDRAM Configuration Value Definitions
383
 */
384
#define SA110_SDRAM_WINDOW_SIZE_256KB            0x00000000
385
#define SA110_SDRAM_WINDOW_SIZE_512KB            0x00040000
386
#define SA110_SDRAM_WINDOW_SIZE_1MB              0x000C0000
387
#define SA110_SDRAM_WINDOW_SIZE_2MB              0x001C0000
388
#define SA110_SDRAM_WINDOW_SIZE_4MB              0x003C0000
389
#define SA110_SDRAM_WINDOW_SIZE_8MB              0x007C0000
390
#define SA110_SDRAM_WINDOW_SIZE_16MB             0x00FC0000
391
#define SA110_SDRAM_WINDOW_SIZE_32MB             0x01FC0000
392
#define SA110_SDRAM_WINDOW_SIZE_64MB             0x03FC0000
393
#define SA110_SDRAM_WINDOW_SIZE_128MB            0x07FC0000
394
#define SA110_SDRAM_WINDOW_SIZE_256MB            0x0FFC0000
395
#define SA110_SDRAM_WINDOW_SIZE_NO_WINDOW        0x8FFC0000
396
 
397
/*
398
 * SA-110 Expansion ROM Configuration Value Definitions
399
 */
400
#define SA110_EXP_ROM_WINDOW_SIZE_1MB            0x00000000
401
#define SA110_EXP_ROM_WINDOW_SIZE_2MB            0x00100000
402
#define SA110_EXP_ROM_WINDOW_SIZE_4MB            0x00300000
403
#define SA110_EXP_ROM_WINDOW_SIZE_8MB            0x00700000
404
#define SA110_EXP_ROM_WINDOW_SIZE_16MB           0x00F00000
405
#define SA110_EXP_ROM_WINDOW_SIZE_NO_WINDOW      0x80F00000
406
 
407
/*
408
 * SA-110 SDRAM Timing Register Field Definitions
409
 */
410
#define SA110_SDRAM_ROW_PRECHARGE_1_CYCLE        0x00000000
411
#define SA110_SDRAM_ROW_PRECHARGE_2_CYCLES       0x00000001
412
#define SA110_SDRAM_ROW_PRECHARGE_3_CYCLES       0x00000002
413
#define SA110_SDRAM_ROW_PRECHARGE_4_CYCLES       0x00000003
414
#define SA110_SDRAM_LAST_DATA_IN_2_CYCLES        0x00000000
415
#define SA110_SDRAM_LAST_DATA_IN_3_CYCLES        0x00000004
416
#define SA110_SDRAM_LAST_DATA_IN_4_CYCLES        0x00000008
417
#define SA110_SDRAM_LAST_DATA_IN_5_CYCLES        0x0000000C
418
 
419
#define SA110_SDRAM_RAS_TO_CAS_DELAY_2_CYCLES    0x00000020
420
#define SA110_SDRAM_RAS_TO_CAS_DELAY_3_CYCLES    0x00000030
421
#define SA110_SDRAM_CAS_LATENCY_2_CYCLES         0x00000080
422
#define SA110_SDRAM_CAS_LATENCY_3_CYCLES         0x000000C0
423
 
424
#define SA110_SDRAM_ROW_CYCLE_TIME_4_CYCLES      0x00000100
425
#define SA110_SDRAM_ROW_CYCLE_TIME_5_CYCLES      0x00000200
426
#define SA110_SDRAM_ROW_CYCLE_TIME_6_CYCLES      0x00000300
427
#define SA110_SDRAM_ROW_CYCLE_TIME_7_CYCLES      0x00000400
428
#define SA110_SDRAM_ROW_CYCLE_TIME_8_CYCLES      0x00000500
429
#define SA110_SDRAM_ROW_CYCLE_TIME_9_CYCLES      0x00000600
430
#define SA110_SDRAM_ROW_CYCLE_TIME_10_CYCLES     0x00000700
431
 
432
#define SA110_SDRAM_COMMAND_DRIVE_SAME_CYCLE     0x00000000
433
#define SA110_SDRAM_COMMAND_DRIVE_1_CYCLE        0x00000800
434
 
435
#define SA110_SDRAM_PARITY_DISABLED              0x00000000
436
#define SA110_SDRAM_PARITY_ENABLED               0x00001000
437
#define SA110_SDRAM_PARITY_MASK                  0x00001000
438
 
439
#define SA110_SDRAM_SA110_PRIME_DISABLED         0x00000000
440
#define SA110_SDRAM_SA110_PRIME_ENABLED          0x00002000
441
#define SA110_SDRAM_SA110_PRIME_MASK             0x00002000
442
 
443
#define SA110_SDRAM_REFRESH_INTERVAL(x)          (((x) << 16) & 0x003f0000)
444
#define SA110_SDRAM_REFRESH_INTERVAL_MIN         SA110_SDRAM_REFRESH_INTERVAL(1)
445
#define SA110_SDRAM_REFRESH_INTERVAL_NORMAL      SA110_SDRAM_REFRESH_INTERVAL(0x1A)
446
 
447
/*
448
 * SA-110 SDRAM Address and Size Register Field Definitions
449
 */
450
#define SA110_SDRAM_SIZE_0                       0x000000000
451
#define SA110_SDRAM_SIZE_1MB                     0x000000001
452
#define SA110_SDRAM_SIZE_2MB                     0x000000002
453
#define SA110_SDRAM_SIZE_4MB                     0x000000003
454
#define SA110_SDRAM_SIZE_8MB                     0x000000004
455
#define SA110_SDRAM_SIZE_16MB                    0x000000005
456
#define SA110_SDRAM_SIZE_32MB                    0x000000006
457
#define SA110_SDRAM_SIZE_64MB                    0x000000007
458
 
459
#define SA110_SDRAM_ADDRESS_MULTIPLEX_MASK       0x000000070
460
#define SA110_SDRAM_ARRAY_BASE_MASK              0x00FF00000
461
 
462
/*
463
 * SA-110 Control Register.
464
 */
465
#define SA110_CONTROL_o                          0x13C
466
 
467
#define SA110_CONTROL                            SA110_REGISTER(SA110_CONTROL_o)
468
 
469
/*
470
 * Control bits.
471
 */
472
#define SA110_CONTROL_INIT_COMPLETE     0x00000001
473
#define SA110_CONTROL_RST_I             0x00000200
474
#define SA110_CONTROL_WATCHDOG          0x00002000
475
#define SA110_CONTROL_CFN               0x80000000
476
 
477
/*
478
 * SA-110 UART Control/Configuration Registers.
479
 */
480
#define SA110_UART_DATA_REGISTER_o               0x160
481
#define SA110_UART_RXSTAT_o                      0x164
482
#define SA110_UART_H_BAUD_CONTROL_o              0x168
483
#define SA110_UART_M_BAUD_CONTROL_o              0x16C
484
#define SA110_UART_L_BAUD_CONTROL_o              0x170
485
#define SA110_UART_CONTROL_REGISTER_o            0x174
486
#define SA110_UART_FLAG_REGISTER_o               0x178
487
 
488
#define SA110_UART_DATA_REGISTER                 SA110_REGISTER(SA110_UART_DATA_REGISTER_o)
489
#define SA110_UART_RXSTAT                        SA110_REGISTER(SA110_UART_RXSTAT_o)
490
#define SA110_UART_H_BAUD_CONTROL                SA110_REGISTER(SA110_UART_H_BAUD_CONTROL_o)
491
#define SA110_UART_M_BAUD_CONTROL                SA110_REGISTER(SA110_UART_M_BAUD_CONTROL_o)
492
#define SA110_UART_L_BAUD_CONTROL                SA110_REGISTER(SA110_UART_L_BAUD_CONTROL_o)
493
#define SA110_UART_CONTROL_REGISTER              SA110_REGISTER(SA110_UART_CONTROL_REGISTER_o)
494
#define SA110_UART_FLAG_REGISTER                 SA110_REGISTER(SA110_UART_FLAG_REGISTER_o)
495
 
496
#define UART_BASE_0                              SA110_UART_DATA_REGISTER
497
 
498
/*
499
 * SA-110 UART Data Register bit masks
500
 */
501
#define SA110_UART_DATA_MASK                     0x000000FF
502
 
503
/*
504
 * SA-110 UART RX Status Register bit masks
505
 */
506
#define SA110_UART_FRAMING_ERROR_MASK            0x00000001
507
#define SA110_UART_PARITY_ERROR_MASK             0x00000002
508
#define SA110_UART_OVERRUN_ERROR_MASK            0x00000004
509
 
510
/*
511
 * SA-110 UART High Baud Control Register bit masks
512
 */
513
#define SA110_UART_BREAK_DISABLED                0x00000000
514
#define SA110_UART_BREAK_ENABLED                 0x00000001
515
#define SA110_UART_BREAK_MASK                    0x00000001
516
#define SA110_UART_PARITY_DISABLED               0x00000000
517
#define SA110_UART_PARITY_ENABLED                0x00000002
518
#define SA110_UART_PARITY_MASK                   0x00000002
519
#define SA110_UART_PARITY_ODD                    0x00000000
520
#define SA110_UART_PARITY_EVEN                   0x00000004
521
#define SA110_UART_ODD_EVEN_SELECT_MASK          0x00000004
522
#define SA110_UART_STOP_BITS_ONE                 0x00000000
523
#define SA110_UART_STOP_BITS_TWO                 0x00000008
524
#define SA110_UART_STOP_BITS_SELECT_MASK         0x00000008
525
#define SA110_UART_FIFO_DISABLED                 0x00000000
526
#define SA110_UART_FIFO_ENABLED                  0x00000010
527
#define SA110_UART_FIFO_ENABLE_MASK              0x00000010
528
#define SA110_UART_DATA_LENGTH_5_BITS            0x00000000
529
#define SA110_UART_DATA_LENGTH_6_BITS            0x00000020
530
#define SA110_UART_DATA_LENGTH_7_BITS            0x00000040
531
#define SA110_UART_DATA_LENGTH_8_BITS            0x00000060
532
#define SA110_UART_DATA_LENGTH_MASK              0x00000060
533
 
534
/*
535
 * SA-110 UART Medium Baud Control Register bit masks
536
 */
537
#define SA110_UART_H_BAUD_RATE_DIVISOR_MASK      0x0000000F
538
 
539
/*
540
 * SA-110 UART Low Baud Control Register bit masks
541
 */
542
#define SA110_UART_L_BAUD_RATE_DIVISOR_MASK      0x000000FF
543
 
544
/*
545
 * SA-110 UART Control Register bit fields
546
 */
547
#define SA110_UART_DISABLED                      0x00000000
548
#define SA110_UART_ENABLED                       0x00000001
549
#define SA110_UART_ENABLE_MASK                   0x00000001
550
#define SA110_SIR_DISABLED                       0x00000000
551
#define SA110_SIR_ENABLED                        0x00000002
552
#define SA110_SIR_ENABLE_MASK                    0x00000002
553
#define SA110_SIR_PULSE_WIDTH_BIT_RATE           0x00000000
554
#define SA110_SIR_PULSE_WIDTH_MAX_CLK            0x00000004
555
 
556
/*
557
 * SA-110 UART Flag Register bit masks
558
 */
559
#define SA110_TX_IDLE                            0x00000000
560
#define SA110_TX_BUSY                            0x00000008
561
#define SA110_TX_BUSY_MASK                       0x00000008
562
#define SA110_RX_FIFO_FULL                       0x00000000
563
#define SA110_RX_FIFO_EMPTY                      0x00000010
564
#define SA110_RX_FIFO_STATUS_MASK                0x00000010
565
#define SA110_TX_FIFO_READY                      0x00000000
566
#define SA110_TX_FIFO_BUSY                       0x00000020
567
#define SA110_TX_FIFO_STATUS_MASK                0x00000020
568
 
569
/*
570
 * SA-110 IRQ Controller Registers
571
 */
572
#define SA110_IRQCONT_IRQSTATUS_o                0x180
573
#define SA110_IRQCONT_IRQRAWSTATUS_o             0x184
574
#define SA110_IRQCONT_IRQENABLE_o                0x188
575
#define SA110_IRQCONT_IRQENABLESET_o             0x188
576
#define SA110_IRQCONT_IRQENABLECLEAR_o           0x18C
577
#define SA110_IRQCONT_IRQSOFT_o                  0x190
578
#define SA110_IRQCONT_FIQSTATUS_o                0x280
579
#define SA110_IRQCONT_FIQRAWSTATUS_o             0x284
580
#define SA110_IRQCONT_FIQENABLE_o                0x288
581
#define SA110_IRQCONT_FIQENABLESET_o             0x288
582
#define SA110_IRQCONT_FIQENABLECLEAR_o           0x28C
583
#define SA110_IRQCONT_FIQSOFT_o                  0x290
584
 
585
#define SA110_IRQCONT_IRQSTATUS                  SA110_REGISTER(SA110_IRQCONT_IRQSTATUS_o)
586
#define SA110_IRQCONT_IRQRAWSTATUS               SA110_REGISTER(SA110_IRQCONT_IRQRAWSTATUS_o)
587
#define SA110_IRQCONT_IRQENABLE                  SA110_REGISTER(SA110_IRQCONT_IRQENABLE_o)
588
#define SA110_IRQCONT_IRQENABLESET               SA110_REGISTER(SA110_IRQCONT_IRQENABLESET_o)
589
#define SA110_IRQCONT_IRQENABLECLEAR             SA110_REGISTER(SA110_IRQCONT_IRQENABLECLEAR_o)
590
#define SA110_IRQCONT_IRQSOFT                    SA110_REGISTER(SA110_IRQCONT_IRQSOFT_o)
591
#define SA110_IRQCONT_FIQSTATUS                  SA110_REGISTER(SA110_IRQCONT_FIQSTATUS_o)
592
#define SA110_IRQCONT_FIQRAWSTATUS               SA110_REGISTER(SA110_IRQCONT_FIQRAWSTATUS_o)
593
#define SA110_IRQCONT_FIQENABLE                  SA110_REGISTER(SA110_IRQCONT_FIQENABLE_o)
594
#define SA110_IRQCONT_FIQENABLESET               SA110_REGISTER(SA110_IRQCONT_FIQENABLESET_o)
595
#define SA110_IRQCONT_FIQENABLECLEAR             SA110_REGISTER(SA110_IRQCONT_FIQENABLECLEAR_o)
596
#define SA110_IRQCONT_FIQSOFT                    SA110_REGISTER(SA110_IRQCONT_FIQSOFT_o)
597
 
598
/*
599
 * SA-110 Timer Control Registers
600
 */
601
#define SA110_TIMER_BASE_o                       0x300
602
#define SA110_TIMER1_BASE_o                      (SA110_TIMER_BASE_o + 0x00)
603
#define SA110_TIMER2_BASE_o                      (SA110_TIMER_BASE_o + 0x20)
604
#define SA110_TIMER3_BASE_o                      (SA110_TIMER_BASE_o + 0x40)
605
#define SA110_TIMER4_BASE_o                      (SA110_TIMER_BASE_o + 0x60)
606
 
607
#define SA110_TIMER1_LOAD_o                      (SA110_TIMER1_BASE_o + 0x0)
608
#define SA110_TIMER1_VALUE_o                     (SA110_TIMER1_BASE_o + 0x4)
609
#define SA110_TIMER1_CONTROL_o                   (SA110_TIMER1_BASE_o + 0x8)
610
#define SA110_TIMER1_CLEAR_o                     (SA110_TIMER1_BASE_o + 0xc)
611
#define SA110_TIMER2_LOAD_o                      (SA110_TIMER2_BASE_o + 0x0)
612
#define SA110_TIMER2_VALUE_o                     (SA110_TIMER2_BASE_o + 0x4)
613
#define SA110_TIMER2_CONTROL_o                   (SA110_TIMER2_BASE_o + 0x8)
614
#define SA110_TIMER2_CLEAR_o                     (SA110_TIMER2_BASE_o + 0xc)
615
#define SA110_TIMER3_LOAD_o                      (SA110_TIMER3_BASE_o + 0x0)
616
#define SA110_TIMER3_VALUE_o                     (SA110_TIMER3_BASE_o + 0x4)
617
#define SA110_TIMER3_CONTROL_o                   (SA110_TIMER3_BASE_o + 0x8)
618
#define SA110_TIMER3_CLEAR_o                     (SA110_TIMER3_BASE_o + 0xc)
619
#define SA110_TIMER4_LOAD_o                      (SA110_TIMER4_BASE_o + 0x0)
620
#define SA110_TIMER4_VALUE_o                     (SA110_TIMER4_BASE_o + 0x4)
621
#define SA110_TIMER4_CONTROL_o                   (SA110_TIMER4_BASE_o + 0x8)
622
#define SA110_TIMER4_CLEAR_o                     (SA110_TIMER4_BASE_o + 0xc)
623
 
624
#define SA110_TIMER1_LOAD                        SA110_REGISTER(SA110_TIMER1_LOAD_o)
625
#define SA110_TIMER1_VALUE                       SA110_REGISTER(SA110_TIMER1_VALUE_o)
626
#define SA110_TIMER1_CONTROL                     SA110_REGISTER(SA110_TIMER1_CONTROL_o)
627
#define SA110_TIMER1_CLEAR                       SA110_REGISTER(SA110_TIMER1_CLEAR_o)
628
#define SA110_TIMER2_LOAD                        SA110_REGISTER(SA110_TIMER2_LOAD_o)
629
#define SA110_TIMER2_VALUE                       SA110_REGISTER(SA110_TIMER2_VALUE_o)
630
#define SA110_TIMER2_CONTROL                     SA110_REGISTER(SA110_TIMER2_CONTROL_o)
631
#define SA110_TIMER2_CLEAR                       SA110_REGISTER(SA110_TIMER2_CLEAR_o)
632
#define SA110_TIMER3_LOAD                        SA110_REGISTER(SA110_TIMER3_LOAD_o)
633
#define SA110_TIMER3_VALUE                       SA110_REGISTER(SA110_TIMER3_VALUE_o)
634
#define SA110_TIMER3_CONTROL                     SA110_REGISTER(SA110_TIMER3_CONTROL_o)
635
#define SA110_TIMER3_CLEAR                       SA110_REGISTER(SA110_TIMER3_CLEAR_o)
636
#define SA110_TIMER4_LOAD                        SA110_REGISTER(SA110_TIMER4_LOAD_o)
637
#define SA110_TIMER4_VALUE                       SA110_REGISTER(SA110_TIMER4_VALUE_o)
638
#define SA110_TIMER4_CONTROL                     SA110_REGISTER(SA110_TIMER4_CONTROL_o)
639
#define SA110_TIMER4_CLEAR                       SA110_REGISTER(SA110_TIMER4_CLEAR_o)
640
 
641
/* Timer bits */
642
#define SA110_TIMER_CONTROL_SCALE_1              0x00000000
643
#define SA110_TIMER_CONTROL_SCALE_16             0x00000004
644
#define SA110_TIMER_CONTROL_SCALE_256            0x00000008
645
#define SA110_TIMER_CONTROL_SCALE_EXT            0x0000000c
646
#define SA110_TIMER_CONTROL_MODE                 0x00000040
647
#define SA110_TIMER_CONTROL_ENABLE               0x00000080
648
 
649
/*
650
 * IRQ Controller IRQ Numbers
651
 */
652
#define SA110_IRQ_MIN                            0
653
 
654
#define SA110_IRQ_RSV0                           0
655
#define SA110_IRQ_SOFT_INTERRUPT                 1
656
#define SA110_IRQ_CONSOLE_RX                     2
657
#define SA110_IRQ_CONSOLE_TX                     3
658
#define SA110_IRQ_TIMER_1                        4
659
#define SA110_IRQ_TIMER_2                        5
660
#define SA110_IRQ_TIMER_3                        6
661
#define SA110_IRQ_TIMER_4                        7
662
#define SA110_IRQ_IRQ_IN_I_0                     8
663
#define SA110_IRQ_IRQ_IN_I_1                     9
664
#define SA110_IRQ_IRQ_IN_I_2                     10
665
#define SA110_IRQ_IRQ_IN_I_3                     11
666
#define SA110_IRQ_XCS_I_0                        12
667
#define SA110_IRQ_XCS_I_1                        13
668
#define SA110_IRQ_XCS_I_2                        14
669
#define SA110_IRQ_DOORBELL_FROM_HOST             15
670
#define SA110_IRQ_DMA_CHAN_1                     16
671
#define SA110_IRQ_DMA_CHAN_2                     17
672
#define SA110_IRQ_PIC_IRQ_I                      18
673
#define SA110_IRQ_PMCSR_WRITE_BY_HOST            19
674
#define SA110_IRQ_RSV1                           20
675
#define SA110_IRQ_RSV2                           21
676
#define SA110_IRQ_START_BIST                     22
677
#define SA110_IRQ_RECEIVED_SERR                  23
678
#define SA110_IRQ_SDRAM_PARITY                   24
679
#define SA110_IRQ_I20_INBOUND_POST_LIST          25
680
#define SA110_IRQ_RSV3                           26
681
#define SA110_IRQ_DISCARD_TIMER_EXPIRED          27
682
#define SA110_IRQ_DATA_PARITY_ERROR              28
683
#define SA110_IRQ_MASTER_ABORT                   29
684
#define SA110_IRQ_TARGET_ABORT                   30
685
#define SA110_IRQ_PARITY_ERROR                   31
686
 
687
#define SA110_IRQ_MAX                            31
688
#define NUM_SA110_INTERRUPTS                     SA110_IRQ_MAX - SA110_IRQ_MIN + 1
689
#define SA110_IRQ_INTSRC_MASK(irq_nr)            (1 << (irq_nr))
690
 
691
 
692
/*
693
 * SA110 IRQSOFT/FIQSOFT Register bit fields
694
 */
695
#define SA110_IRQSOFT_RAW_BIT_MASK               0x00000001
696
 
697
/*
698
 * SA-110 Miscellaneous Registers.
699
 */
700
#define SA110_XBUS_CYCLE_ARBITER_o               0x148
701
#define SA110_XBUS_IO_STROBE_MASK_o              0x14c
702
 
703
#define SA110_XBUS_CYCLE_ARBITER                 SA110_REGISTER(SA110_XBUS_CYCLE_ARBITER_o)
704
#define SA110_XBUS_IO_STROBE_MASK                SA110_REGISTER(SA110_XBUS_IO_STROBE_MASK_o)
705
 
706
#define SA110_XBUS_CYCLE_ARBITER_ENABLED         0x00800000
707
 
708
#define SA110_XBUS_XCS2                          0x40012000
709
#define SA110_XBUS_XCS2_PCI_DISABLE              0x40
710
 
711
// -------------------------------------------------------------------------
712
// MMU initialization:
713
// 
714
// These structures are laid down in memory to define the translation
715
// table.  For usage, see the memory setup in ebsa285_misc.c in this
716
// component.  hal_bsp_mmu_init()
717
// 
718
 
719
/*
720
 * SA-1100 Translation Table Base Bit Masks */
721
#define ARM_TRANSLATION_TABLE_MASK               0xFFFFC000
722
 
723
/*
724
 * SA-1100 Domain Access Control Bit Masks
725
 */
726
#define ARM_ACCESS_TYPE_NO_ACCESS(domain_num)    (0x0 << (domain_num)*2)
727
#define ARM_ACCESS_TYPE_CLIENT(domain_num)       (0x1 << (domain_num)*2)
728
#define ARM_ACCESS_TYPE_MANAGER(domain_num)      (0x3 << (domain_num)*2)
729
 
730
// These are only useful in C, so:
731
#ifndef  __ASSEMBLER__
732
 
733
struct ARM_MMU_FIRST_LEVEL_FAULT {
734
    int id : 2;
735
    int sbz : 30;
736
};
737
#define ARM_MMU_FIRST_LEVEL_FAULT_ID 0x0
738
 
739
struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE {
740
    int id : 2;
741
    int imp : 2;
742
    int domain : 4;
743
    int sbz : 1;
744
    int base_address : 23;
745
};
746
#define ARM_MMU_FIRST_LEVEL_PAGE_TABLE_ID 0x1
747
 
748
struct ARM_MMU_FIRST_LEVEL_SECTION {
749
    int id : 2;
750
    int b : 1;
751
    int c : 1;
752
    int imp : 1;
753
    int domain : 4;
754
    int sbz0 : 1;
755
    int ap : 2;
756
    int sbz1 : 8;
757
    int base_address : 12;
758
};
759
#define ARM_MMU_FIRST_LEVEL_SECTION_ID 0x2
760
 
761
struct ARM_MMU_FIRST_LEVEL_RESERVED {
762
    int id : 2;
763
    int sbz : 30;
764
};
765
#define ARM_MMU_FIRST_LEVEL_RESERVED_ID 0x3
766
 
767
#define ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, table_index) \
768
   (unsigned long *)((unsigned long)(ttb_base) + ((table_index) << 2))
769
 
770
#define ARM_MMU_SECTION(ttb_base, actual_base, virtual_base,              \
771
                        cacheable, bufferable, perm)                      \
772
    CYG_MACRO_START                                                       \
773
        register union ARM_MMU_FIRST_LEVEL_DESCRIPTOR desc;               \
774
                                                                          \
775
        desc.word = 0;                                                    \
776
        desc.section.id = ARM_MMU_FIRST_LEVEL_SECTION_ID;                 \
777
        desc.section.domain = 0;                                          \
778
        desc.section.c = (cacheable);                                     \
779
        desc.section.b = (bufferable);                                    \
780
        desc.section.ap = (perm);                                         \
781
        desc.section.base_address = (actual_base);                        \
782
        *ARM_MMU_FIRST_LEVEL_DESCRIPTOR_ADDRESS(ttb_base, (virtual_base)) \
783
                            = desc.word;                                  \
784
    CYG_MACRO_END
785
 
786
union ARM_MMU_FIRST_LEVEL_DESCRIPTOR {
787
    unsigned long word;
788
    struct ARM_MMU_FIRST_LEVEL_FAULT fault;
789
    struct ARM_MMU_FIRST_LEVEL_PAGE_TABLE page_table;
790
    struct ARM_MMU_FIRST_LEVEL_SECTION section;
791
    struct ARM_MMU_FIRST_LEVEL_RESERVED reserved;
792
};
793
 
794
#endif /* __ASSEMBLER__ */
795
 
796
#define ARM_UNCACHEABLE                         0
797
#define ARM_CACHEABLE                           1
798
#define ARM_UNBUFFERABLE                        0
799
#define ARM_BUFFERABLE                          1
800
 
801
#define ARM_ACCESS_PERM_NONE_NONE               0
802
#define ARM_ACCESS_PERM_RO_NONE                 0
803
#define ARM_ACCESS_PERM_RO_RO                   0
804
#define ARM_ACCESS_PERM_RW_NONE                 1
805
#define ARM_ACCESS_PERM_RW_RO                   2
806
#define ARM_ACCESS_PERM_RW_RW                   3
807
 
808
 
809
/*---------------------------------------------------------------------------*/
810
/* end of hal_ebsa285.h                                                         */
811
#endif /* CYGONCE_HAL_EBSA285_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.