2 * (C) Copyright 2000, 2001
3 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
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,
26 #include <asm/processor.h>
27 #include <asm/ppc4xx.h>
28 #include <asm/ppc4xx-i2c.h>
31 DECLARE_GLOBAL_DATA_PTR;
33 extern void lxt971_no_sleep(void);
44 /* fpga configuration data - generated by bin2cc */
45 const unsigned char fpgadata[] = {
50 * include common fpga code (for esd boards)
52 #include "../common/fpga.c"
55 int board_early_init_f (void)
61 /* set up serial port with default baudrate */
63 gd->baudrate = CONFIG_BAUDRATE;
71 status = fpga_boot ((unsigned char *) fpgadata, sizeof (fpgadata));
73 /* booting FPGA failed */
75 /* set up serial port with default baudrate */
77 gd->baudrate = CONFIG_BAUDRATE;
81 printf ("\nFPGA: Booting failed ");
83 case ERROR_FPGA_PRG_INIT_LOW:
84 printf ("(Timeout: INIT not low after asserting PROGRAM*)\n ");
86 case ERROR_FPGA_PRG_INIT_HIGH:
87 printf ("(Timeout: INIT not high after deasserting PROGRAM*)\n ");
89 case ERROR_FPGA_PRG_DONE:
90 printf ("(Timeout: DONE not high after programming FPGA)\n ");
94 /* display infos on fpgaimage */
96 for (i = 0; i < 4; i++) {
97 len = fpgadata[index];
98 printf ("FPGA: %s\n", &(fpgadata[index + 1]));
103 for (i = 20; i > 0; i--) {
104 printf ("Rebooting in %2d seconds \r", i);
105 for (index = 0; index < 1000; index++)
109 do_reset (NULL, 0, 0, NULL);
113 * IRQ 0-15 405GP internally generated; active high; level sensitive
114 * IRQ 16 405GP internally generated; active low; level sensitive
116 * IRQ 25 (EXT IRQ 0) CAN0; active low; level sensitive
117 * IRQ 26 (EXT IRQ 1) DUART_A; active high; level sensitive
118 * IRQ 27 (EXT IRQ 2) DUART_B; active high; level sensitive
119 * IRQ 28 (EXT IRQ 3) unused; active low; level sensitive
120 * IRQ 29 (EXT IRQ 4) unused; active low; level sensitive
121 * IRQ 30 (EXT IRQ 5) unused; active low; level sensitive
122 * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
124 mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */
125 mtdcr (UIC0ER, 0x00000000); /* disable all ints */
126 mtdcr (UIC0CR, 0x00000000); /* set all to be non-critical */
127 mtdcr (UIC0PR, 0xFFFFFFB1); /* set int polarities */
128 mtdcr (UIC0TR, 0x10000000); /* set int trigger levels */
129 mtdcr (UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority */
130 mtdcr (UIC0SR, 0xFFFFFFFF); /* clear all ints */
133 * EBC Configuration Register: set ready timeout to 100 us
135 mtebc (EBC0_CFG, 0xb8400000);
141 int misc_init_r (void)
143 unsigned long CPC0_CR0Reg;
146 * Setup UART1 handshaking: use CTS instead of DSR
148 CPC0_CR0Reg = mfdcr(CPC0_CR0);
149 mtdcr(CPC0_CR0, CPC0_CR0Reg | 0x00001000);
156 * Check Board Identity:
158 int checkboard (void)
163 int i = getenv_f("serial#", str, sizeof (str));
168 puts ("### No HW ID - assuming DU405");
175 /* display infos on fpgaimage */
177 for (i = 0; i < 4; i++) {
178 len = fpgadata[index];
179 printf ("%s ", &(fpgadata[index + 1]));
186 * Reset external DUART via FPGA
188 out_8((void *)FPGA_MODE_REG, 0xff); /* reset high active */
189 out_8((void *)FPGA_MODE_REG, 0x00); /* low again */
196 #if defined(CONFIG_LXT971_NO_SLEEP)
199 * Disable sleep mode in LXT971