Browse Source

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.

Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
Wolfgang Wegner 15 years ago
parent
commit
b0bc8b70ff
2 changed files with 7 additions and 0 deletions
  1. 6 0
      drivers/fpga/spartan3.c
  2. 1 0
      include/spartan3.h

+ 6 - 0
drivers/fpga/spartan3.c

@@ -366,6 +366,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)
 			CONFIG_FPGA_DELAY ();
 			CONFIG_FPGA_DELAY ();
 			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to start.\n");
 				puts ("** Timeout waiting for INIT to start.\n");
+				if (*fn->abort)
+					(*fn->abort) (cookie);
 				return FPGA_FAIL;
 				return FPGA_FAIL;
 			}
 			}
 		} while (!(*fn->init) (cookie));
 		} while (!(*fn->init) (cookie));
@@ -380,6 +382,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)
 			CONFIG_FPGA_DELAY ();
 			CONFIG_FPGA_DELAY ();
 			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to clear.\n");
 				puts ("** Timeout waiting for INIT to clear.\n");
+				if (*fn->abort)
+					(*fn->abort) (cookie);
 				return FPGA_FAIL;
 				return FPGA_FAIL;
 			}
 			}
 		} while ((*fn->init) (cookie));
 		} 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) */
 				   while DONE is low (inactive) */
 				if ((*fn->done) (cookie) == 0 && (*fn->init) (cookie)) {
 				if ((*fn->done) (cookie) == 0 && (*fn->init) (cookie)) {
 					puts ("** CRC error during FPGA load.\n");
 					puts ("** CRC error during FPGA load.\n");
+					if (*fn->abort)
+						(*fn->abort) (cookie);
 					return (FPGA_FAIL);
 					return (FPGA_FAIL);
 				}
 				}
 				val = data [bytecount ++];
 				val = data [bytecount ++];

+ 1 - 0
include/spartan3.h

@@ -58,6 +58,7 @@ typedef struct {
 	Xilinx_wr_fn	wr;
 	Xilinx_wr_fn	wr;
 	Xilinx_post_fn	post;
 	Xilinx_post_fn	post;
 	Xilinx_bwr_fn	bwr; /* block write function */
 	Xilinx_bwr_fn	bwr; /* block write function */
+	Xilinx_abort_fn abort;
 } Xilinx_Spartan3_Slave_Serial_fns;
 } Xilinx_Spartan3_Slave_Serial_fns;
 
 
 /* Device Image Sizes
 /* Device Image Sizes