* [U-Boot-Users] [PATCH 2/5 RESEND] Add pre and post configuration callbacks for Spartan FPGAs
@ 2007-12-27 16:12 Matthias Fuchs
2008-01-09 12:36 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Fuchs @ 2007-12-27 16:12 UTC (permalink / raw)
To: u-boot
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 | 18 ++++++++++++++++--
common/spartan3.c | 18 ++++++++++++++++--
include/spartan2.h | 1 +
include/spartan3.h | 1 +
4 files changed, 34 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 {
diff --git a/include/spartan2.h b/include/spartan2.h
index d2e81e3..f3cde68 100644
--- a/include/spartan2.h
+++ b/include/spartan2.h
@@ -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;
diff --git a/include/spartan3.h b/include/spartan3.h
index 65a3f5a..529aade 100644
--- a/include/spartan3.h
+++ b/include/spartan3.h
@@ -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;
--
1.5.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot-Users] [PATCH 2/5 RESEND] Add pre and post configuration callbacks for Spartan FPGAs
2007-12-27 16:12 [U-Boot-Users] [PATCH 2/5 RESEND] Add pre and post configuration callbacks for Spartan FPGAs Matthias Fuchs
@ 2008-01-09 12:36 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2008-01-09 12:36 UTC (permalink / raw)
To: u-boot
In message <200712271712.44027.matthias.fuchs@esd-electronics.com> you wrote:
> 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>
Applied, thanks.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Cogito cogito ergo cogito sum - "I think that I think, therefore I
think that I am." - Ambrose Bierce, "The Devil's Dictionary"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-09 12:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-27 16:12 [U-Boot-Users] [PATCH 2/5 RESEND] Add pre and post configuration callbacks for Spartan FPGAs Matthias Fuchs
2008-01-09 12:36 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox