2 * (C) Copyright 2000, 2001
3 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/processor.h>
11 #include <asm/ppc4xx.h>
12 #include <asm/ppc4xx-i2c.h>
15 DECLARE_GLOBAL_DATA_PTR;
17 extern void lxt971_no_sleep(void);
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 * IRQ 0-15 405GP internally generated; active high; level sensitive
98 * IRQ 16 405GP internally generated; active low; level sensitive
100 * IRQ 25 (EXT IRQ 0) CAN0; active low; level sensitive
101 * IRQ 26 (EXT IRQ 1) DUART_A; active high; level sensitive
102 * IRQ 27 (EXT IRQ 2) DUART_B; active high; level sensitive
103 * IRQ 28 (EXT IRQ 3) unused; active low; level sensitive
104 * IRQ 29 (EXT IRQ 4) unused; active low; level sensitive
105 * IRQ 30 (EXT IRQ 5) unused; active low; level sensitive
106 * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
108 mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */
109 mtdcr (UIC0ER, 0x00000000); /* disable all ints */
110 mtdcr (UIC0CR, 0x00000000); /* set all to be non-critical */
111 mtdcr (UIC0PR, 0xFFFFFFB1); /* set int polarities */
112 mtdcr (UIC0TR, 0x10000000); /* set int trigger levels */
113 mtdcr (UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority */
114 mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */
117 * EBC Configuration Register: set ready timeout to 100 us
119 mtebc (EBC0_CFG, 0xb8400000);
125 int misc_init_r (void)
127 unsigned long CPC0_CR0Reg;
130 * Setup UART1 handshaking: use CTS instead of DSR
132 CPC0_CR0Reg = mfdcr(CPC0_CR0);
133 mtdcr(CPC0_CR0, CPC0_CR0Reg | 0x00001000);
140 * Check Board Identity:
142 int checkboard (void)
147 int i = getenv_f("serial#", str, sizeof (str));
152 puts ("### No HW ID - assuming DU405");
159 /* display infos on fpgaimage */
161 for (i = 0; i < 4; i++) {
162 len = fpgadata[index];
163 printf ("%s ", &(fpgadata[index + 1]));
170 * Reset external DUART via FPGA
172 out_8((void *)FPGA_MODE_REG, 0xff); /* reset high active */
173 out_8((void *)FPGA_MODE_REG, 0x00); /* low again */
180 #if defined(CONFIG_LXT971_NO_SLEEP)
183 * Disable sleep mode in LXT971