|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
/*
|
|
|
|
|
* (C) Copyright 2001 |
|
|
|
|
* (C) Copyright 2001-2004 |
|
|
|
|
* Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com |
|
|
|
|
* |
|
|
|
|
* See file CREDITS for list of people who contributed to this |
|
|
|
@ -28,6 +28,7 @@ |
|
|
|
|
|
|
|
|
|
/*cmd_boot.c*/ |
|
|
|
|
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); |
|
|
|
|
extern void lxt971_no_sleep(void); |
|
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */ |
|
|
|
|
|
|
|
|
@ -40,6 +41,10 @@ const unsigned char fpgadata[] = { |
|
|
|
|
#include "fpgadata.c" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const unsigned char fpgadata_xl30[] = { |
|
|
|
|
#include "fpgadata_xl30.c" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* include common fpga code (for esd boards) |
|
|
|
|
*/ |
|
|
|
@ -64,45 +69,52 @@ int board_early_init_f (void) |
|
|
|
|
/*
|
|
|
|
|
* Boot onboard FPGA |
|
|
|
|
*/ |
|
|
|
|
/* first try 40er image */ |
|
|
|
|
gd->board_type = 40; |
|
|
|
|
status = fpga_boot ((unsigned char *) fpgadata, sizeof (fpgadata)); |
|
|
|
|
if (status != 0) { |
|
|
|
|
/* booting FPGA failed */ |
|
|
|
|
/* try xl30er image */ |
|
|
|
|
gd->board_type = 30; |
|
|
|
|
status = fpga_boot ((unsigned char *) fpgadata_xl30, sizeof (fpgadata_xl30)); |
|
|
|
|
if (status != 0) { |
|
|
|
|
/* booting FPGA failed */ |
|
|
|
|
#ifndef FPGA_DEBUG |
|
|
|
|
/* set up serial port with default baudrate */ |
|
|
|
|
(void) get_clocks (); |
|
|
|
|
gd->baudrate = CONFIG_BAUDRATE; |
|
|
|
|
serial_init (); |
|
|
|
|
console_init_f (); |
|
|
|
|
/* set up serial port with default baudrate */ |
|
|
|
|
(void) get_clocks (); |
|
|
|
|
gd->baudrate = CONFIG_BAUDRATE; |
|
|
|
|
serial_init (); |
|
|
|
|
console_init_f (); |
|
|
|
|
#endif |
|
|
|
|
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 = fpgadata[index]; |
|
|
|
|
printf ("FPGA: %s\n", &(fpgadata[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); |
|
|
|
|
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 = fpgadata[index]; |
|
|
|
|
printf ("FPGA: %s\n", &(fpgadata[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); |
|
|
|
|
} |
|
|
|
|
putc ('\n'); |
|
|
|
|
do_reset (NULL, 0, 0, NULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -139,32 +151,44 @@ int board_early_init_f (void) |
|
|
|
|
|
|
|
|
|
int checkboard (void) |
|
|
|
|
{ |
|
|
|
|
DECLARE_GLOBAL_DATA_PTR; |
|
|
|
|
|
|
|
|
|
int index; |
|
|
|
|
int len; |
|
|
|
|
unsigned char str[64]; |
|
|
|
|
int i = getenv_r ("serial#", str, sizeof (str)); |
|
|
|
|
const unsigned char *fpga; |
|
|
|
|
|
|
|
|
|
puts ("Board: "); |
|
|
|
|
|
|
|
|
|
if (!i || strncmp (str, "AR405", 5)) { |
|
|
|
|
puts ("### No HW ID - assuming AR405\n"); |
|
|
|
|
return (0); |
|
|
|
|
if (i == -1) { |
|
|
|
|
puts ("### No HW ID - assuming AR405"); |
|
|
|
|
} else { |
|
|
|
|
puts(str); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
puts (str); |
|
|
|
|
|
|
|
|
|
puts ("\nFPGA: "); |
|
|
|
|
|
|
|
|
|
/* display infos on fpgaimage */ |
|
|
|
|
if (gd->board_type == 30) { |
|
|
|
|
fpga = fpgadata_xl30; |
|
|
|
|
} else { |
|
|
|
|
fpga = fpgadata; |
|
|
|
|
} |
|
|
|
|
index = 15; |
|
|
|
|
for (i = 0; i < 4; i++) { |
|
|
|
|
len = fpgadata[index]; |
|
|
|
|
printf ("%s ", &(fpgadata[index + 1])); |
|
|
|
|
len = fpga[index]; |
|
|
|
|
printf ("%s ", &(fpga[index + 1])); |
|
|
|
|
index += len + 3; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
putc ('\n'); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Disable sleep mode in LXT971 |
|
|
|
|
*/ |
|
|
|
|
lxt971_no_sleep(); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|