1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#include <common.h>
26#include <mpc8xx.h>
27#include <commproc.h>
28
29#ifdef CONFIG_STATUS_LED
30# include <status_led.h>
31#endif
32
33
34
35static long int dram_size (long int, long int *, long int);
36
37
38
39#define _NOT_USED_ 0xFFFFFFFF
40
41
42
43
44const uint sharc_table[] = {
45
46
47
48 0x0FF3FC04, 0x0FF3EC00, 0x7FFFEC04, 0xFFFFEC04,
49 0xFFFFEC05,
50 _NOT_USED_, _NOT_USED_, _NOT_USED_,
51
52
53
54
55 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
56 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
57 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
58 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
59
60
61
62 0x0FAFFC04, 0x0FAFEC00, 0x7FFFEC04, 0xFFFFEC04,
63 0xFFFFEC05,
64 _NOT_USED_, _NOT_USED_, _NOT_USED_,
65
66
67
68
69 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
70 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
71 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
72 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
73
74
75
76
77 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
78 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
79 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
80
81
82
83 0x7FFFFC07,
84 _NOT_USED_, _NOT_USED_, _NOT_USED_,
85};
86
87
88
89
90
91const uint sdram_table[] = {
92
93
94
95 0x0E26FC04, 0x11ADFC04, 0xEFBBBC00, 0x1FF77C45,
96 _NOT_USED_,
97
98
99
100
101
102
103
104
105 0x1FF77C35, 0xEFEABC34, 0x1FB57C35,
106
107
108
109 0x0E26FC04, 0x10ADFC04, 0xF0AFFC00, 0xF0AFFC00,
110 0xF1AFFC00, 0xEFBBBC00, 0x1FF77C45,
111 _NOT_USED_,
112 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
113 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
114
115
116
117 0x1F27FC04, 0xEEAEBC04, 0x01B93C00, 0x1FF77C45,
118 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
119
120
121
122 0x0E26BC00, 0x10AD7C00, 0xF0AFFC00, 0xF0AFFC00,
123 0xE1BBBC04, 0x1FF77C45,
124 _NOT_USED_, _NOT_USED_,
125 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
126 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
127
128
129
130 0x1FF5FC84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC84,
131 0xFFFFFC05,
132 _NOT_USED_, _NOT_USED_, _NOT_USED_,
133 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
134
135
136
137 0x7FFFFC07,
138 _NOT_USED_, _NOT_USED_, _NOT_USED_,
139};
140
141
142
143
144
145
146
147
148
149int checkboard (void)
150{
151#ifdef CONFIG_IVMS8
152 puts ("Board: IVMS8\n");
153#endif
154#ifdef CONFIG_IVML24
155 puts ("Board: IVM-L8/24\n");
156#endif
157 return (0);
158}
159
160
161
162phys_size_t initdram (int board_type)
163{
164 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
165 volatile memctl8xx_t *memctl = &immr->im_memctl;
166 long int size_b0;
167
168
169 immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_SDRAM_CLKE);
170 immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_SDRAM_CLKE);
171 immr->im_cpm.cp_pbdir |= CONFIG_SYS_PB_SDRAM_CLKE;
172 immr->im_cpm.cp_pbdat |= CONFIG_SYS_PB_SDRAM_CLKE;
173 udelay (1);
174
175
176
177
178 memctl->memc_or1 = CONFIG_SYS_OR1;
179 memctl->memc_br1 = CONFIG_SYS_BR1;
180
181
182
183
184 memctl->memc_or2 = CONFIG_SYS_OR2;
185 memctl->memc_br2 = CONFIG_SYS_BR2;
186
187
188
189
190 upmconfig (UPMA, (uint *) sharc_table,
191 sizeof (sharc_table) / sizeof (uint));
192
193#if defined(CONFIG_IVML24)
194
195
196
197 memctl->memc_or4 = CONFIG_SYS_OR4;
198 memctl->memc_br4 = CONFIG_SYS_BR4;
199#endif
200
201
202
203
204 memctl->memc_or5 = CONFIG_SYS_OR5;
205 memctl->memc_br5 = CONFIG_SYS_BR5;
206
207 memctl->memc_mamr = 0x00001000;
208
209
210
211
212 upmconfig (UPMB, (uint *) sdram_table,
213 sizeof (sdram_table) / sizeof (uint));
214
215 memctl->memc_mptpr = CONFIG_SYS_MPTPR_1BK_8K;
216
217 memctl->memc_mar = 0x00000088;
218
219
220
221
222 memctl->memc_or3 = CONFIG_SYS_OR3_PRELIM;
223 memctl->memc_br3 = CONFIG_SYS_BR3_PRELIM;
224
225 memctl->memc_mbmr = CONFIG_SYS_MBMR_8COL;
226
227 udelay (200);
228 memctl->memc_mcr = 0x80806105;
229 udelay (1);
230 memctl->memc_mcr = 0x80806106;
231 udelay (1);
232 memctl->memc_mcr = 0x80806130;
233 udelay (1);
234 memctl->memc_mcr = 0x80806130;
235 udelay (1);
236 memctl->memc_mcr = 0x80806130;
237 udelay (1);
238 memctl->memc_mcr = 0x80806130;
239 udelay (1);
240 memctl->memc_mcr = 0x80806130;
241 udelay (1);
242 memctl->memc_mcr = 0x80806130;
243 udelay (1);
244 memctl->memc_mcr = 0x80806130;
245 udelay (1);
246 memctl->memc_mcr = 0x80806130;
247
248 memctl->memc_mbmr |= MBMR_PTBE;
249
250
251
252
253 size_b0 =
254 dram_size (CONFIG_SYS_MBMR_8COL, (long *) SDRAM_BASE3_PRELIM,
255 SDRAM_MAX_SIZE);
256
257 memctl->memc_mbmr = CONFIG_SYS_MBMR_8COL | MBMR_PTBE;
258
259 return (size_b0);
260}
261
262
263
264
265
266
267
268
269
270
271
272static long int dram_size (long int mamr_value, long int *base,
273 long int maxsize)
274{
275 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
276 volatile memctl8xx_t *memctl = &immr->im_memctl;
277
278 memctl->memc_mbmr = mamr_value;
279
280 return (get_ram_size (base, maxsize));
281}
282
283
284
285void reset_phy (void)
286{
287 immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
288
289
290 immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_ETH_POWERDOWN);
291 immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_ETH_POWERDOWN);
292 immr->im_cpm.cp_pbdir |= CONFIG_SYS_PB_ETH_POWERDOWN;
293 immr->im_cpm.cp_pbdat &= ~(CONFIG_SYS_PB_ETH_POWERDOWN);
294 udelay (1000);
295
296
297
298
299
300
301
302
303
304
305 immr->im_ioport.iop_pcpar &= ~(CONFIG_SYS_PC_ETH_RESET);
306 immr->im_ioport.iop_pcdir |= CONFIG_SYS_PC_ETH_RESET;
307
308 immr->im_ioport.iop_pcdat &= ~(CONFIG_SYS_PC_ETH_RESET);
309 udelay (10);
310
311 immr->im_ioport.iop_pcdat |= CONFIG_SYS_PC_ETH_RESET;
312 udelay (10);
313}
314
315
316
317void show_boot_progress (int status)
318{
319#if defined(CONFIG_STATUS_LED)
320# if defined(STATUS_LED_YELLOW)
321 status_led_set (STATUS_LED_YELLOW,
322 (status < 0) ? STATUS_LED_ON : STATUS_LED_OFF);
323# endif
324# if defined(STATUS_LED_BOOT)
325 if (status == 6)
326 status_led_set (STATUS_LED_BOOT, STATUS_LED_OFF);
327# endif
328#endif
329}
330
331
332
333void ide_set_reset (int on)
334{
335 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
336
337
338
339
340 if (on) {
341 immr->im_ioport.iop_pcdat &= ~(CONFIG_SYS_PC_IDE_RESET);
342 } else {
343 immr->im_ioport.iop_pcdat |= CONFIG_SYS_PC_IDE_RESET;
344 }
345
346
347 immr->im_ioport.iop_pcpar &= ~(CONFIG_SYS_PC_IDE_RESET);
348 immr->im_ioport.iop_pcso &= ~(CONFIG_SYS_PC_IDE_RESET);
349 immr->im_ioport.iop_pcdir |= CONFIG_SYS_PC_IDE_RESET;
350}
351
352
353