3 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/processor.h>
13 DECLARE_GLOBAL_DATA_PTR;
15 extern void lxt971_no_sleep(void);
18 /* ------------------------------------------------------------------------- */
28 /* fpga configuration data - generated by bin2cc */
29 const unsigned char fpgadata[] = {
34 * include common fpga code (for esd boards)
36 #include "../common/fpga.c"
39 int board_early_init_f (void)
45 /* set up serial port with default baudrate */
47 gd->baudrate = CONFIG_BAUDRATE;
55 status = fpga_boot ((unsigned char *) fpgadata, sizeof (fpgadata));
57 /* booting FPGA failed */
59 /* set up serial port with default baudrate */
61 gd->baudrate = CONFIG_BAUDRATE;
65 printf ("\nFPGA: Booting failed ");
67 case ERROR_FPGA_PRG_INIT_LOW:
68 printf ("(Timeout: INIT not low after asserting PROGRAM*)\n ");
70 case ERROR_FPGA_PRG_INIT_HIGH:
71 printf ("(Timeout: INIT not high after deasserting PROGRAM*)\n ");
73 case ERROR_FPGA_PRG_DONE:
74 printf ("(Timeout: DONE not high after programming FPGA)\n ");
78 /* display infos on fpgaimage */
80 for (i = 0; i < 4; i++) {
81 len = fpgadata[index];
82 printf ("FPGA: %s\n", &(fpgadata[index + 1]));
87 for (i = 20; i > 0; i--) {
88 printf ("Rebooting in %2d seconds \r", i);
89 for (index = 0; index < 1000; index++)
93 do_reset (NULL, 0, 0, NULL);
97 * Init FPGA via RESET (read access on CS3)
99 in_8((void *)0xf0200000);
102 * IRQ 0-15 405GP internally generated; active high; level sensitive
103 * IRQ 16 405GP internally generated; active low; level sensitive
105 * IRQ 25 (EXT IRQ 0) CAN0; active low; level sensitive
106 * IRQ 26 (EXT IRQ 1) CAN1; active low; level sensitive
107 * IRQ 27 (EXT IRQ 2) PCI SLOT 0; active low; level sensitive
108 * IRQ 28 (EXT IRQ 3) PCI SLOT 1; active low; level sensitive
109 * IRQ 29 (EXT IRQ 4) PCI SLOT 2; active low; level sensitive
110 * IRQ 30 (EXT IRQ 5) PCI SLOT 3; active low; level sensitive
111 * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
113 mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */
114 mtdcr (UIC0ER, 0x00000000); /* disable all ints */
115 mtdcr (UIC0CR, 0x00000000); /* set all to be non-critical */
116 /* mtdcr(UIC0PR, 0xFFFFFF81); / set int polarities */
117 mtdcr (UIC0PR, 0xFFFFFF80); /* set int polarities */
118 mtdcr (UIC0TR, 0x10000000); /* set int trigger levels */
119 mtdcr (UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority */
120 mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */
126 /* ------------------------------------------------------------------------- */
129 * Check Board Identity:
132 int checkboard (void)
137 int i = getenv_f("serial#", str, sizeof (str));
142 puts ("### No HW ID - assuming AR405");
149 /* display infos on fpgaimage */
151 for (i = 0; i < 4; i++) {
152 len = fpgadata[index];
153 printf ("%s ", &(fpgadata[index + 1]));
160 * Disable sleep mode in LXT971