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
26#include <common.h>
27#include <mpc8260.h>
28#include <mpc8260_irq.h>
29#include <ioports.h>
30#include <i2c.h>
31#include <asm/iopin_8260.h>
32
33DECLARE_GLOBAL_DATA_PTR;
34
35
36
37
38extern int hymod_eeprom_read (int, hymod_eeprom_t *);
39extern void hymod_eeprom_print (hymod_eeprom_t *);
40
41
42extern void hymod_check_env (void);
43
44
45
46
47
48
49
50
51
52
53const iop_conf_t iop_conf_tab[4][32] = {
54
55
56 {
57
58 { 1, 1, 1, 0, 0, 0 },
59 { 1, 1, 1, 0, 0, 0 },
60 { 1, 1, 1, 1, 0, 0 },
61 { 1, 1, 1, 1, 0, 0 },
62 { 1, 1, 1, 0, 0, 0 },
63 { 1, 1, 1, 0, 0, 0 },
64 { 1, 0, 0, 1, 0, 0 },
65 { 1, 0, 0, 1, 0, 0 },
66 { 1, 0, 0, 1, 0, 0 },
67 { 1, 0, 0, 1, 0, 0 },
68 { 1, 1, 0, 1, 0, 0 },
69 { 1, 1, 0, 1, 0, 0 },
70 { 1, 1, 0, 1, 0, 0 },
71 { 1, 1, 0, 1, 0, 0 },
72 { 1, 1, 0, 0, 0, 0 },
73 { 1, 1, 0, 0, 0, 0 },
74 { 1, 1, 0, 0, 0, 0 },
75 { 1, 1, 0, 0, 0, 0 },
76 { 1, 0, 0, 1, 0, 0 },
77 { 1, 0, 0, 1, 0, 0 },
78 { 1, 0, 0, 1, 0, 0 },
79 { 1, 0, 0, 0, 0, 0 },
80 { 1, 0, 0, 0, 0, 0 },
81 { 1, 0, 0, 0, 0, 0 },
82 { 1, 0, 0, 0, 0, 0 },
83 { 1, 0, 0, 0, 1, 0 },
84 { 1, 0, 0, 1, 1, 0 },
85 { 1, 0, 0, 1, 0, 0 },
86 { 1, 0, 0, 1, 0, 0 },
87 { 1, 0, 0, 0, 1, 0 },
88 { 1, 0, 0, 1, 1, 0 },
89 { 1, 0, 0, 1, 0, 0 }
90 },
91
92
93 {
94
95 { 1, 1, 0, 1, 0, 0 },
96 { 1, 1, 0, 0, 0, 0 },
97 { 1, 1, 1, 1, 0, 0 },
98 { 1, 1, 0, 0, 0, 0 },
99 { 1, 1, 0, 0, 0, 0 },
100 { 1, 1, 0, 0, 0, 0 },
101 { 1, 1, 0, 1, 0, 0 },
102 { 1, 1, 0, 1, 0, 0 },
103 { 1, 1, 0, 1, 0, 0 },
104 { 1, 1, 0, 1, 0, 0 },
105 { 1, 1, 0, 0, 0, 0 },
106 { 1, 1, 0, 0, 0, 0 },
107 { 1, 1, 0, 0, 0, 0 },
108 { 1, 1, 0, 0, 0, 0 },
109 { 1, 1, 0, 0, 0, 0 },
110 { 1, 1, 0, 0, 0, 0 },
111 { 1, 1, 0, 1, 0, 0 },
112 { 1, 1, 0, 1, 0, 0 },
113 { 1, 1, 0, 0, 0, 0 },
114 { 1, 1, 0, 0, 0, 0 },
115 { 1, 1, 0, 0, 0, 0 },
116 { 1, 1, 0, 0, 0, 0 },
117 { 1, 1, 0, 0, 0, 0 },
118 { 1, 1, 0, 0, 0, 0 },
119 { 1, 1, 0, 1, 0, 0 },
120 { 1, 1, 0, 1, 0, 0 },
121 { 1, 1, 0, 1, 0, 0 },
122 { 1, 1, 0, 1, 0, 0 },
123 { 0, 0, 0, 0, 0, 0 },
124 { 0, 0, 0, 0, 0, 0 },
125 { 0, 0, 0, 0, 0, 0 },
126 { 0, 0, 0, 0, 0, 0 }
127 },
128
129
130 {
131
132 { 1, 0, 0, 0, 0, 0 },
133 { 0, 0, 0, 0, 0, 0 },
134 { 1, 1, 0, 0, 0, 0 },
135 { 1, 1, 0, 0, 0, 0 },
136 { 1, 1, 0, 0, 0, 0 },
137 { 1, 1, 0, 0, 0, 0 },
138 { 1, 1, 0, 0, 0, 0 },
139 { 0, 0, 0, 0, 0, 0 },
140 { 1, 1, 0, 0, 0, 0 },
141 { 1, 1, 0, 0, 0, 0 },
142 { 1, 1, 0, 0, 0, 0 },
143 { 1, 1, 0, 0, 0, 0 },
144 { 1, 1, 0, 0, 0, 0 },
145 { 1, 1, 0, 0, 0, 0 },
146 { 1, 1, 0, 0, 0, 0 },
147 { 1, 1, 0, 0, 0, 0 },
148 { 1, 0, 0, 0, 0, 0 },
149 { 1, 0, 0, 0, 0, 0 },
150 { 1, 0, 0, 0, 0, 0 },
151 { 1, 0, 0, 0, 0, 0 },
152 { 1, 0, 0, 1, 0, 0 },
153 { 1, 0, 0, 1, 0, 0 },
154 { 1, 0, 0, 1, 0, 0 },
155 { 1, 0, 0, 1, 0, 0 },
156 { 1, 0, 0, 0, 0, 0 },
157 { 1, 0, 0, 0, 0, 0 },
158 { 1, 0, 0, 0, 0, 0 },
159 { 1, 0, 0, 0, 0, 0 },
160 { 0, 1, 1, 1, 0, 0 },
161 { 0, 1, 1, 0, 0, 0 },
162 { 0, 1, 0, 0, 0, 0 },
163 { 1, 1, 0, 1, 0, 0 }
164 },
165
166
167 {
168
169 { 1, 1, 0, 0, 0, 0 },
170 { 1, 1, 1, 1, 0, 0 },
171 { 1, 0, 0, 1, 0, 0 },
172 { 1, 1, 0, 0, 0, 0 },
173 { 1, 1, 0, 1, 0, 0 },
174 { 1, 0, 0, 1, 0, 0 },
175 { 1, 0, 0, 0, 0, 0 },
176 { 1, 0, 0, 0, 0, 0 },
177 { 1, 0, 0, 1, 0, 0 },
178 { 1, 0, 0, 0, 0, 0 },
179 { 1, 0, 0, 0, 0, 0 },
180 { 1, 0, 0, 0, 0, 0 },
181 { 1, 1, 1, 0, 0, 0 },
182 { 1, 1, 1, 0, 0, 0 },
183 { 1, 1, 1, 0, 0, 0 },
184 { 1, 1, 1, 0, 0, 0 },
185 { 1, 1, 1, 0, 1, 0 },
186 { 1, 1, 1, 0, 1, 0 },
187 { 1, 0, 0, 1, 0, 1 },
188 { 1, 0, 0, 1, 0, 1 },
189 { 1, 0, 0, 1, 0, 1 },
190 { 1, 0, 0, 1, 0, 1 },
191 { 1, 0, 0, 0, 0, 0 },
192 { 1, 0, 0, 0, 0, 0 },
193 { 1, 0, 0, 1, 0, 1 },
194 { 1, 0, 0, 1, 0, 1 },
195 { 1, 0, 0, 1, 0, 1 },
196 { 1, 0, 0, 1, 0, 1 },
197 { 0, 0, 0, 0, 0, 0 },
198 { 0, 0, 0, 0, 0, 0 },
199 { 0, 0, 0, 0, 0, 0 },
200 { 0, 0, 0, 0, 0, 0 }
201 }
202};
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237uchar fs6377_addr = 0x5c;
238
239uchar fs6377_regs[16] = {
240 12, 75, 64, 25, 144, 128, 25, 192,
241 0, 16, 135, 192, 224, 64, 64, 192
242};
243
244
245
246
247
248
249
250
251
252
253
254
255int
256board_postclk_init (void)
257{
258 i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
259
260
261
262
263
264
265
266
267
268
269
270 (void) i2c_write (fs6377_addr, 0, 1, fs6377_regs,
271 sizeof (fs6377_regs));
272
273 return (0);
274}
275
276
277
278
279
280
281
282int
283checkboard (void)
284{
285 puts ("Board: HYMOD\n");
286 return (0);
287}
288
289
290
291
292
293
294
295#define _NOT_USED_ 0xFFFFFFFF
296
297uint upmb_table[] = {
298
299 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
300 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
301
302 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
303 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
304 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
305 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
306
307 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
308 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
309
310 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
311 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
312 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
313 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
314
315 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
316 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
317 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
318
319 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_
320};
321
322uint upmc_table[] = {
323
324 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
325 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
326
327 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
328 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
329 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
330 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
331
332 0xF0E00000, 0xF0A00000, 0x00A00000, 0x30A00000,
333 0xF0F40007, _NOT_USED_, _NOT_USED_, _NOT_USED_,
334
335 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
336 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
337 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
338 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
339
340 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
341 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
342 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
343
344 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_
345};
346
347int
348misc_init_f (void)
349{
350 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
351 volatile memctl8260_t *memctl = &immap->im_memctl;
352
353 printf ("UPMs: ");
354
355 upmconfig (UPMB, upmb_table, sizeof upmb_table / sizeof upmb_table[0]);
356 memctl->memc_mbmr = CONFIG_SYS_MBMR;
357
358 upmconfig (UPMC, upmc_table, sizeof upmc_table / sizeof upmc_table[0]);
359 memctl->memc_mcmr = CONFIG_SYS_MCMR;
360
361 printf ("configured\n");
362 return (0);
363}
364
365
366
367phys_size_t
368initdram (int board_type)
369{
370 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
371 volatile memctl8260_t *memctl = &immap->im_memctl;
372 volatile uchar c = 0, *ramaddr = (uchar *) (CONFIG_SYS_SDRAM_BASE + 0x8);
373 ulong psdmr = CONFIG_SYS_PSDMR;
374 int i;
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396 memctl->memc_psrt = CONFIG_SYS_PSRT;
397 memctl->memc_mptpr = CONFIG_SYS_MPTPR;
398
399 memctl->memc_psdmr = psdmr | PSDMR_OP_PREA;
400 *ramaddr = c;
401
402 memctl->memc_psdmr = psdmr | PSDMR_OP_CBRR;
403 for (i = 0; i < 8; i++)
404 *ramaddr = c;
405
406 memctl->memc_psdmr = psdmr | PSDMR_OP_MRW;
407 *ramaddr = c;
408
409 memctl->memc_psdmr = psdmr | PSDMR_OP_NORM | PSDMR_RFEN;
410 *ramaddr = c;
411
412 return (CONFIG_SYS_SDRAM_SIZE << 20);
413}
414
415
416
417
418
419
420
421
422
423
424
425
426int
427last_stage_init (void)
428{
429 hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
430 int rc;
431
432#ifdef CONFIG_BOOT_RETRY_TIME
433
434
435
436
437 init_cmd_timeout ();
438#endif
439
440 memset ((void *) cp, 0, sizeof (*cp));
441
442
443
444 rc = hymod_eeprom_read (0, &cp->main.eeprom);
445
446 puts ("EEPROM:main...");
447 if (rc < 0)
448 puts ("NOT PRESENT\n");
449 else if (rc == 0)
450 puts ("INVALID\n");
451 else {
452 cp->main.eeprom.valid = 1;
453
454 printf ("OK (ver %u)\n", cp->main.eeprom.ver);
455 hymod_eeprom_print (&cp->main.eeprom);
456
457
458
459
460
461
462
463
464 cp->main.xlx[0].mmap.prog.exists = 1;
465 cp->main.xlx[0].mmap.prog.size = FPGA_MAIN_CFG_SIZE;
466 cp->main.xlx[0].mmap.prog.base = FPGA_MAIN_CFG_BASE;
467
468 cp->main.xlx[0].mmap.reg.exists = 1;
469 cp->main.xlx[0].mmap.reg.size = FPGA_MAIN_REG_SIZE;
470 cp->main.xlx[0].mmap.reg.base = FPGA_MAIN_REG_BASE;
471
472 cp->main.xlx[0].mmap.port.exists = 1;
473 cp->main.xlx[0].mmap.port.size = FPGA_MAIN_PORT_SIZE;
474 cp->main.xlx[0].mmap.port.base = FPGA_MAIN_PORT_BASE;
475
476 cp->main.xlx[0].iopins.prog_pin.port = FPGA_MAIN_PROG_PORT;
477 cp->main.xlx[0].iopins.prog_pin.pin = FPGA_MAIN_PROG_PIN;
478 cp->main.xlx[0].iopins.prog_pin.flag = 1;
479 cp->main.xlx[0].iopins.init_pin.port = FPGA_MAIN_INIT_PORT;
480 cp->main.xlx[0].iopins.init_pin.pin = FPGA_MAIN_INIT_PIN;
481 cp->main.xlx[0].iopins.init_pin.flag = 1;
482 cp->main.xlx[0].iopins.done_pin.port = FPGA_MAIN_DONE_PORT;
483 cp->main.xlx[0].iopins.done_pin.pin = FPGA_MAIN_DONE_PIN;
484 cp->main.xlx[0].iopins.done_pin.flag = 1;
485#ifdef FPGA_MAIN_ENABLE_PORT
486 cp->main.xlx[0].iopins.enable_pin.port = FPGA_MAIN_ENABLE_PORT;
487 cp->main.xlx[0].iopins.enable_pin.pin = FPGA_MAIN_ENABLE_PIN;
488 cp->main.xlx[0].iopins.enable_pin.flag = 1;
489#endif
490
491 cp->main.xlx[0].irq = FPGA_MAIN_IRQ;
492 }
493
494
495
496 rc = hymod_eeprom_read (1, &cp->mezz.eeprom);
497
498 puts ("EEPROM:mezz...");
499 if (rc < 0)
500 puts ("NOT PRESENT\n");
501 else if (rc == 0)
502 puts ("INVALID\n");
503 else {
504 cp->main.eeprom.valid = 1;
505
506 printf ("OK (ver %u)\n", cp->mezz.eeprom.ver);
507 hymod_eeprom_print (&cp->mezz.eeprom);
508 }
509
510 cp->crc = crc32 (0, (unsigned char *)cp, offsetof (hymod_conf_t, crc));
511
512 hymod_check_env ();
513
514 return (0);
515}
516
517#ifdef CONFIG_SHOW_ACTIVITY
518void board_show_activity (ulong timebase)
519{
520#ifdef CONFIG_SYS_HYMOD_DBLEDS
521 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
522 volatile iop8260_t *iop = &immr->im_ioport;
523 static int shift = 0;
524
525 if ((timestamp % CONFIG_SYS_HZ) == 0) {
526 if (++shift > 3)
527 shift = 0;
528 iop->iop_pdatd =
529 (iop->iop_pdatd & ~0x0f000000) | (1 << (24 + shift));
530 }
531#endif
532}
533
534void show_activity(int arg)
535{
536}
537#endif
538