Skip to contentSkip to conversation

add Xilinx_abort_fn to Xilinx_Spartan3_Slave_Serial_fns

PATCH New Wolfgang Wegner 2 participants 2 messages Apr 23, 2010 – Nov 30, 2010 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add Xilinx_abort_fn to Xilinx_Spartan3_Slave_Serial_fns

Currently the hardware was left in an undefined state in case Spartan3 serial load failed. This patch adds Xilinx_abort_fn to give the board a possibility to clean up in this case.

---
All other FPGA drivers already support such an abort function - it seems Spartan3 serial load was a bit neglected (only discovered this because it messed up things on my board after a failed FPGA load).

 drivers/fpga/spartan3.c |    6 ++++++
 include/spartan3.h      |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)
drivers/fpga/spartan3.c +6 -0
index 7a89b56..1dd6f26 100644
@@ -366,6 +366,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)
 			CONFIG_FPGA_DELAY ();
 			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to start.\n");
+				if (*fn->abort)
+					(*fn->abort) (cookie);
 				return FPGA_FAIL;
 			}
 		} while (!(*fn->init) (cookie));
@@ -380,6 +382,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)
 			CONFIG_FPGA_DELAY ();
 			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to clear.\n");
+				if (*fn->abort)
+					(*fn->abort) (cookie);
 				return FPGA_FAIL;
 			}
 		} while ((*fn->init) (cookie));
@@ -394,6 +398,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)
 				   while DONE is low (inactive) */
 				if ((*fn->done) (cookie) == 0 && (*fn->init) (cookie)) {
 					puts ("** CRC error during FPGA load.\n");
+					if (*fn->abort)
+						(*fn->abort) (cookie);
 					return (FPGA_FAIL);
 				}
 				val = data [bytecount ++];
include/spartan3.h +1 -0
index d5a589d..0f0b400 100644
@@ -58,6 +58,7 @@ typedef struct {
 	Xilinx_wr_fn	wr;
 	Xilinx_post_fn	post;
 	Xilinx_bwr_fn	bwr; /* block write function */
+	Xilinx_abort_fn abort;
 } Xilinx_Spartan3_Slave_Serial_fns;
 
 /* Device Image Sizes
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 add Xilinx_abort_fn to Xilinx_Spartan3_Slave_Serial_fns

Dear Wolfgang Wegner,

Quoted 5 lines · In message <[email protected]> you wrote:

Currently the hardware was left in an undefined state in case Spartan3 serial load failed. This patch adds Xilinx_abort_fn to give the board a possibility to clean up in this case.

Quoted 8 lines

---
All other FPGA drivers already support such an abort function - it seems Spartan3 serial load was a bit neglected (only discovered this because it messed up things on my board after a failed FPGA load).

 drivers/fpga/spartan3.c |    6 ++++++
 include/spartan3.h      |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

Applied to "next". Thanks, and sorry this took so long.

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
Save yourself!  Reboot in 5 seconds!