fpga: Fix Spartan II FPGA booting
PATCH 1/1 fpga: Fix Spartan II FPGA booting
This patch does some minor fixing of the Xilinx Spartan II FPGA boot code:
- Fixed call order of post configuration callback and success message printing (result of copy-paste?)
- relocate post configuration callback only when it is implemented
- remove obsolete comment
- minor coding style cleanup
Signed-off-by Matthias Fuchs <[email protected]>
--- drivers/fpga/spartan2.c | 32 +++++++++++--------------------- 1 files changed, 11 insertions(+), 21 deletions(-)
drivers/fpga/spartan2.c +11 -21
@@ -260,8 +260,6 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void *buf, size_t bsize) ts =get_timer (0 );/* get current time */ ret_val =FPGA_SUCCESS ;while ((*fn->done) (cookie) ==FPGA_FAIL ) { -/* XXX - we should have a check in here somewhere to -* make sure we aren't busy forever... */ CONFIG_FPGA_DELAY (); (*fn->clk) (FALSE, TRUE, cookie);/* Deassert the clock pin */
@@ -276,23 +274,18 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void *buf, size_t bsize) } } -if (ret_val ==FPGA_SUCCESS ) { -#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK -puts ("Done.\n" ); -#endif - }/* * Run the post configuration function if there is one. */ -if (*fn->post) { +if (*fn->post) (*fn->post) (cookie); - } -else {#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK +if (ret_val ==FPGA_SUCCESS ) +puts ("Done.\n" ); +else puts ("Fail.\n" );#endif - } }else {printf ("%s: NULL Interface function table!\n" , __FUNCTION__);
@@ -412,8 +405,10 @@ static int Spartan2_sp_reloc (Xilinx_desc * desc, ulong reloc_offset) addr = (ulong) (fn->abort) + reloc_offset; fn_r->abort = (Xilinx_abort_fn ) addr; - addr = (ulong) (fn->post) + reloc_offset; - fn_r->post = (Xilinx_post_fn ) addr; +if (fn->post) { + addr = (ulong) (fn->post) + reloc_offset; + fn_r->post = (Xilinx_post_fn ) addr; + } fn_r->relocated = TRUE;
@@ -541,8 +536,6 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) (*fn->wr) (TRUE, TRUE, cookie);while (! (*fn->done) (cookie)) { -/* XXX - we should have a check in here somewhere to -* make sure we aren't busy forever... */ CONFIG_FPGA_DELAY (); (*fn->clk) (FALSE, TRUE, cookie);/* Deassert the clock pin */
@@ -562,17 +555,14 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)/* * Run the post configuration function if there is one. */ -if (*fn->post) { +if (*fn->post) (*fn->post) (cookie); - }#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK -if (ret_val ==FPGA_SUCCESS ) { +if (ret_val ==FPGA_SUCCESS )puts ("Done.\n" ); - } -else { +else puts ("Fail.\n" ); - }#endif }else {
Signature · 1 line
1.5.6.3
Wolfgang Denk
AppliedPATCH 1/1 fpga: Fix Spartan II FPGA booting
Dear Matthias Fuchs,
Quoted 10 lines · In message <[email protected]> you wrote:
This patch does some minor fixing of the Xilinx Spartan II FPGA boot code:
- Fixed call order of post configuration callback and success message printing (result of copy-paste?)
- relocate post configuration callback only when it is implemented
- remove obsolete comment
- minor coding style cleanup
Quoted 4 lines
Signed-off-by Matthias Fuchs <[email protected]>--- drivers/fpga/spartan2.c | 32 +++++++++++--------------------- 1 files changed, 11 insertions(+), 21 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I paid too much for it, but its worth it.