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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [ebsa285/] [current/] [include/] [hal_ebsa285.h] - Blame information for rev 786

Details | Compare with Previous | View Log

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