X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fspartan2.c;h=ebac388b18ed1e77f8d6112a1ed6c1f9e2150085;hb=396f635b8ff3ccbc38d75d5eda98444c6466810a;hp=06550b9858cde121928d6b9beab8bffebb176f1c;hpb=efe33035acd5f7c13963a4d52e5aac1b68612ae4;p=u-boot diff --git a/common/spartan2.c b/common/spartan2.c index 06550b9858..ebac388b18 100644 --- a/common/spartan2.c +++ b/common/spartan2.c @@ -25,8 +25,6 @@ #include /* core U-Boot definitions */ #include /* Spartan-II device family */ -#if (CONFIG_FPGA & (CFG_XILINX | CFG_SPARTAN2)) - /* Define FPGA_DEBUG to get debug printf's */ #ifdef FPGA_DEBUG #define PRINTF(fmt,args...) printf (fmt ,##args) @@ -441,7 +439,7 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) int ret_val = FPGA_FAIL; /* assume the worst */ Xilinx_Spartan2_Slave_Serial_fns *fn = desc->iface_fns; int i; - char val; + unsigned char val; PRINTF ("%s: start with interface functions @ 0x%p\n", __FUNCTION__, fn); @@ -561,6 +559,13 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) } putc ('\n'); /* terminate the dotted line */ + /* + * Run the post configuration function if there is one. + */ + if (*fn->post) { + (*fn->post) (cookie); + } + #ifdef CFG_FPGA_PROG_FEEDBACK if (ret_val == FPGA_SUCCESS) { puts ("Done.\n"); @@ -615,8 +620,10 @@ static int Spartan2_ss_reloc (Xilinx_desc * desc, ulong reloc_offset) PRINTF ("%s: Relocating descriptor at 0x%p\n", __FUNCTION__, desc); - addr = (ulong) (fn->pre) + reloc_offset; - fn_r->pre = (Xilinx_pre_fn) addr; + if (fn->pre) { + addr = (ulong) (fn->pre) + reloc_offset; + fn_r->pre = (Xilinx_pre_fn) addr; + } addr = (ulong) (fn->pgm) + reloc_offset; fn_r->pgm = (Xilinx_pgm_fn) addr; @@ -633,6 +640,11 @@ static int Spartan2_ss_reloc (Xilinx_desc * desc, ulong reloc_offset) addr = (ulong) (fn->wr) + reloc_offset; fn_r->wr = (Xilinx_wr_fn) addr; + if (fn->post) { + addr = (ulong) (fn->post) + reloc_offset; + fn_r->post = (Xilinx_post_fn) addr; + } + fn_r->relocated = TRUE; } else { @@ -649,5 +661,3 @@ static int Spartan2_ss_reloc (Xilinx_desc * desc, ulong reloc_offset) return ret_val; } - -#endif