summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMatthias Fuchs <matthias.fuchs@esd-electronics.com>2007-12-27 17:12:43 +0100
committerWolfgang Denk <wd@denx.de>2008-01-09 13:35:52 +0100
commit21d39d598c4e74d4e7761608c79dba2715d40a4c (patch)
tree678ab7b82fea0b71f1b0fe833605a5d0ed14996e /common
parent0133502e39ff89b67c26cb4015e0e7e8d9571184 (diff)
downloadu-boot-imx-21d39d598c4e74d4e7761608c79dba2715d40a4c.zip
u-boot-imx-21d39d598c4e74d4e7761608c79dba2715d40a4c.tar.gz
u-boot-imx-21d39d598c4e74d4e7761608c79dba2715d40a4c.tar.bz2
Add pre and post configuration callbacks for Spartan FPGAs
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>
Diffstat (limited to 'common')
-rw-r--r--common/spartan2.c18
-rw-r--r--common/spartan3.c18
2 files changed, 32 insertions, 4 deletions
diff --git a/common/spartan2.c b/common/spartan2.c
index 457009f..ef107bc 100644
--- a/common/spartan2.c
+++ b/common/spartan2.c
@@ -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 {
diff --git a/common/spartan3.c b/common/spartan3.c
index 17379eb..56a172e 100644
--- a/common/spartan3.c
+++ b/common/spartan3.c
@@ -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 {