]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Add pre and post configuration callbacks for Spartan FPGAs
authorMatthias Fuchs <matthias.fuchs@esd-electronics.com>
Thu, 27 Dec 2007 16:12:43 +0000 (17:12 +0100)
committerWolfgang Denk <wd@denx.de>
Wed, 9 Jan 2008 12:35:52 +0000 (13:35 +0100)
This patch adds a post configuration callback for Spartan2/3 FPGAs.
pre and post configuration callback are now optional and
not called when the function pointer is set to NULL.

Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
common/spartan2.c
common/spartan3.c
include/spartan2.h
include/spartan3.h

index 457009f8584ebacb61a8777059f95e1e052859fc..ef107bcbc864f60fe803e540429517e076db4513 100644 (file)
@@ -561,6 +561,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 +622,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 +642,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 {
index 17379eb8b1e16b31fbb5065fecd3c2ce650dfbc2..56a172e0be8e838179d12afc5c0812ce43944fac 100644 (file)
@@ -566,6 +566,13 @@ static int Spartan3_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");
@@ -620,8 +627,10 @@ static int Spartan3_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;
@@ -638,6 +647,11 @@ static int Spartan3_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 {
index d2e81e38ab5bae6a019c75fec42332afe77fe729..f3cde688f7829d8954cb1af91890219bdae14797 100644 (file)
@@ -58,6 +58,7 @@ typedef struct {
        Xilinx_init_fn  init;
        Xilinx_done_fn  done;
        Xilinx_wr_fn    wr;
+       Xilinx_post_fn  post;
        int             relocated;
 } Xilinx_Spartan2_Slave_Serial_fns;
 
index 65a3f5a4dbc7908514c44b8651c3270ced06bd78..529aade657726acd6f83faab4b0c1c4714756f8a 100644 (file)
@@ -58,6 +58,7 @@ typedef struct {
        Xilinx_init_fn  init;
        Xilinx_done_fn  done;
        Xilinx_wr_fn    wr;
+       Xilinx_post_fn  post;
        int             relocated;
 } Xilinx_Spartan3_Slave_Serial_fns;