3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * Hacked for the Hymod board by Murray.Jensen@cmst.csiro.au, 20-Oct-00
30 #include <asm/iopin_8260.h>
32 /* ------------------------------------------------------------------------- */
34 /* imports from eeprom.c */
35 extern int eeprom_load (unsigned, hymod_eeprom_t *);
36 extern int eeprom_fetch (unsigned, char *, ulong);
37 extern void eeprom_print (hymod_eeprom_t *);
39 /* imports from fetch.c */
40 extern int fetch_and_parse (char *, ulong, int (*)(uchar *, uchar *));
42 /* imports from common/main.c */
43 extern char console_buffer[CFG_CBSIZE];
45 /* ------------------------------------------------------------------------- */
48 * I/O Port configuration table
50 * if conf is 1, then that port pin will be configured at boot time
51 * according to the five values podr/pdir/ppar/psor/pdat for that entry
54 const iop_conf_t iop_conf_tab[4][32] = {
56 /* Port A configuration */
57 { /* conf ppar psor pdir podr pdat */
58 /* PA31 */ {1, 1, 1, 0, 0, 0},
60 /* PA30 */ {1, 1, 1, 0, 0, 0},
62 /* PA29 */ {1, 1, 1, 1, 0, 0},
64 /* PA28 */ {1, 1, 1, 1, 0, 0},
66 /* PA27 */ {1, 1, 1, 0, 0, 0},
68 /* PA26 */ {1, 1, 1, 0, 0, 0},
70 /* PA25 */ {1, 0, 0, 1, 0, 0},
72 /* PA24 */ {1, 0, 0, 1, 0, 0},
74 /* PA23 */ {1, 0, 0, 1, 0, 0},
76 /* PA22 */ {1, 0, 0, 1, 0, 0},
78 /* PA21 */ {1, 1, 0, 1, 0, 0},
80 /* PA20 */ {1, 1, 0, 1, 0, 0},
82 /* PA19 */ {1, 1, 0, 1, 0, 0},
84 /* PA18 */ {1, 1, 0, 1, 0, 0},
86 /* PA17 */ {1, 1, 0, 0, 0, 0},
88 /* PA16 */ {1, 1, 0, 0, 0, 0},
90 /* PA15 */ {1, 1, 0, 0, 0, 0},
92 /* PA14 */ {1, 1, 0, 0, 0, 0},
94 /* PA13 */ {1, 0, 0, 1, 0, 0},
96 /* PA12 */ {1, 0, 0, 1, 0, 0},
98 /* PA11 */ {1, 0, 0, 1, 0, 0},
100 /* PA10 */ {1, 0, 0, 0, 0, 0},
102 /* PA9 */ {1, 0, 0, 0, 0, 0},
104 /* PA8 */ {1, 0, 0, 0, 0, 0},
106 /* PA7 */ {1, 0, 0, 0, 0, 0},
108 /* PA6 */ {1, 0, 0, 0, 1, 0},
110 /* PA5 */ {1, 0, 0, 1, 1, 0},
112 /* PA4 */ {1, 0, 0, 1, 0, 0},
114 /* PA3 */ {1, 0, 0, 1, 0, 0},
116 /* PA2 */ {1, 0, 0, 0, 1, 0},
118 /* PA1 */ {1, 0, 0, 1, 1, 0},
120 /* PA0 */ {1, 0, 0, 1, 0, 0}
124 /* Port B configuration */
125 { /* conf ppar psor pdir podr pdat */
126 /* PB31 */ {1, 1, 0, 1, 0, 0},
128 /* PB30 */ {1, 1, 0, 0, 0, 0},
130 /* PB29 */ {1, 1, 1, 1, 0, 0},
132 /* PB28 */ {1, 1, 0, 0, 0, 0},
134 /* PB27 */ {1, 1, 0, 0, 0, 0},
136 /* PB26 */ {1, 1, 0, 0, 0, 0},
138 /* PB25 */ {1, 1, 0, 1, 0, 0},
139 /* FCC2 MII TxD[3] */
140 /* PB24 */ {1, 1, 0, 1, 0, 0},
141 /* FCC2 MII TxD[2] */
142 /* PB23 */ {1, 1, 0, 1, 0, 0},
143 /* FCC2 MII TxD[1] */
144 /* PB22 */ {1, 1, 0, 1, 0, 0},
145 /* FCC2 MII TxD[0] */
146 /* PB21 */ {1, 1, 0, 0, 0, 0},
147 /* FCC2 MII RxD[0] */
148 /* PB20 */ {1, 1, 0, 0, 0, 0},
149 /* FCC2 MII RxD[1] */
150 /* PB19 */ {1, 1, 0, 0, 0, 0},
151 /* FCC2 MII RxD[2] */
152 /* PB18 */ {1, 1, 0, 0, 0, 0},
153 /* FCC2 MII RxD[3] */
154 /* PB17 */ {1, 1, 0, 0, 0, 0},
156 /* PB16 */ {1, 1, 0, 0, 0, 0},
158 /* PB15 */ {1, 1, 0, 1, 0, 0},
160 /* PB14 */ {1, 1, 0, 1, 0, 0},
162 /* PB13 */ {1, 1, 0, 0, 0, 0},
164 /* PB12 */ {1, 1, 0, 0, 0, 0},
166 /* PB11 */ {1, 1, 0, 0, 0, 0},
167 /* FCC3 MII RxD[3] */
168 /* PB10 */ {1, 1, 0, 0, 0, 0},
169 /* FCC3 MII RxD[2] */
170 /* PB9 */ {1, 1, 0, 0, 0, 0},
171 /* FCC3 MII RxD[1] */
172 /* PB8 */ {1, 1, 0, 0, 0, 0},
173 /* FCC3 MII RxD[0] */
174 /* PB7 */ {1, 1, 0, 1, 0, 0},
175 /* FCC3 MII TxD[3] */
176 /* PB6 */ {1, 1, 0, 1, 0, 0},
177 /* FCC3 MII TxD[2] */
178 /* PB5 */ {1, 1, 0, 1, 0, 0},
179 /* FCC3 MII TxD[1] */
180 /* PB4 */ {1, 1, 0, 1, 0, 0},
181 /* FCC3 MII TxD[0] */
182 /* PB3 */ {0, 0, 0, 0, 0, 0},
183 /* pin doesn't exist */
184 /* PB2 */ {0, 0, 0, 0, 0, 0},
185 /* pin doesn't exist */
186 /* PB1 */ {0, 0, 0, 0, 0, 0},
187 /* pin doesn't exist */
188 /* PB0 */ {0, 0, 0, 0, 0, 0}
189 /* pin doesn't exist */
193 { /* conf ppar psor pdir podr pdat */
194 /* PC31 */ {1, 0, 0, 0, 0, 0},
196 /* PC30 */ {0, 0, 0, 0, 0, 0},
197 /* PC29 */ {1, 1, 0, 0, 0, 0},
199 /* PC28 */ {1, 1, 0, 0, 0, 0},
201 /* PC27 */ {1, 1, 0, 0, 0, 0},
203 /* PC26 */ {1, 1, 0, 0, 0, 0},
205 /* PC25 */ {1, 1, 0, 0, 0, 0},
207 /* PC24 */ {0, 0, 0, 0, 0, 0},
208 /* PC23 */ {1, 1, 0, 0, 0, 0},
210 /* PC22 */ {1, 1, 0, 0, 0, 0},
211 /* FCC1 MII RX_CLK */
212 /* PC21 */ {1, 1, 0, 0, 0, 0},
213 /* FCC1 MII TX_CLK */
214 /* PC20 */ {1, 1, 0, 0, 0, 0},
216 /* PC19 */ {1, 1, 0, 0, 0, 0},
217 /* FCC2 MII RX_CLK */
218 /* PC18 */ {1, 1, 0, 0, 0, 0},
219 /* FCC2 MII TX_CLK */
220 /* PC17 */ {1, 1, 0, 0, 0, 0},
221 /* FCC3 MII RX_CLK */
222 /* PC16 */ {1, 1, 0, 0, 0, 0},
223 /* FCC3 MII TX_CLK */
224 /* PC15 */ {1, 0, 0, 0, 0, 0},
226 /* PC14 */ {1, 0, 0, 0, 0, 0},
228 /* PC13 */ {1, 0, 0, 0, 0, 0},
230 /* PC12 */ {1, 0, 0, 0, 0, 0},
232 /* PC11 */ {1, 0, 0, 1, 0, 0},
234 /* PC10 */ {1, 0, 0, 1, 0, 0},
236 /* PC9 */ {1, 0, 0, 1, 0, 0},
238 /* PC8 */ {1, 0, 0, 1, 0, 0},
240 /* PC7 */ {1, 0, 0, 0, 0, 0},
242 /* PC6 */ {1, 0, 0, 0, 0, 0},
244 /* PC5 */ {1, 0, 0, 0, 0, 0},
246 /* PC4 */ {1, 0, 0, 0, 0, 0},
248 /* PC3 */ {1, 1, 1, 1, 0, 0},
249 /* SDMA IDMA2 ~DACK */
250 /* PC2 */ {1, 1, 1, 0, 0, 0},
251 /* SDMA IDMA2 ~DONE */
252 /* PC1 */ {1, 1, 0, 0, 0, 0},
253 /* SDMA IDMA2 ~DREQ */
254 /* PC0 */ {1, 1, 0, 1, 0, 0}
259 { /* conf ppar psor pdir podr pdat */
260 /* PD31 */ {1, 1, 0, 0, 0, 0},
262 /* PD30 */ {1, 1, 1, 1, 0, 0},
264 /* PD29 */ {1, 0, 0, 1, 0, 0},
266 /* PD28 */ {1, 1, 0, 0, 0, 0},
268 /* PD27 */ {1, 1, 0, 1, 0, 0},
270 /* PD26 */ {1, 0, 0, 1, 0, 0},
272 /* PD25 */ {1, 0, 0, 0, 0, 0},
274 /* PD24 */ {1, 0, 0, 0, 0, 0},
276 /* PD23 */ {1, 0, 0, 1, 0, 0},
278 /* PD22 */ {1, 0, 0, 0, 0, 0},
280 /* PD21 */ {1, 0, 0, 0, 0, 0},
282 /* PD20 */ {1, 0, 0, 0, 0, 0},
284 /* PD19 */ {1, 1, 1, 0, 0, 0},
286 /* PD18 */ {1, 1, 1, 0, 0, 0},
288 /* PD17 */ {1, 1, 1, 0, 0, 0},
290 /* PD16 */ {1, 1, 1, 0, 0, 0},
292 /* PD15 */ {1, 1, 1, 0, 1, 0},
294 /* PD14 */ {1, 1, 1, 0, 1, 0},
296 /* PD13 */ {1, 0, 0, 1, 0, 1},
298 /* PD12 */ {1, 0, 0, 1, 0, 1},
300 /* PD11 */ {1, 0, 0, 1, 0, 1},
302 /* PD10 */ {1, 0, 0, 1, 0, 1},
304 /* PD9 */ {1, 0, 0, 0, 0, 0},
306 /* PD8 */ {1, 0, 0, 0, 0, 0},
308 /* PD7 */ {1, 0, 0, 1, 0, 1},
310 /* PD6 */ {1, 0, 0, 1, 0, 1},
312 /* PD5 */ {1, 0, 0, 1, 0, 1},
314 /* PD4 */ {1, 0, 0, 1, 0, 1},
316 /* PD3 */ {0, 0, 0, 0, 0, 0},
317 /* pin doesn't exist */
318 /* PD2 */ {0, 0, 0, 0, 0, 0},
319 /* pin doesn't exist */
320 /* PD1 */ {0, 0, 0, 0, 0, 0},
321 /* pin doesn't exist */
322 /* PD0 */ {0, 0, 0, 0, 0, 0}
323 /* pin doesn't exist */
327 /* ------------------------------------------------------------------------- */
330 * AMI FS6377 Clock Generator configuration table
332 * the "fs6377_regs[]" table entries correspond to FS6377 registers
333 * 0 - 15 (total of 16 bytes).
335 * the data is written to the FS6377 via the i2c bus using address in
336 * "fs6377_addr" (address is 7 bits - R/W bit not included).
339 uchar fs6377_addr = 0x5c;
341 uchar fs6377_regs[16] = {
342 12, 75, 64, 25, 144, 128, 25, 192,
343 0, 16, 135, 192, 224, 64, 64, 192
346 iopin_t pa11 = { IOPIN_PORTA, 11, 0 };
348 /* ------------------------------------------------------------------------- */
351 * special board initialisation, after clocks and timebase have been
352 * set up but before environment and serial are initialised.
354 * added so that very early initialisations can be done using the i2c
355 * driver (which requires the clocks, to calculate the dividers, and
356 * the timebase, for udelay())
359 int board_postclk_init (void)
361 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
364 * Initialise the FS6377 clock chip
366 * the secondary address is the register number from where to
367 * start the write - I want to write all the registers
369 * don't bother checking return status - we have no console yet
370 * to print it on, nor any RAM to store it in - it will be obvious
371 * if this doesn't work
373 (void) i2c_write (fs6377_addr, 0, 1, fs6377_regs,
374 sizeof (fs6377_regs));
379 /* ------------------------------------------------------------------------- */
382 * Check Board Identity: Hardwired to HYMOD
385 int checkboard (void)
387 puts ("Board: HYMOD\n");
391 /* ------------------------------------------------------------------------- */
394 * miscellaneous (early - while running in flash) initialisations.
397 #define _NOT_USED_ 0xFFFFFFFF
399 uint upmb_table[] = {
400 /* Read Single Beat (RSS) - offset 0x00 */
401 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
402 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
403 /* Read Burst (RBS) - offset 0x08 */
404 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
405 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
406 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
407 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
408 /* Write Single Beat (WSS) - offset 0x18 */
409 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
410 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
411 /* Write Burst (WSS) - offset 0x20 */
412 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
413 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
414 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
415 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
416 /* Refresh Timer (PTS) - offset 0x30 */
417 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
418 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
419 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
420 /* Exception Condition (EXS) - offset 0x3c */
421 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_
424 uint upmc_table[] = {
425 /* Read Single Beat (RSS) - offset 0x00 */
426 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
427 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
428 /* Read Burst (RBS) - offset 0x08 */
429 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
430 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
431 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
432 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
433 /* Write Single Beat (WSS) - offset 0x18 */
434 0xF0E00000, 0xF0A00000, 0x00A00000, 0x30A00000,
435 0xF0F40007, _NOT_USED_, _NOT_USED_, _NOT_USED_,
436 /* Write Burst (WSS) - offset 0x20 */
437 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
438 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
439 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
440 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
441 /* Refresh Timer (PTS) - offset 0x30 */
442 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
443 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
444 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
445 /* Exception Condition (EXS) - offset 0x3c */
446 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_
449 int misc_init_f (void)
451 volatile immap_t *immap = (immap_t *) CFG_IMMR;
452 volatile memctl8260_t *memctl = &immap->im_memctl;
456 upmconfig (UPMB, upmb_table, sizeof upmb_table / sizeof upmb_table[0]);
457 memctl->memc_mbmr = CFG_MBMR;
459 upmconfig (UPMC, upmc_table, sizeof upmc_table / sizeof upmc_table[0]);
460 memctl->memc_mcmr = CFG_MCMR;
462 printf ("configured\n");
466 /* ------------------------------------------------------------------------- */
468 long initdram (int board_type)
470 volatile immap_t *immap = (immap_t *) CFG_IMMR;
471 volatile memctl8260_t *memctl = &immap->im_memctl;
472 volatile uchar c = 0, *ramaddr = (uchar *) (CFG_SDRAM_BASE + 0x8);
473 ulong psdmr = CFG_PSDMR;
477 * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
479 * "At system reset, initialization software must set up the
480 * programmable parameters in the memory controller banks registers
481 * (ORx, BRx, P/LSDMR). After all memory parameters are conÞgured,
482 * system software should execute the following initialization sequence
483 * for each SDRAM device.
485 * 1. Issue a PRECHARGE-ALL-BANKS command
486 * 2. Issue eight CBR REFRESH commands
487 * 3. Issue a MODE-SET command to initialize the mode register
489 * The initial commands are executed by setting P/LSDMR[OP] and
490 * accessing the SDRAM with a single-byte transaction."
492 * The appropriate BRx/ORx registers have already been set when we
493 * get here. The SDRAM can be accessed at the address CFG_SDRAM_BASE.
496 memctl->memc_psrt = CFG_PSRT;
497 memctl->memc_mptpr = CFG_MPTPR;
499 memctl->memc_psdmr = psdmr | PSDMR_OP_PREA;
502 memctl->memc_psdmr = psdmr | PSDMR_OP_CBRR;
503 for (i = 0; i < 8; i++)
506 memctl->memc_psdmr = psdmr | PSDMR_OP_MRW;
509 memctl->memc_psdmr = psdmr | PSDMR_OP_NORM | PSDMR_RFEN;
512 return (CFG_SDRAM_SIZE << 20);
515 /* ------------------------------------------------------------------------- */
516 /* miscellaneous initialisations after relocation into ram (misc_init_r) */
518 /* loads the data in the main board and mezzanine board eeproms into */
519 /* the hymod configuration struct stored in the board information area. */
521 /* if the contents of either eeprom is invalid, prompts for a serial */
522 /* number (and an ethernet address if required) then fetches a file */
523 /* containing information to be stored in the eeprom from the tftp server */
524 /* (the file name is based on the serial number and a built-in path) */
526 /* these are relative to the root of the server's tftp directory */
527 static char *bddb_cfgdir = "/hymod/bddb";
528 static char *global_env_path = "/hymod/global_env";
530 static ulong get_serno (const char *prompt)
537 n = readline (prompt);
545 serno = simple_strtol (console_buffer, &p, 10);
547 if (p > console_buffer && *p == '\0')
550 printf ("Invalid number (%s) - please re-enter\n", console_buffer);
554 static int read_eeprom (char *label, unsigned offset, hymod_eeprom_t * ep)
556 char filename[50], prompt[50];
560 sprintf (prompt, "Enter %s board serial number: ", label);
564 if (eeprom_load (offset, ep))
567 printf ("*** %s board EEPROM contents are %sinvalid\n",
568 label, count == 0 ? "" : "STILL ");
570 puts ("*** will attempt to fetch from server (Ctrl-C to abort)\n");
572 if ((serno = get_serno (prompt)) == 0) {
573 puts ("\n*** interrupted! - ignoring eeprom contents\n");
577 sprintf (filename, "%s/%010lu.cfg", bddb_cfgdir, serno);
579 printf ("*** fetching %s board EEPROM contents from server\n",
582 if (eeprom_fetch (offset, filename, 0x100000) == 0) {
583 puts ("*** fetch failed - ignoring eeprom contents\n");
591 static ulong main_serno;
593 static int env_fetch_callback (uchar * name, uchar * value)
595 char *ov, nv[CFG_CBSIZE], *p, *q, *nn;
596 int override = 1, append = 0, nl;
604 if ((nl = strlen (nn)) > 0 && nn[nl - 1] == '+') {
612 while ((*q = *p++) != '\0')
616 case '\0': /* whoops - back up */
620 case '%': /* a single percent character */
624 case 's': /* main board serial number as string */
625 q += sprintf (q, "%010lu", main_serno);
628 case 'S': /* main board serial number as number */
629 q += sprintf (q, "%lu", main_serno);
632 default: /* ignore any others */
638 if ((ov = getenv (nn)) != NULL) {
642 if (strstr (ov, nv) == NULL) {
645 printf ("Appending '%s' to env cmd '%s'\n", nv, nn);
651 nv[ovl + 1 + nvl] = nv[nvl];
666 if (!override || strcmp (ov, nv) == 0)
669 printf ("Re-setting env cmd '%s' from '%s' to '%s'\n", nn, ov, nv);
671 printf ("Setting env cmd '%s' to '%s'\n", nn, nv);
677 int misc_init_r (void)
679 DECLARE_GLOBAL_DATA_PTR;
681 hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
684 memset ((void *) cp, 0, sizeof (*cp));
686 /* set up main board config info */
688 if (i2c_probe (CFG_I2C_EEPROM_ADDR | HYMOD_EEOFF_MAIN)) {
691 ("main", HYMOD_EEOFF_MAIN << 8, &cp->main.eeprom))
692 cp->main.eeprom_valid = 1;
694 puts ("EEPROM:main...");
696 if (cp->main.eeprom_valid) {
697 printf ("OK (ver %u)\n", cp->main.eeprom.ver);
698 eeprom_print (&cp->main.eeprom);
699 main_serno = cp->main.eeprom.serno;
703 cp->main.mmap[0].prog.exists = 1;
704 cp->main.mmap[0].prog.size = FPGA_MAIN_CFG_SIZE;
705 cp->main.mmap[0].prog.base = FPGA_MAIN_CFG_BASE;
707 cp->main.mmap[0].reg.exists = 1;
708 cp->main.mmap[0].reg.size = FPGA_MAIN_REG_SIZE;
709 cp->main.mmap[0].reg.base = FPGA_MAIN_REG_BASE;
711 cp->main.mmap[0].port.exists = 1;
712 cp->main.mmap[0].port.size = FPGA_MAIN_PORT_SIZE;
713 cp->main.mmap[0].port.base = FPGA_MAIN_PORT_BASE;
715 cp->main.iopins[0].prog_pin.port = FPGA_MAIN_PROG_PORT;
716 cp->main.iopins[0].prog_pin.pin = FPGA_MAIN_PROG_PIN;
717 cp->main.iopins[0].prog_pin.flag = 1;
718 cp->main.iopins[0].init_pin.port = FPGA_MAIN_INIT_PORT;
719 cp->main.iopins[0].init_pin.pin = FPGA_MAIN_INIT_PIN;
720 cp->main.iopins[0].init_pin.flag = 1;
721 cp->main.iopins[0].done_pin.port = FPGA_MAIN_DONE_PORT;
722 cp->main.iopins[0].done_pin.pin = FPGA_MAIN_DONE_PIN;
723 cp->main.iopins[0].done_pin.flag = 1;
724 #ifdef FPGA_MAIN_ENABLE_PORT
725 cp->main.iopins[0].enable_pin.port = FPGA_MAIN_ENABLE_PORT;
726 cp->main.iopins[0].enable_pin.pin = FPGA_MAIN_ENABLE_PIN;
727 cp->main.iopins[0].enable_pin.flag = 1;
730 puts ("EEPROM:main...NOT PRESENT\n");
732 /* set up mezzanine board config info */
734 if (i2c_probe (CFG_I2C_EEPROM_ADDR | HYMOD_EEOFF_MEZZ)) {
737 ("mezz", HYMOD_EEOFF_MEZZ << 8, &cp->mezz.eeprom))
738 cp->mezz.eeprom_valid = 1;
740 puts ("EEPROM:mezz...");
742 if (cp->mezz.eeprom_valid) {
743 printf ("OK (ver %u)\n", cp->mezz.eeprom.ver);
744 eeprom_print (&cp->mezz.eeprom);
748 cp->mezz.mmap[0].prog.exists = 1;
749 cp->mezz.mmap[0].prog.size = FPGA_MEZZ_CFG_SIZE;
750 cp->mezz.mmap[0].prog.base = FPGA_MEZZ_CFG_BASE;
752 cp->mezz.mmap[0].reg.exists = 0;
754 cp->mezz.mmap[0].port.exists = 0;
756 cp->mezz.iopins[0].prog_pin.port = FPGA_MEZZ_PROG_PORT;
757 cp->mezz.iopins[0].prog_pin.pin = FPGA_MEZZ_PROG_PIN;
758 cp->mezz.iopins[0].prog_pin.flag = 1;
759 cp->mezz.iopins[0].init_pin.port = FPGA_MEZZ_INIT_PORT;
760 cp->mezz.iopins[0].init_pin.pin = FPGA_MEZZ_INIT_PIN;
761 cp->mezz.iopins[0].init_pin.flag = 1;
762 cp->mezz.iopins[0].done_pin.port = FPGA_MEZZ_DONE_PORT;
763 cp->mezz.iopins[0].done_pin.pin = FPGA_MEZZ_DONE_PIN;
764 cp->mezz.iopins[0].done_pin.flag = 1;
765 #ifdef FPGA_MEZZ_ENABLE_PORT
766 cp->mezz.iopins[0].enable_pin.port = FPGA_MEZZ_ENABLE_PORT;
767 cp->mezz.iopins[0].enable_pin.pin = FPGA_MEZZ_ENABLE_PIN;
768 cp->mezz.iopins[0].enable_pin.flag = 1;
771 if (cp->mezz.eeprom_valid &&
772 cp->mezz.eeprom.bdtype == HYMOD_BDTYPE_DISPLAY) {
774 * mezzanine board is a display board - switch the SEL_CD
775 * input of the FS6377 clock generator (via I/O Port Pin PA11) to
776 * high (or 1) to select the 27MHz required by the display board
778 iopin_set_high (&pa11);
780 puts ("SEL_CD:toggled for display board\n");
783 puts ("EEPROM:mezz...NOT PRESENT\n");
786 crc32 (0, (unsigned char *) cp, offsetof (hymod_conf_t, crc));
788 if (getenv ("global_env_loaded") == NULL) {
790 puts ("*** global environment has not been loaded\n");
791 puts ("*** fetching from server (Control-C to Abort)\n");
793 rc = fetch_and_parse (global_env_path, 0x100000,
797 puts ("*** Fetch of environment failed!\n");
799 setenv ("global_env_loaded", "yes");