4 * http://www.dave-tech.it
5 * http://www.wawnet.biz
6 * mailto:info@wawnet.biz
8 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/processor.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 /* ------------------------------------------------------------------------- */
20 int board_early_init_f (void)
22 out32(GPIO0_OR, CONFIG_SYS_NAND0_CE); /* set initial outputs */
23 out32(GPIO0_OR, CONFIG_SYS_NAND1_CE); /* set initial outputs */
26 * IRQ 0-15 405GP internally generated; active high; level sensitive
27 * IRQ 16 405GP internally generated; active low; level sensitive
37 mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
38 mtdcr(UIC0ER, 0x00000000); /* disable all ints */
39 mtdcr(UIC0CR, 0x00000000); /* set all to be non-critical*/
40 mtdcr(UIC0PR, 0xFFFFFF80); /* set int polarities */
41 mtdcr(UIC0TR, 0x10000000); /* set int trigger levels */
42 mtdcr(UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority*/
43 mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
46 * EBC Configuration Register: set ready timeout to 512 ebc-clks -> ca. 15 us
49 mtebc (EBC0_CFG, 0xa8400000); /* ebc always driven */
51 mtebc (EBC0_CFG, 0x28400000); /* ebc in high-z */
56 /* ------------------------------------------------------------------------- */
58 int misc_init_f (void)
60 return 0; /* dummy implementation */
63 extern flash_info_t flash_info[]; /* info for FLASH chips */
65 int misc_init_r (void)
67 /* adjust flash start and size as well as the offset */
68 gd->bd->bi_flashstart = 0 - flash_info[0].size;
69 gd->bd->bi_flashoffset= flash_info[0].size - CONFIG_SYS_MONITOR_LEN;
71 volatile unsigned short *fpga_mode =
72 (unsigned short *)((ulong)CONFIG_SYS_FPGA_BASE_ADDR + CONFIG_SYS_FPGA_CTRL);
73 volatile unsigned char *duart0_mcr =
74 (unsigned char *)((ulong)DUART0_BA + 4);
75 volatile unsigned char *duart1_mcr =
76 (unsigned char *)((ulong)DUART1_BA + 4);
79 char * tmp; /* Temporary char pointer */
81 ulong len = sizeof(fpgadata);
85 unsigned long CPC0_CR0Reg;
87 dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
88 if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
89 printf ("GUNZIP ERROR - must RESET board to recover\n");
90 do_reset (NULL, 0, 0, NULL);
93 status = fpga_boot(dst, len);
95 printf("\nFPGA: Booting failed ");
97 case ERROR_FPGA_PRG_INIT_LOW:
98 printf("(Timeout: INIT not low after asserting PROGRAM*)\n ");
100 case ERROR_FPGA_PRG_INIT_HIGH:
101 printf("(Timeout: INIT not high after deasserting PROGRAM*)\n ");
103 case ERROR_FPGA_PRG_DONE:
104 printf("(Timeout: DONE not high after programming FPGA)\n ");
108 /* display infos on fpgaimage */
110 for (i=0; i<4; i++) {
112 printf("FPGA: %s\n", &(dst[index+1]));
117 for (i=20; i>0; i--) {
118 printf("Rebooting in %2d seconds \r",i);
119 for (index=0;index<1000;index++)
123 do_reset(NULL, 0, 0, NULL);
128 /* display infos on fpgaimage */
130 for (i=0; i<4; i++) {
132 printf("%s ", &(dst[index+1]));
140 * Reset FPGA via FPGA_DATA pin
142 SET_FPGA(FPGA_PRG | FPGA_CLK);
143 udelay(1000); /* wait 1ms */
144 SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA);
145 udelay(1000); /* wait 1ms */
150 * Enable power on PS/2 interface
152 *fpga_mode |= CONFIG_SYS_FPGA_CTRL_PS2_RESET;
155 * Enable interrupts in exar duart mcr[3]
164 * Check Board Identity:
167 int checkboard (void)
170 int i = getenv_f("serial#", str, sizeof(str));
175 puts ("### No HW ID - assuming PPChameleonEVB");
185 /* ------------------------------------------------------------------------- */
189 /* TODO: XXX XXX XXX */
190 printf ("test: 16 MB - ok\n");
195 /* ------------------------------------------------------------------------- */
197 #ifdef CONFIG_CFB_CONSOLE
198 # ifdef CONFIG_CONSOLE_EXTRA_INFO
199 # include <video_fb.h>
200 extern GraphicDevice smi;
202 void video_get_info_str (int line_number, char *info)
204 uint pvr = get_pvr ();
206 /* init video info strings for graphic console */
207 switch (line_number) {
211 sprintf (info, " AMCC PowerPC 405EP Rev. B");
214 sprintf (info, " AMCC PowerPC 405EP Rev. <unknown>");
219 sprintf (info, " DAVE Srl PPChameleonEVB - www.dave-tech.it");
222 sprintf (info, " %s", smi.modeIdent);
226 /* no more info lines */
230 # endif /* CONFIG_CONSOLE_EXTRA_INFO */
231 #endif /* CONFIG_CFB_CONSOLE */