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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [include/] [mc-init-2.h] - Blame information for rev 792

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

Line No. Rev Author Line
1 2 marcus.erl
#ifndef _MC_INIT_2_H_
2
#define _MC_INIT_2_H_
3
 
4
/* clock period in [ns] */
5
#define SYS_CLK_PERIOD    (1000000000/IN_CLK)
6
 
7
/* FLASH timings: worst cases in ns, from data sheets */
8
#  define FLASH_WA_TIME   150 /* write access*/
9
#  define FLASH_WE_DELAY  30  /* write enable*/
10
#  define FLASH_WH_TIME   0   /* write hold */
11
#  define FLASH_RA_TIME   150 /* read access*/
12
#  define FLASH_PRA_TIME  25  /* page read access time */
13
#  define FLASH_RT_TIME   35  /* read turnaround time */
14
 
15
/* SDRAM timings: worst cases in ns, from data sheets */
16
#  define SDRAM_tRCD      23
17
#  define SDRAM_tWR       20
18
#  define SDRAM_tRC       60
19
#  define SDRAM_tRFC      60 /* sometimes the same as tRC */
20
#  define SDRAM_tRAS      50 /* use the worst case minimal value */
21
#  define SDRAM_tRP       23
22
#  define SDRAM_tRRD      15
23
#  define SDRAM_tREF      ((64000000/8192)+1)
24
 
25
#  define FLASH_BAR_VAL   FLASH_BASE_ADDR
26
#  define FLASH_AMR_VAL   (~(FLASH_SIZE-1))     /* address mask register */
27
#  define SDRAM_BASE_ADDR 0x00000000
28
#  define SDRAM_SIZE      0x02000000
29
#  define SDRAM_BAR_VAL   SDRAM_BASE_ADDR
30
#  define SDRAM_AMR_VAL   (~(SDRAM_SIZE-1))
31
 
32
/* independant from flash properties, always 0 ;)   */
33
#  define FLASH_OE_DELAY  0              /* output enable */
34
#  define FLASH_OE_VAL    ((FLASH_OE_DELAY+(SYS_CLK_PERIOD-1))/SYS_CLK_PERIOD)
35
 
36
// define FLASH_WTR_VAL   0x00011009 /* write timings */
37
#  define FLASH_WTR_VAL   ((0x000003ff & ((FLASH_WA_TIME-1) /SYS_CLK_PERIOD)) | \
38
                           (0x0000f000 & ((FLASH_WE_DELAY-1)/SYS_CLK_PERIOD)) | \
39
                           (0x001f0000 & ((FLASH_WH_TIME)   /SYS_CLK_PERIOD)))
40
 
41
// define FLASH_RTR_VAL   0x01002009 /* read timings */
42
#  define FLASH_RTR_VAL   ((0x000003ff & ((FLASH_RA_TIME-1) /SYS_CLK_PERIOD)) | \
43
                           (0x0000f000 &  (FLASH_OE_VAL                    )) | \
44
                           (0x001f0000 & ((FLASH_PRA_TIME-1)/SYS_CLK_PERIOD)) | \
45
                           (0x1f000000 & ((FLASH_RT_TIME-1  /SYS_CLK_PERIOD))))
46
 
47
/* round this value down:
48
 * if it's 30 / 10 -> we want 2, so it's ok, 31 / 10 -> we want 3
49
 *
50
 * define SDRAM_RCDR_VAL  0x00000002
51
 */
52
#  define SDRAM_RCDR_VAL  ((SDRAM_tRCD-1)/SYS_CLK_PERIOD)
53
 
54
// prviously undefined
55
#  define SDRAM_WRTR_VAL  ((SDRAM_tWR+(SYS_CLK_PERIOD-1)/SYS_CLK_PERIOD)-2)
56
#  if SDRAM_WRTR_VAL<0
57
#    undef  SDRAM_WRTR_VAL
58
#    define SDRAM_WRTR_VAL 0
59
#  endif
60
 
61
// define SDRAM_RCTR_VAL  0x00000006
62
#  define SDRAM_RCTR_VAL  ((SDRAM_tRC+(SYS_CLK_PERIOD-1)/SYS_CLK_PERIOD)-2)
63
#  if SDRAM_RCTR_VAL<0
64
#    undef  SDRAM_RCTR_VAL
65
#    define SDRAM_RCTR_VAL 0
66
#  endif
67
 
68
// define SDRAM_REFCTR_VAL 0x00000006
69
#  define SDRAM_REFCTR_VAL ((SDRAM_tRFC+(SYS_CLK_PERIOD-1)/SYS_CLK_PERIOD)-2)
70
#  if SDRAM_REFCTR_VAL<0
71
#    undef  SDRAM_REFCTR_VAL
72
#    define SDRAM_REFCTR_VAL 0
73
#  endif
74
 
75
// define SDRAM_RATR_VAL  0x00000006
76
#  define SDRAM_RATR_VAL  ((SDRAM_tRAS+(SYS_CLK_PERIOD-1)/SYS_CLK_PERIOD)-2)
77
#  if SDRAM_RATR_VAL<0
78
#    undef  SDRAM_RATR_VAL
79
#    define SDRAM_RATR_VAL 0
80
#  endif
81
 
82
// define SDRAM_PTR_VAL   0x00000001
83
#  define SDRAM_PTR_VAL   (((SDRAM_tRP+(SYS_CLK_PERIOD-1))/SYS_CLK_PERIOD)-2)
84
#  if SDRAM_PTR_VAL<0
85
#    undef  SDRAM_PTR_VAL
86
#    define SDRAM_PTR_VAL 0
87
#  endif
88
 
89
// define SDRAM_RRDR_VAL  0x00000000
90
#  define SDRAM_RRDR_VAL  (((SDRAM_tRRD+(SYS_CLK_PERIOD-1))/SYS_CLK_PERIOD)-2)
91
#  if SDRAM_RRDR_VAL<0
92
#    undef  SDRAM_RRDR_VAL
93
#    define SDRAM_RRDR_VAL 0
94
#  endif
95
 
96
/*
97
 * we don't want to go to the edge with refresh delays
98
 * define SDRAM_RIR_VAL   0x00000300
99
 */
100
#  define SDRAM_RIR_VAL   ((SDRAM_tREF/SYS_CLK_PERIOD)-((SDRAM_tREF/SYS_CLK_PERIOD)+10)/10)
101
 
102
 
103
#  define MC_BAR_0        (0x00)
104
#  define MC_AMR_0        (0x04)
105
#  define MC_BAR_1        (0x08)
106
#  define MC_AMR_1        (0x0c)
107
#  define MC_BAR_2        (0x10)
108
#  define MC_AMR_2        (0x14)
109
#  define MC_BAR_3        (0x18)
110
#  define MC_AMR_3        (0x1c)
111
#  define MC_CCR_0        (0x20)
112
#  define MC_CCR_1        (0x24)
113
#  define MC_CCR_2        (0x28)
114
#  define MC_CCR_3        (0x2c)
115
#  define MC_WTR_0        (0x30)
116
#  define MC_RTR_0        (0x34)
117
#  define MC_WTR_1        (0x38)
118
#  define MC_RTR_1        (0x3c)
119
#  define MC_WTR_2        (0x40)
120
#  define MC_RTR_2        (0x44)
121
#  define MC_WTR_3        (0x48)
122
#  define MC_RTR_3        (0x4c)
123
 
124
#  define MC_BAR_4        (0x80)
125
#  define MC_AMR_4        (0x84)
126
#  define MC_BAR_5        (0x88)
127
#  define MC_AMR_5        (0x8c)
128
#  define MC_BAR_6        (0x90)
129
#  define MC_AMR_6        (0x94)
130
#  define MC_BAR_7        (0x98)
131
#  define MC_AMR_7        (0x9c)
132
#  define MC_CCR_4        (0xa0)
133
#  define MC_CCR_5        (0xa4)
134
#  define MC_CCR_6        (0xa8)
135
#  define MC_CCR_7        (0xac)
136
 
137
#  define MC_RATR         (0xb0)  /* row active time register  */
138
#  define MC_RCTR         (0xb4)
139
#  define MC_RRDR         (0xb8)
140
#  define MC_PTR          (0xbc)
141
#  define MC_WRTR         (0xc0)
142
#  define MC_REFCTR       (0xc4)
143
#  define MC_RCDR         (0xc8)
144
#  define MC_RIR          (0xcc)
145
#  define MC_SMBOR        (0xe0)
146
#  define MC_ORR          (0xe4)
147
#  define MC_OSR          (0xe8)
148
#  define MC_PCR          (0xec)
149
#  define MC_IIR          (0xf0)
150
 
151
/* POC register field definition */
152
#  define MC_POC_EN_BW_OFFSET             0
153
#  define MC_POC_EN_BW_WIDTH              2
154
#  define MC_POC_EN_MEMTYPE_OFFSET        2
155
#  define MC_POC_EN_MEMTYPE_WIDTH         2
156
 
157
/* CSC register field definition */
158
#  define MC_CSC_EN_OFFSET                0
159
#  define MC_CSC_MEMTYPE_OFFSET           1
160
#  define MC_CSC_MEMTYPE_WIDTH            2
161
#  define MC_CSC_BW_OFFSET                4
162
#  define MC_CSC_BW_WIDTH                 2
163
#  define MC_CSC_MS_OFFSET                6
164
#  define MC_CSC_MS_WIDTH                 2
165
#  define MC_CSC_WP_OFFSET                8
166
#  define MC_CSC_BAS_OFFSET               9
167
#  define MC_CSC_KRO_OFFSET               10
168
#  define MC_CSC_PEN_OFFSET               11
169
#  define MC_CSC_SEL_OFFSET               16
170
#  define MC_CSC_SEL_WIDTH                8
171
 
172
#  define MC_CSC_MEMTYPE_SDRAM            0
173
#  define MC_CSC_MEMTYPE_SSRAM            1
174
#  define MC_CSC_MEMTYPE_ASYNC            2
175
#  define MC_CSC_MEMTYPE_SYNC             3
176
 
177
#  define MC_CSR_VALID                    0xFF000703LU
178
#  define MC_POC_VALID                    0x0000000FLU
179
#  define MC_BA_MASK_VALID                0x000003FFLU
180
#  define MC_CSC_VALID                    0x00FF0FFFLU
181
#  define MC_TMS_SDRAM_VALID              0x0FFF83FFLU
182
#  define MC_TMS_SSRAM_VALID              0x00000000LU
183
#  define MC_TMS_ASYNC_VALID              0x03FFFFFFLU
184
#  define MC_TMS_SYNC_VALID               0x01FFFFFFLU
185
#  define MC_TMS_VALID                    0xFFFFFFFFLU /* reg test compat. */
186
 
187
/* TMS register field definition SDRAM */
188
#  define MC_TMS_SDRAM_TRFC_OFFSET        24
189
#  define MC_TMS_SDRAM_TRFC_WIDTH         4
190
#  define MC_TMS_SDRAM_TRP_OFFSET         20
191
#  define MC_TMS_SDRAM_TRP_WIDTH          4
192
#  define MC_TMS_SDRAM_TRCD_OFFSET        17
193
#  define MC_TMS_SDRAM_TRCD_WIDTH         4
194
#  define MC_TMS_SDRAM_TWR_OFFSET         15
195
#  define MC_TMS_SDRAM_TWR_WIDTH          2
196
#  define MC_TMS_SDRAM_WBL_OFFSET         9
197
#  define MC_TMS_SDRAM_OM_OFFSET          7
198
#  define MC_TMS_SDRAM_OM_WIDTH           2
199
#  define MC_TMS_SDRAM_CL_OFFSET          4
200
#  define MC_TMS_SDRAM_CL_WIDTH           3
201
#  define MC_TMS_SDRAM_BT_OFFSET          3
202
#  define MC_TMS_SDRAM_BL_OFFSET          0
203
#  define MC_TMS_SDRAM_BL_WIDTH           3
204
 
205
/* TMS register field definition ASYNC */
206
#  define MC_TMS_ASYNC_TWWD_OFFSET        20
207
#  define MC_TMS_ASYNC_TWWD_WIDTH         6
208
#  define MC_TMS_ASYNC_TWD_OFFSET         16
209
#  define MC_TMS_ASYNC_TWD_WIDTH          4
210
#  define MC_TMS_ASYNC_TWPW_OFFSET        12
211
#  define MC_TMS_ASYNC_TWPW_WIDTH         4
212
#  define MC_TMS_ASYNC_TRDZ_OFFSET        8
213
#  define MC_TMS_ASYNC_TRDZ_WIDTH         4
214
#  define MC_TMS_ASYNC_TRDV_OFFSET        0
215
#  define MC_TMS_ASYNC_TRDV_WIDTH         8
216
 
217
/* TMS register field definition SYNC  */
218
#  define MC_TMS_SYNC_TTO_OFFSET          16
219
#  define MC_TMS_SYNC_TTO_WIDTH           9
220
#  define MC_TMS_SYNC_TWR_OFFSET          12
221
#  define MC_TMS_SYNC_TWR_WIDTH           4
222
#  define MC_TMS_SYNC_TRDZ_OFFSET         8
223
#  define MC_TMS_SYNC_TRDZ_WIDTH          4
224
#  define MC_TMS_SYNC_TRDV_OFFSET         0
225
#  define MC_TMS_SYNC_TRDV_WIDTH          8
226
 
227
#endif /* _MC_INIT_2_H_ */
228
 

powered by: WebSVN 2.1.0

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