4 * http://www.dave-tech.it
5 * http://www.wawnet.biz
6 * mailto:info@wawnet.biz
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <asm/processor.h>
33 /* ------------------------------------------------------------------------- */
38 int gunzip(void *, int, unsigned char *, int *);
41 int board_early_init_f (void)
43 out32(GPIO0_OR, CFG_NAND0_CE); /* set initial outputs */
44 out32(GPIO0_OR, CFG_NAND1_CE); /* set initial outputs */
47 * IRQ 0-15 405GP internally generated; active high; level sensitive
48 * IRQ 16 405GP internally generated; active low; level sensitive
58 mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
59 mtdcr(uicer, 0x00000000); /* disable all ints */
60 mtdcr(uiccr, 0x00000000); /* set all to be non-critical*/
61 mtdcr(uicpr, 0xFFFFFF80); /* set int polarities */
62 mtdcr(uictr, 0x10000000); /* set int trigger levels */
63 mtdcr(uicvcr, 0x00000001); /* set vect base=0,INT0 highest priority*/
64 mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
67 * EBC Configuration Register: set ready timeout to 512 ebc-clks -> ca. 15 us
70 mtebc (epcr, 0xa8400000); /* ebc always driven */
72 mtebc (epcr, 0x28400000); /* ebc in high-z */
79 /* ------------------------------------------------------------------------- */
81 int misc_init_f (void)
83 return 0; /* dummy implementation */
86 extern flash_info_t flash_info[]; /* info for FLASH chips */
88 int misc_init_r (void)
90 DECLARE_GLOBAL_DATA_PTR;
92 /* adjust flash start and size as well as the offset */
93 gd->bd->bi_flashstart = 0 - flash_info[0].size;
94 gd->bd->bi_flashoffset= flash_info[0].size - CFG_MONITOR_LEN;
96 volatile unsigned short *fpga_mode =
97 (unsigned short *)((ulong)CFG_FPGA_BASE_ADDR + CFG_FPGA_CTRL);
98 volatile unsigned char *duart0_mcr =
99 (unsigned char *)((ulong)DUART0_BA + 4);
100 volatile unsigned char *duart1_mcr =
101 (unsigned char *)((ulong)DUART1_BA + 4);
104 char * tmp; /* Temporary char pointer */
106 ulong len = sizeof(fpgadata);
110 unsigned long cntrl0Reg;
112 dst = malloc(CFG_FPGA_MAX_SIZE);
113 if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, (int *)&len) != 0) {
114 printf ("GUNZIP ERROR - must RESET board to recover\n");
115 do_reset (NULL, 0, 0, NULL);
118 status = fpga_boot(dst, len);
120 printf("\nFPGA: Booting failed ");
122 case ERROR_FPGA_PRG_INIT_LOW:
123 printf("(Timeout: INIT not low after asserting PROGRAM*)\n ");
125 case ERROR_FPGA_PRG_INIT_HIGH:
126 printf("(Timeout: INIT not high after deasserting PROGRAM*)\n ");
128 case ERROR_FPGA_PRG_DONE:
129 printf("(Timeout: DONE not high after programming FPGA)\n ");
133 /* display infos on fpgaimage */
135 for (i=0; i<4; i++) {
137 printf("FPGA: %s\n", &(dst[index+1]));
142 for (i=20; i>0; i--) {
143 printf("Rebooting in %2d seconds \r",i);
144 for (index=0;index<1000;index++)
148 do_reset(NULL, 0, 0, NULL);
153 /* display infos on fpgaimage */
155 for (i=0; i<4; i++) {
157 printf("%s ", &(dst[index+1]));
165 * Reset FPGA via FPGA_DATA pin
167 SET_FPGA(FPGA_PRG | FPGA_CLK);
168 udelay(1000); /* wait 1ms */
169 SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA);
170 udelay(1000); /* wait 1ms */
176 * Enable power on PS/2 interface
178 *fpga_mode |= CFG_FPGA_CTRL_PS2_RESET;
181 * Enable interrupts in exar duart mcr[3]
191 * Check Board Identity:
194 int checkboard (void)
196 unsigned char str[64];
197 int i = getenv_r ("serial#", str, sizeof(str));
202 puts ("### No HW ID - assuming PPChameleonEVB");
212 /* ------------------------------------------------------------------------- */
214 long int initdram (int board_type)
218 mtdcr(memcfga, mem_mb0cf);
219 val = mfdcr(memcfgd);
221 #if 0 /* test-only */
230 printf("\nmb0cf=%x\n", val); /* test-only */
231 printf("strap=%x\n", mfdcr(strap)); /* test-only */
234 return (4*1024*1024 << ((val & 0x000e0000) >> 17));
237 /* ------------------------------------------------------------------------- */
241 /* TODO: XXX XXX XXX */
242 printf ("test: 16 MB - ok\n");
247 /* ------------------------------------------------------------------------- */
249 #if (CONFIG_COMMANDS & CFG_CMD_NAND)
251 nand_probe(ulong physadr);
259 The HI model is equipped with a large block NAND chip not supported yet
261 (CONFIG_PPCHAMELEON_MODULE_MODEL == CONFIG_PPCHAMELEON_MODULE_HI)
264 #if (CONFIG_PPCHAMELEON_MODULE_MODEL == CONFIG_PPCHAMELEON_MODULE_ME)
265 debug ("Probing at 0x%.8x\n", CFG_NAND0_BASE);
266 totlen += nand_probe (CFG_NAND0_BASE);
267 #endif /* CONFIG_PPCHAMELEON_MODULE_ME, CONFIG_PPCHAMELEON_MODULE_HI */
269 debug ("Probing at 0x%.8x\n", CFG_NAND1_BASE);
270 totlen += nand_probe (CFG_NAND1_BASE);
272 printf ("%4lu MB\n", totlen >>20);
276 #ifdef CONFIG_CFB_CONSOLE
277 # ifdef CONFIG_CONSOLE_EXTRA_INFO
278 # include <video_fb.h>
279 extern GraphicDevice smi;
281 void video_get_info_str (int line_number, char *info)
283 uint pvr = get_pvr ();
285 /* init video info strings for graphic console */
286 switch (line_number) {
290 sprintf (info, " IBM PowerPC 405EP Rev. B");
293 sprintf (info, " IBM PowerPC 405EP Rev. <unknown>");
298 sprintf (info, " DAVE Srl PPChameleonEVB - www.dave-tech.it");
301 sprintf (info, " %s", smi.modeIdent);
305 /* no more info lines */
309 # endif /* CONFIG_CONSOLE_EXTRA_INFO */
310 #endif /* CONFIG_CFB_CONSOLE */