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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-or32/] [board.h] - Blame information for rev 1276

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

Line No. Rev Author Line
1 1276 phoenix
#ifndef _OR32_BOARH_H
2
#define _OR32_BOARH_H 
3
 
4
#include <linux/config.h>
5
 
6
/* System clock frequecy */
7
#define SYS_CLK         (CONFIG_OR32_SYS_CLK*1000000)
8
#define SYS_CLK_PERIOD  (1000/CONFIG_OR32_SYS_CLK)
9
 
10
/* Memory organization */
11
#define SRAM_BASE_ADD   0x00000000
12
#define FLASH_BASE_ADD  0xf0000000
13
 
14
/* Devices base address */
15
#define UART_BASE_ADD   0x90000000
16
#define MC_BASE_ADD     0x93000000
17
#define CRT_BASE_ADD    0x97000000
18
#define FBMEM_BASE_ADD  0xa8000000
19
#define ETH_BASE_ADD    0x92000000
20
#define KBD_BASE_ADD    0x94000000
21
 
22
/* Define this if you want to use I and/or D cache */
23
#define IC_SIZE         CONFIG_OR32_IC_SIZE
24
#define IC_LINE         CONFIG_OR32_IC_LINE
25
#define DC_SIZE         CONFIG_OR32_DC_SIZE
26
#define DC_LINE         CONFIG_OR32_DC_LINE
27
 
28
/* Define this if you want to use I and/or D MMU */
29
 
30
#define DMMU_SET_NB     CONFIG_OR32_DTLB_ENTRIES
31
#define IMMU_SET_NB     CONFIG_OR32_ITLB_ENTRIES
32
 
33
/* Define this if you are using MC */
34
#define MC_INIT         CONFIG_OR32_MC_INIT
35
 
36
/* Uart definitions */
37
#define UART_DLL        0       /* Out: Divisor Latch Low (DLAB=1) */
38
#define UART_DLM        1       /* Out: Divisor Latch High (DLAB=1) */
39
 
40
#define OR32_CONSOLE_BAUD  115200
41
#define UART_DEVISOR       SYS_CLK/(16*OR32_CONSOLE_BAUD)
42
 
43
#define N_CE        (8)
44
 
45
#define MC_CSR      (0x00)
46
#define MC_POC      (0x04)
47
#define MC_BA_MASK  (0x08)
48
#define MC_CSC(i)   (0x10 + (i) * 8)
49
#define MC_TMS(i)   (0x14 + (i) * 8)
50
 
51
// move it into seperate file
52
#if CONFIG_OR32_MC_VERSION==2
53
#ifdef CONFIG_OR32_HIGHLAND_DEFAULT_MEMORY_TIMINGS
54
/* FLASH timings: worst cases in ns, from data sheets */
55
#  define FLASH_WA_TIME           50 /* write access*/
56
#  define FLASH_WE_DELAY          0  /* write enable*/
57
#  define FLASH_WH_TIME           0  /* write hold */
58
#  define FLASH_RA_TIME           95 /* read access*/
59
#  define FLASH_PRA_TIME          25 /* page read access time */
60
#  define FLASH_RT_TIME           24 /* read turnaround time */
61
 
62
/* SDRAM timings: worst cases in ns, from data sheets */
63
#  define SDRAM_tRCD              23
64
#  define SDRAM_tWR               20
65
#  define SDRAM_tRC               60
66
#  define SDRAM_tRFC              60 /* sometimes the same as tRC */
67
#  define SDRAM_tRAS              50 /* use the worst case minimal value */
68
#  define SDRAM_tRP               23
69
#  define SDRAM_tRRD              15
70
#  define SDRAM_tREF              ((64000000/8192)+1)
71
#elif CONFIG_OR32_GENERIC_MEMORY_TIMINGS
72
/* FLASH timings: worst cases in ns, from data sheets */
73
#  define FLASH_WA_TIME           CONFIG_OR32_FLASH_WA_TIME
74
#  define FLASH_WE_DELAY          CONFIG_OR32_FLASH_WE_DELAY
75
#  define FLASH_WH_TIME           CONFIG_OR32_FLASH_WH_TIME
76
#  define FLASH_RA_TIME           CONFIG_OR32_FLASH_RA_TIME
77
#  define FLASH_PRA_TIME          CONFIG_OR32_FLASH_PRA_TIME
78
#  define FLASH_RT_TIME           CONFIG_OR32_FLASH_RT_TIME
79
 
80
/* SDRAM timings: worst cases in ns, from data sheets */
81
#  define SDRAM_tRCD              CONFIG_OR32_SDRAM_tRCD
82
#  define SDRAM_tWR               CONFIG_OR32_SDRAM_tWR
83
#  define SDRAM_tRC               CONFIG_OR32_SDRAM_tRC
84
#  define SDRAM_tRFC              CONFIG_OR32_SDRAM_tRFC
85
#  define SDRAM_tRAS              CONFIG_OR32_SDRAM_tRAS
86
#  define SDRAM_tRP               CONFIG_OR32_SDRAM_tRP
87
#  define SDRAM_tRRD              CONFIG_OR32_SDRAM_tRRD
88
#  define SDRAM_tREF              CONFIG_OR32_SDRAM_tREF
89
#else
90
#  error "no timings defined"
91
#endif
92
#endif
93
 
94
#if CONFIG_OR32_MC_VERSION==1
95
/* Memory controller initialize values */
96
#  if CONFIG_OR32_SYS_CLK==25
97
#    define MC_CSR_VAL      0x0B000300
98
#    define MC_MASK_VAL     0x000003f0
99
#    define FLASH_TMS_VAL   0x00000103
100
#    define SDRAM_BASE_ADD  0x00000000
101
#    define SDRAM_TMS_VAL   0x19220057
102
#  elif CONFIG_OR32_SYS_CLK==100
103
#    define MC_CSR_VAL      0x0B000300
104
#    define MC_MASK_VAL     0x000003f0
105
#    define FLASH_TMS_VAL   0x0000010c
106
#    define SDRAM_BASE_ADD  0x00000000
107
#    define SDRAM_TMS_VAL   0x2a5a0300
108
#  elif CONFIG_OR32_SYS_CLK==120
109
     /* Sandi guarantees timings are ok */
110
#    define MC_CSR_VAL      0x0B000300
111
#    define MC_MASK_VAL     0x000003f0
112
#    define FLASH_TMS_VAL   0x0000010c
113
#    define SDRAM_BASE_ADD  0x00000000
114
#    define SDRAM_TMS_VAL   0x2a5a0300
115
#  else
116
#    error  No MC ver. 1 initialization values for this frequency
117
#  endif
118
#elif CONFIG_OR32_MC_VERSION==2
119
 
120
#  define FLASH_BAR_VAL   FLASH_BASE_ADD
121
#  define FLASH_AMR_VAL   0xf0000000     /* address mask register */
122
#  define SDRAM_BASE_ADDR 0x00000000
123
#  define SDRAM_SIZE      0x02000000
124
#  define SDRAM_BAR_VAL   SDRAM_BASE_ADDR
125
#  define SDRAM_AMR_VAL   (~(SDRAM_SIZE-1))
126
 
127
/* independant from flash properties, always 0 ;)   */
128
#  define FLASH_OE_DELAY  0              /* output enable */
129
 
130
// define FLASH_WTR_VAL   0x00011009 /* write timings */
131
#  define FLASH_WTR_VAL   ((0x000003ff & (FLASH_WA_TIME /SYS_CLK_PERIOD)) | \
132
                           (0x0000f000 & (FLASH_WE_DELAY/SYS_CLK_PERIOD)) | \
133
                           (0x001f0000 & (FLASH_WH_TIME /SYS_CLK_PERIOD)))
134
 
135
// define FLASH_RTR_VAL   0x01002009 /* read timings */
136
#  define FLASH_RTR_VAL   ((0x000003ff & (FLASH_RA_TIME /SYS_CLK_PERIOD)) | \
137
                           (0x0000f000 & (FLASH_OE_DELAY/SYS_CLK_PERIOD)) | \
138
                           (0x001f0000 & (FLASH_PRA_TIME/SYS_CLK_PERIOD)) | \
139
                           (0x1f000000 & (FLASH_RT_TIME /SYS_CLK_PERIOD)))
140
 
141
/* round this value down:
142
 * if it's 30 / 10 -> we want 2, so it's ok, 31 / 10 -> we want 3
143
 *
144
 * define SDRAM_RCDR_VAL  0x00000002
145
 */
146
#  define SDRAM_RCDR_VAL  ((SDRAM_tRCD-1)/SYS_CLK_PERIOD)
147
 
148
// prviously undefined
149
#  define SDRAM_WRTR_VAL  ((SDRAM_tWR+(SYS_CLK_PERIOD-1)/SYS_CLK_PERIOD)-2)
150
#  if SDRAM_WRTR_VAL<0
151
#    undef  SDRAM_WRTR_VAL
152
#    define SDRAM_WRTR_VAL 0
153
#  endif
154
 
155
// define SDRAM_RCTR_VAL  0x00000006
156
#  define SDRAM_RCTR_VAL  ((SDRAM_tRC+(SYS_CLK_PERIOD-1)/SYS_CLK_PERIOD)-2)
157
#  if SDRAM_RCTR_VAL<0
158
#    undef  SDRAM_RCTR_VAL
159
#    define SDRAM_RCTR_VAL 0
160
#  endif
161
 
162
// define SDRAM_REFCTR_VAL 0x00000006
163
#  define SDRAM_REFCTR_VAL ((SDRAM_tRFC+(SYS_CLK_PERIOD-1)/SYS_CLK_PERIOD)-2)
164
#  if SDRAM_REFCTR_VAL<0
165
#    undef  SDRAM_REFCTR_VAL
166
#    define SDRAM_REFCTR_VAL 0
167
#  endif
168
 
169
// define SDRAM_RATR_VAL  0x00000006
170
#  define SDRAM_RATR_VAL  ((SDRAM_tRAS+(SYS_CLK_PERIOD-1)/SYS_CLK_PERIOD)-2)
171
#  if SDRAM_RATR_VAL<0
172
#    undef  SDRAM_RATR_VAL
173
#    define SDRAM_RATR_VAL 0
174
#  endif
175
 
176
// define SDRAM_PTR_VAL   0x00000001
177
#  define SDRAM_PTR_VAL   (((SDRAM_tRP+(SYS_CLK_PERIOD-1))/SYS_CLK_PERIOD)-2)
178
#  if SDRAM_PTR_VAL<0
179
#    undef  SDRAM_PTR_VAL
180
#    define SDRAM_PTR_VAL 0
181
#  endif
182
 
183
// define SDRAM_RRDR_VAL  0x00000000
184
#  define SDRAM_RRDR_VAL  (((SDRAM_tRRD+(SYS_CLK_PERIOD-1))/SYS_CLK_PERIOD)-2)
185
#  if SDRAM_RRDR_VAL<0
186
#    undef  SDRAM_RRDR_VAL
187
#    define SDRAM_RRDR_VAL 0
188
#  endif
189
 
190
/*
191
 * we don't want to go to the edge with refresh delays
192
 * define SDRAM_RIR_VAL   0x00000300
193
 */
194
#  define SDRAM_RIR_VAL   ((SDRAM_tREF/SYS_CLK_PERIOD)-((SDRAM_tREF/SYS_CLK_PERIOD)+10)/10)
195
 
196
 
197
#  define MC_BAR_0        (0x00)
198
#  define MC_AMR_0        (0x04)
199
#  define MC_BAR_1        (0x08)
200
#  define MC_AMR_1        (0x0c)
201
#  define MC_BAR_2        (0x10)
202
#  define MC_AMR_2        (0x14)
203
#  define MC_BAR_3        (0x18)
204
#  define MC_AMR_3        (0x1c)
205
#  define MC_CCR_0        (0x20)
206
#  define MC_CCR_1        (0x24)
207
#  define MC_CCR_2        (0x28)
208
#  define MC_CCR_3        (0x2c)
209
#  define MC_WTR_0        (0x30)
210
#  define MC_RTR_0        (0x34)
211
#  define MC_WTR_1        (0x38)
212
#  define MC_RTR_1        (0x3c)
213
#  define MC_WTR_2        (0x40)
214
#  define MC_RTR_2        (0x44)
215
#  define MC_WTR_3        (0x48)
216
#  define MC_RTR_3        (0x4c)
217
 
218
#  define MC_BAR_4        (0x80)
219
#  define MC_AMR_4        (0x84)
220
#  define MC_BAR_5        (0x88)
221
#  define MC_AMR_5        (0x8c)
222
#  define MC_BAR_6        (0x90)
223
#  define MC_AMR_6        (0x94)
224
#  define MC_BAR_7        (0x98)
225
#  define MC_AMR_7        (0x9c)
226
#  define MC_CCR_4        (0xa0)
227
#  define MC_CCR_5        (0xa4)
228
#  define MC_CCR_6        (0xa8)
229
#  define MC_CCR_7        (0xac)
230
 
231
#  define MC_RATR         (0xb0)  /* row active time register  */
232
#  define MC_RCTR         (0xb4)
233
#  define MC_RRDR         (0xb8)
234
#  define MC_PTR          (0xbc)
235
#  define MC_WRTR         (0xc0)
236
#  define MC_REFCTR       (0xc4)
237
#  define MC_RCDR         (0xc8)
238
#  define MC_RIR          (0xcc)
239
#  define MC_SMBOR        (0xe0)
240
#  define MC_ORR          (0xe4)
241
#  define MC_OSR          (0xe8)
242
#  define MC_PCR          (0xec)
243
#  define MC_IIR          (0xf0)
244
 
245
/* POC register field definition */
246
#  define MC_POC_EN_BW_OFFSET             0
247
#  define MC_POC_EN_BW_WIDTH              2
248
#  define MC_POC_EN_MEMTYPE_OFFSET        2
249
#  define MC_POC_EN_MEMTYPE_WIDTH         2
250
 
251
/* CSC register field definition */
252
#  define MC_CSC_EN_OFFSET                0
253
#  define MC_CSC_MEMTYPE_OFFSET           1
254
#  define MC_CSC_MEMTYPE_WIDTH            2
255
#  define MC_CSC_BW_OFFSET                4
256
#  define MC_CSC_BW_WIDTH                 2
257
#  define MC_CSC_MS_OFFSET                6
258
#  define MC_CSC_MS_WIDTH                 2
259
#  define MC_CSC_WP_OFFSET                8
260
#  define MC_CSC_BAS_OFFSET               9
261
#  define MC_CSC_KRO_OFFSET               10
262
#  define MC_CSC_PEN_OFFSET               11
263
#  define MC_CSC_SEL_OFFSET               16
264
#  define MC_CSC_SEL_WIDTH                8
265
 
266
#  define MC_CSC_MEMTYPE_SDRAM            0
267
#  define MC_CSC_MEMTYPE_SSRAM            1
268
#  define MC_CSC_MEMTYPE_ASYNC            2
269
#  define MC_CSC_MEMTYPE_SYNC             3
270
 
271
#  define MC_CSR_VALID                    0xFF000703LU
272
#  define MC_POC_VALID                    0x0000000FLU
273
#  define MC_BA_MASK_VALID                0x000003FFLU
274
#  define MC_CSC_VALID                    0x00FF0FFFLU
275
#  define MC_TMS_SDRAM_VALID              0x0FFF83FFLU
276
#  define MC_TMS_SSRAM_VALID              0x00000000LU
277
#  define MC_TMS_ASYNC_VALID              0x03FFFFFFLU
278
#  define MC_TMS_SYNC_VALID               0x01FFFFFFLU
279
#  define MC_TMS_VALID                    0xFFFFFFFFLU /* reg test compat. */
280
 
281
/* TMS register field definition SDRAM */
282
#  define MC_TMS_SDRAM_TRFC_OFFSET        24
283
#  define MC_TMS_SDRAM_TRFC_WIDTH         4
284
#  define MC_TMS_SDRAM_TRP_OFFSET         20
285
#  define MC_TMS_SDRAM_TRP_WIDTH          4
286
#  define MC_TMS_SDRAM_TRCD_OFFSET        17
287
#  define MC_TMS_SDRAM_TRCD_WIDTH         4
288
#  define MC_TMS_SDRAM_TWR_OFFSET         15
289
#  define MC_TMS_SDRAM_TWR_WIDTH          2
290
#  define MC_TMS_SDRAM_WBL_OFFSET         9
291
#  define MC_TMS_SDRAM_OM_OFFSET          7
292
#  define MC_TMS_SDRAM_OM_WIDTH           2
293
#  define MC_TMS_SDRAM_CL_OFFSET          4
294
#  define MC_TMS_SDRAM_CL_WIDTH           3
295
#  define MC_TMS_SDRAM_BT_OFFSET          3
296
#  define MC_TMS_SDRAM_BL_OFFSET          0
297
#  define MC_TMS_SDRAM_BL_WIDTH           3
298
 
299
/* TMS register field definition ASYNC */
300
#  define MC_TMS_ASYNC_TWWD_OFFSET        20
301
#  define MC_TMS_ASYNC_TWWD_WIDTH         6
302
#  define MC_TMS_ASYNC_TWD_OFFSET         16
303
#  define MC_TMS_ASYNC_TWD_WIDTH          4
304
#  define MC_TMS_ASYNC_TWPW_OFFSET        12
305
#  define MC_TMS_ASYNC_TWPW_WIDTH         4
306
#  define MC_TMS_ASYNC_TRDZ_OFFSET        8
307
#  define MC_TMS_ASYNC_TRDZ_WIDTH         4
308
#  define MC_TMS_ASYNC_TRDV_OFFSET        0
309
#  define MC_TMS_ASYNC_TRDV_WIDTH         8
310
 
311
/* TMS register field definition SYNC  */
312
#  define MC_TMS_SYNC_TTO_OFFSET          16
313
#  define MC_TMS_SYNC_TTO_WIDTH           9
314
#  define MC_TMS_SYNC_TWR_OFFSET          12
315
#  define MC_TMS_SYNC_TWR_WIDTH           4
316
#  define MC_TMS_SYNC_TRDZ_OFFSET         8
317
#  define MC_TMS_SYNC_TRDZ_WIDTH          4
318
#  define MC_TMS_SYNC_TRDV_OFFSET         0
319
#  define MC_TMS_SYNC_TRDV_WIDTH          8
320
 
321
#else
322
#  error "no memory controler specified"
323
#endif
324
 
325
 
326
/* Define ethernet MAC address */
327
#define MACADDR0        0x00
328
#define MACADDR1        0x01
329
#define MACADDR2        0x02
330
#define MACADDR3        0x03
331
#define MACADDR4        0x04
332
#define MACADDR5        0x05
333
 
334
#endif
335
 

powered by: WebSVN 2.1.0

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