|
|
|
@ -26,11 +26,13 @@ |
|
|
|
|
#include <command.h> |
|
|
|
|
#include <malloc.h> |
|
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Prototypes */ |
|
|
|
|
int gunzip(void *, int, unsigned char *, int *); |
|
|
|
|
/* fpga configuration data - not compressed, generated by bin2c */ |
|
|
|
|
const unsigned char fpgadata[] = |
|
|
|
|
{ |
|
|
|
|
#include "fpgadata.c" |
|
|
|
|
}; |
|
|
|
|
int filesize = sizeof(fpgadata); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int board_pre_init (void) |
|
|
|
@ -74,104 +76,6 @@ int misc_init_f (void) |
|
|
|
|
|
|
|
|
|
int misc_init_r (void) |
|
|
|
|
{ |
|
|
|
|
#if 0 /* test-only */
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR; |
|
|
|
|
volatile unsigned short *fpga_mode = |
|
|
|
|
(unsigned short *)((ulong)CFG_FPGA_BASE_ADDR + CFG_FPGA_CTRL); |
|
|
|
|
volatile unsigned char *duart0_mcr = |
|
|
|
|
(unsigned char *)((ulong)DUART0_BA + 4); |
|
|
|
|
volatile unsigned char *duart1_mcr = |
|
|
|
|
(unsigned char *)((ulong)DUART1_BA + 4); |
|
|
|
|
bd_t *bd = gd->bd; |
|
|
|
|
char * tmp; /* Temporary char pointer */ |
|
|
|
|
unsigned char *dst; |
|
|
|
|
ulong len = sizeof(fpgadata); |
|
|
|
|
int status; |
|
|
|
|
int index; |
|
|
|
|
int i; |
|
|
|
|
unsigned long cntrl0Reg; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup GPIO pins (CS6+CS7 as GPIO) |
|
|
|
|
*/ |
|
|
|
|
cntrl0Reg = mfdcr(cntrl0); |
|
|
|
|
mtdcr(cntrl0, cntrl0Reg | 0x00300000); |
|
|
|
|
|
|
|
|
|
dst = malloc(CFG_FPGA_MAX_SIZE); |
|
|
|
|
if (gunzip (dst, CFG_FPGA_MAX_SIZE, (uchar *)fpgadata, (int *)&len) != 0) { |
|
|
|
|
printf ("GUNZIP ERROR - must RESET board to recover\n"); |
|
|
|
|
do_reset (NULL, 0, 0, NULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status = fpga_boot(dst, len); |
|
|
|
|
if (status != 0) { |
|
|
|
|
printf("\nFPGA: Booting failed "); |
|
|
|
|
switch (status) { |
|
|
|
|
case ERROR_FPGA_PRG_INIT_LOW: |
|
|
|
|
printf("(Timeout: INIT not low after asserting PROGRAM*)\n "); |
|
|
|
|
break; |
|
|
|
|
case ERROR_FPGA_PRG_INIT_HIGH: |
|
|
|
|
printf("(Timeout: INIT not high after deasserting PROGRAM*)\n "); |
|
|
|
|
break; |
|
|
|
|
case ERROR_FPGA_PRG_DONE: |
|
|
|
|
printf("(Timeout: DONE not high after programming FPGA)\n "); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* display infos on fpgaimage */ |
|
|
|
|
index = 15; |
|
|
|
|
for (i=0; i<4; i++) { |
|
|
|
|
len = dst[index]; |
|
|
|
|
printf("FPGA: %s\n", &(dst[index+1])); |
|
|
|
|
index += len+3; |
|
|
|
|
} |
|
|
|
|
putc ('\n'); |
|
|
|
|
/* delayed reboot */ |
|
|
|
|
for (i=20; i>0; i--) { |
|
|
|
|
printf("Rebooting in %2d seconds \r",i); |
|
|
|
|
for (index=0;index<1000;index++) |
|
|
|
|
udelay(1000); |
|
|
|
|
} |
|
|
|
|
putc ('\n'); |
|
|
|
|
do_reset(NULL, 0, 0, NULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* restore gpio/cs settings */ |
|
|
|
|
mtdcr(cntrl0, cntrl0Reg); |
|
|
|
|
|
|
|
|
|
puts("FPGA: "); |
|
|
|
|
|
|
|
|
|
/* display infos on fpgaimage */ |
|
|
|
|
index = 15; |
|
|
|
|
for (i=0; i<4; i++) { |
|
|
|
|
len = dst[index]; |
|
|
|
|
printf("%s ", &(dst[index+1])); |
|
|
|
|
index += len+3; |
|
|
|
|
} |
|
|
|
|
putc ('\n'); |
|
|
|
|
|
|
|
|
|
free(dst); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Reset FPGA via FPGA_DATA pin |
|
|
|
|
*/ |
|
|
|
|
SET_FPGA(FPGA_PRG | FPGA_CLK); |
|
|
|
|
udelay(1000); /* wait 1ms */ |
|
|
|
|
SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA); |
|
|
|
|
udelay(1000); /* wait 1ms */ |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Enable power on PS/2 interface |
|
|
|
|
*/ |
|
|
|
|
*fpga_mode |= CFG_FPGA_CTRL_PS2_RESET; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Enable interrupts in exar duart mcr[3] |
|
|
|
|
*/ |
|
|
|
|
*duart0_mcr = 0x08; |
|
|
|
|
*duart1_mcr = 0x08; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
return (0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -188,7 +92,7 @@ int checkboard (void) |
|
|
|
|
puts ("Board: "); |
|
|
|
|
|
|
|
|
|
if (i == -1) { |
|
|
|
|
puts ("### No HW ID - assuming ABG405"); |
|
|
|
|
puts ("### No HW ID - assuming PMC405"); |
|
|
|
|
} else { |
|
|
|
|
puts(str); |
|
|
|
|
} |
|
|
|
|