#include <linux/delay.h>
/*
- * If the SelectMap interface can be overrun by the processor, define
- * CONFIG_SYS_FPGA_CHECK_BUSY and/or CONFIG_FPGA_DELAY in the board
+ * If the SelectMap interface can be overrun by the processor, enable
+ * CONFIG_SYS_FPGA_CHECK_BUSY and/or define CFG_FPGA_DELAY in the board
* configuration file and add board-specific support for checking BUSY status.
* By default, assume that the SelectMap interface cannot be overrun.
*/
-#ifndef CONFIG_SYS_FPGA_CHECK_BUSY
-#undef CONFIG_SYS_FPGA_CHECK_BUSY
-#endif
-#ifndef CONFIG_FPGA_DELAY
-#define CONFIG_FPGA_DELAY()
+#ifndef CFG_FPGA_DELAY
+#define CFG_FPGA_DELAY()
#endif
/*
* Check for errors during configuration by default
*/
-#ifndef CONFIG_SYS_FPGA_CHECK_ERROR
-#define CONFIG_SYS_FPGA_CHECK_ERROR
+#ifndef CFG_SYS_FPGA_CHECK_ERROR
+#define CFG_SYS_FPGA_CHECK_ERROR
#endif
/*
} while (!(*fn->init)(cookie));
(*fn->pgm)(false, true, cookie);
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
if (fn->clk)
(*fn->clk)(true, true, cookie);
*/
ts = get_timer(0);
do {
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
if (get_timer(ts) > CFG_SYS_FPGA_WAIT_INIT) {
printf("%s:%d: ** Timeout after %d ticks waiting for INIT to deassert.\n",
__func__, __LINE__, CFG_SYS_FPGA_WAIT_INIT);
/*
* Finished writing the data; deassert FPGA CS_B and WRITE_B signals.
*/
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
if (fn->cs)
(*fn->cs)(false, true, cookie);
if (fn->wr)
(*fn->wbulkdata)(&dummy, 1, true, cookie);
} else {
(*fn->wdata)(0xff, true, cookie);
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
(*fn->clk)(false, true, cookie);
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
(*fn->clk)(true, true, cookie);
}
}
break;
}
-#ifdef CONFIG_SYS_FPGA_CHECK_ERROR
+#ifdef CFG_SYS_FPGA_CHECK_ERROR
if ((*fn->init)(cookie)) {
printf("\n%s:%d: ** Error: INIT asserted during configuration\n",
__func__, __LINE__);
#endif
(*fn->wdata)(data[bytecount++], true, cookie);
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
/*
* Cycle the clock pin
*/
(*fn->clk)(false, true, cookie);
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
(*fn->clk)(true, true, cookie);
#ifdef CONFIG_SYS_FPGA_CHECK_BUSY
break;
}
-#ifdef CONFIG_SYS_FPGA_CHECK_ERROR
+#ifdef CFG_SYS_FPGA_CHECK_ERROR
if ((*fn->init)(cookie)) {
printf("\n%s:%d: ** Error: INIT asserted during configuration\n",
__func__, __LINE__);
for (bit = 7; bit >= 0; --bit) {
unsigned char curr_bit = (curr_data >> bit) & 1;
(*fn->wdata)(curr_bit, true, cookie);
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
(*fn->clk)(false, true, cookie);
- CONFIG_FPGA_DELAY();
+ CFG_FPGA_DELAY();
(*fn->clk)(true, true, cookie);
}