Description of the arguments can be found at command @command{virtex2 set_instr_codes}.
@end deffn
-@deffn {Command} {virtex2 program} pld_name
-Load the bitstream from external memory for FPGA @var{pld_name}. A.k.a. refresh.
+@deffn {Command} {virtex2 refresh} pld_name
+Load the bitstream from external memory for FPGA @var{pld_name}. A.k.a. program.
@end deffn
@end deffn
Set the length of the register for the preload. This is needed when the JTAG ID of the device is not known by openocd (newer NX devices).
The load command for the FPGA @var{pld_name} will use a length for the preload of @var{length}.
@end deffn
+
+@deffn {Command} {lattice refresh} pld_name
+Load the bitstream from external memory for FPGA @var{pld_name}. A.k.a program.
+@end deffn
@end deffn
for FPGA @var{pld_name}.
@end deffn
-@deffn {Command} {gowin reload} pld_name
+@deffn {Command} {gowin refresh} pld_name
Load the bitstream from external memory for
-FPGA @var{pld_name}. A.k.a. refresh.
+FPGA @var{pld_name}. A.k.a. reload.
@end deffn
@end deffn
return ERROR_OK;
}
+
+int lattice_certus_refresh(struct lattice_pld_device *lattice_device)
+{
+ struct jtag_tap *tap = lattice_device->tap;
+ if (!tap)
+ return ERROR_FAIL;
+
+ int retval = lattice_preload(lattice_device);
+ if (retval != ERROR_OK)
+ return retval;
+
+ retval = lattice_set_instr(tap, LSC_REFRESH, TAP_IDLE);
+ if (retval != ERROR_OK)
+ return retval;
+ jtag_add_runtest(2, TAP_IDLE);
+ jtag_add_sleep(200000);
+ retval = lattice_set_instr(tap, BYPASS, TAP_IDLE);
+ if (retval != ERROR_OK)
+ return retval;
+ jtag_add_runtest(100, TAP_IDLE);
+ jtag_add_sleep(1000);
+
+ return jtag_execute_queue();
+}
int lattice_certus_connect_spi_to_jtag(struct lattice_pld_device *pld_device_info);
int lattice_certus_disconnect_spi_from_jtag(struct lattice_pld_device *pld_device_info);
int lattice_certus_get_facing_read_bits(struct lattice_pld_device *pld_device_info, unsigned int *facing_read_bits);
+int lattice_certus_refresh(struct lattice_pld_device *lattice_device);
#endif /* OPENOCD_PLD_CERTUS_H */
return ERROR_OK;
}
+
+int lattice_ecp2_3_refresh(struct lattice_pld_device *lattice_device)
+{
+ if (!lattice_device || !lattice_device->tap)
+ return ERROR_FAIL;
+
+ int retval = lattice_set_instr(lattice_device->tap, LSCC_REFRESH, TAP_IDLE);
+ if (retval != ERROR_OK)
+ return retval;
+ return jtag_execute_queue();
+}
int lattice_ecp2_3_connect_spi_to_jtag(struct lattice_pld_device *pld_device_info);
int lattice_ecp2_3_disconnect_spi_from_jtag(struct lattice_pld_device *pld_device_info);
int lattice_ecp2_3_get_facing_read_bits(struct lattice_pld_device *pld_device_info, unsigned int *facing_read_bits);
+int lattice_ecp2_3_refresh(struct lattice_pld_device *lattice_device);
#endif /* OPENOCD_PLD_ECP2_3_H */
return ERROR_OK;
}
+
+int lattice_ecp5_refresh(struct lattice_pld_device *lattice_device)
+{
+ struct jtag_tap *tap = lattice_device->tap;
+ if (!tap)
+ return ERROR_FAIL;
+
+ int retval = lattice_preload(lattice_device);
+ if (retval != ERROR_OK)
+ return retval;
+
+ retval = lattice_set_instr(tap, LSC_REFRESH, TAP_IDLE);
+ if (retval != ERROR_OK)
+ return retval;
+ jtag_add_runtest(2, TAP_IDLE);
+ jtag_add_sleep(200000);
+ retval = lattice_set_instr(tap, BYPASS, TAP_IDLE);
+ if (retval != ERROR_OK)
+ return retval;
+ jtag_add_runtest(100, TAP_IDLE);
+ jtag_add_sleep(1000);
+
+ return jtag_execute_queue();
+}
int lattice_ecp5_connect_spi_to_jtag(struct lattice_pld_device *pld_device_info);
int lattice_ecp5_disconnect_spi_from_jtag(struct lattice_pld_device *pld_device_info);
int lattice_ecp5_get_facing_read_bits(struct lattice_pld_device *pld_device_info, unsigned int *facing_read_bits);
+int lattice_ecp5_refresh(struct lattice_pld_device *lattice_device);
#endif /* OPENOCD_PLD_ECP5_H */
.help = "reading user register from FPGA",
.usage = "pld_name",
}, {
- .name = "reload",
+ .name = "refresh",
.mode = COMMAND_EXEC,
.handler = gowin_reload_command_handler,
- .help = "reloading bitstream from flash to SRAM",
+ .help = "reload bitstream from flash to SRAM",
.usage = "pld_name",
},
COMMAND_REGISTRATION_DONE
return retval;
}
+COMMAND_HANDLER(lattice_refresh_command_handler)
+{
+ if (CMD_ARGC != 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ struct pld_device *device = get_pld_device_by_name_or_numstr(CMD_ARGV[0]);
+ if (!device) {
+ command_print(CMD, "pld device '#%s' is out of bounds or unknown", CMD_ARGV[0]);
+ return ERROR_FAIL;
+ }
+
+ struct lattice_pld_device *lattice_device = device->driver_priv;
+ if (!lattice_device)
+ return ERROR_FAIL;
+
+ int retval = lattice_check_device_family(lattice_device);
+ if (retval != ERROR_OK)
+ return retval;
+
+ if (lattice_device->family == LATTICE_ECP2 || lattice_device->family == LATTICE_ECP3)
+ return lattice_ecp2_3_refresh(lattice_device);
+ else if (lattice_device->family == LATTICE_ECP5)
+ return lattice_ecp5_refresh(lattice_device);
+ else if (lattice_device->family == LATTICE_CERTUS)
+ return lattice_certus_refresh(lattice_device);
+
+ return ERROR_FAIL;
+}
+
static const struct command_registration lattice_exec_command_handlers[] = {
{
.name = "read_status",
.handler = lattice_set_preload_command_handler,
.help = "set length for preload (device specific)",
.usage = "pld_name value",
+ }, {
+ .name = "refresh",
+ .mode = COMMAND_EXEC,
+ .handler = lattice_refresh_command_handler,
+ .help = "refresh from configuration memory",
+ .usage = "pld_name",
},
COMMAND_REGISTRATION_DONE
};
#define PROGRAM_SPI 0x3A
#define LSC_READ_STATUS 0x3C
#define LSC_INIT_ADDRESS 0x46
+#define LSC_REFRESH 0x79
#define LSC_BITSTREAM_BURST 0x7A
#define READ_USERCODE 0xC0
#define ISC_ENABLE 0xC6
return retval;
}
-COMMAND_HANDLER(virtex2_handle_program_command)
+COMMAND_HANDLER(virtex2_handle_refresh_command)
{
struct pld_device *device;
.help = "set instructions codes used for jtag-hub",
.usage = "pld_name user1 [user2 [user3 [user4]]]",
}, {
- .name = "program",
+ .name = "refresh",
.mode = COMMAND_EXEC,
- .handler = virtex2_handle_program_command,
- .help = "start loading of configuration (refresh)",
+ .handler = virtex2_handle_refresh_command,
+ .help = "start loading of configuration (program)",
.usage = "pld_name",
},
COMMAND_REGISTRATION_DONE