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,
25 #include "cpciiser4.h"
26 #include <asm/processor.h>
30 /* ------------------------------------------------------------------------- */
40 /* fpga configuration data - generated by bin2cc */
41 const unsigned char fpgadata[] = {
46 * include common fpga code (for esd boards)
48 #include "../common/fpga.c"
51 int board_pre_init (void)
53 DECLARE_GLOBAL_DATA_PTR;
56 volatile unsigned char dummy;
60 /* set up serial port with default baudrate */
62 gd->baudrate = CONFIG_BAUDRATE;
70 status = fpga_boot ((unsigned char *) fpgadata, sizeof (fpgadata));
72 /* booting FPGA failed */
74 /* set up serial port with default baudrate */
76 gd->baudrate = CONFIG_BAUDRATE;
80 printf ("\nFPGA: Booting failed ");
82 case ERROR_FPGA_PRG_INIT_LOW:
83 printf ("(Timeout: INIT not low after asserting PROGRAM*)\n ");
85 case ERROR_FPGA_PRG_INIT_HIGH:
86 printf ("(Timeout: INIT not high after deasserting PROGRAM*)\n ");
88 case ERROR_FPGA_PRG_DONE:
89 printf ("(Timeout: DONE not high after programming FPGA)\n ");
93 /* display infos on fpgaimage */
95 for (i = 0; i < 4; i++) {
96 len = fpgadata[index];
97 printf ("FPGA: %s\n", &(fpgadata[index + 1]));
102 for (i = 20; i > 0; i--) {
103 printf ("Rebooting in %2d seconds \r", i);
104 for (index = 0; index < 1000; index++)
108 do_reset (NULL, 0, 0, NULL);
112 * Init FPGA via RESET (read access on CS3)
114 dummy = *(unsigned char *) 0xf0200000;
117 * IRQ 0-15 405GP internally generated; active high; level sensitive
118 * IRQ 16 405GP internally generated; active low; level sensitive
120 * IRQ 25 (EXT IRQ 0) CAN0; active low; level sensitive
121 * IRQ 26 (EXT IRQ 1) CAN1; active low; level sensitive
122 * IRQ 27 (EXT IRQ 2) PCI SLOT 0; active low; level sensitive
123 * IRQ 28 (EXT IRQ 3) PCI SLOT 1; active low; level sensitive
124 * IRQ 29 (EXT IRQ 4) PCI SLOT 2; active low; level sensitive
125 * IRQ 30 (EXT IRQ 5) PCI SLOT 3; active low; level sensitive
126 * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
128 mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
129 mtdcr (uicer, 0x00000000); /* disable all ints */
130 mtdcr (uiccr, 0x00000000); /* set all to be non-critical */
131 /* mtdcr(uicpr, 0xFFFFFF81); / set int polarities */
132 mtdcr (uicpr, 0xFFFFFF80); /* set int polarities */
133 mtdcr (uictr, 0x10000000); /* set int trigger levels */
134 mtdcr (uicvcr, 0x00000001); /* set vect base=0,INT0 highest priority */
135 mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
141 /* ------------------------------------------------------------------------- */
144 * Check Board Identity:
147 int checkboard (void)
151 unsigned char str[64];
152 int i = getenv_r ("serial#", str, sizeof (str));
156 if (!i || strncmp (str, "CPCIISER4", 9)) {
157 puts ("### No HW ID - assuming CPCIISER4\n");
165 /* display infos on fpgaimage */
167 for (i = 0; i < 4; i++) {
168 len = fpgadata[index];
169 printf ("%s ", &(fpgadata[index + 1]));
178 /* ------------------------------------------------------------------------- */
180 long int initdram (int board_type)
182 return (16 * 1024 * 1024);
185 /* ------------------------------------------------------------------------- */
189 /* TODO: XXX XXX XXX */
190 printf ("test: 16 MB - ok\n");
195 /* ------------------------------------------------------------------------- */