|
From: openocd-gerrit <ope...@us...> - 2023-09-23 14:36:37
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 198a914cf99a8602a05227ac5327a805714e4b87 (commit)
from b86726b5a5bb1d2689a786b3294e8617867d5ef4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 198a914cf99a8602a05227ac5327a805714e4b87
Author: Daniel Anselmi <dan...@gm...>
Date: Sat Dec 17 13:11:30 2022 +0100
jtagspi/pld: add support from gatemate driver
Provide jtagspi with specific procedures to be able to
use jtagspi for programming spi-flash devices on cologne
chip gatemate devices.
Change-Id: Ifa1c4ca6e215d7f49bd21620898991af213812e9
Signed-off-by: Daniel Anselmi <dan...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7838
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/pld/gatemate.c b/src/pld/gatemate.c
index 4ad2665c6..f35b39ad2 100644
--- a/src/pld/gatemate.c
+++ b/src/pld/gatemate.c
@@ -15,6 +15,8 @@
#include "raw_bit.h"
#define JTAG_CONFIGURE 0x06
+#define JTAG_SPI_BYPASS 0x05
+#define BYPASS 0x3F
struct gatemate_pld_device {
struct jtag_tap *tap;
@@ -209,6 +211,66 @@ static int gatemate_load(struct pld_device *pld_device, const char *filename)
return retval;
}
+static int gatemate_has_jtagspi_instruction(struct pld_device *device, bool *has_instruction)
+{
+ *has_instruction = true;
+ return ERROR_OK;
+}
+
+static int gatemate_connect_spi_to_jtag(struct pld_device *pld_device)
+{
+ if (!pld_device)
+ return ERROR_FAIL;
+
+ struct gatemate_pld_device *pld_device_info = pld_device->driver_priv;
+ if (!pld_device_info)
+ return ERROR_FAIL;
+
+ struct jtag_tap *tap = pld_device_info->tap;
+ if (!tap)
+ return ERROR_FAIL;
+
+ if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) == JTAG_SPI_BYPASS)
+ return ERROR_OK;
+
+ gatemate_set_instr(tap, JTAG_SPI_BYPASS);
+
+ return jtag_execute_queue();
+}
+
+static int gatemate_disconnect_spi_from_jtag(struct pld_device *pld_device)
+{
+ if (!pld_device)
+ return ERROR_FAIL;
+
+ struct gatemate_pld_device *pld_device_info = pld_device->driver_priv;
+ if (!pld_device_info)
+ return ERROR_FAIL;
+
+ struct jtag_tap *tap = pld_device_info->tap;
+ if (!tap)
+ return ERROR_FAIL;
+
+ if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != JTAG_SPI_BYPASS)
+ return ERROR_OK;
+
+ gatemate_set_instr(tap, BYPASS);
+
+ return jtag_execute_queue();
+}
+
+static int gatemate_get_stuff_bits(struct pld_device *pld_device, unsigned int *facing_read_bits,
+ unsigned int *trailing_write_bits)
+{
+ if (!pld_device)
+ return ERROR_FAIL;
+
+ *facing_read_bits = 1;
+ *trailing_write_bits = 1;
+
+ return ERROR_OK;
+}
+
PLD_CREATE_COMMAND_HANDLER(gatemate_pld_create_command)
{
if (CMD_ARGC != 4)
@@ -239,4 +301,8 @@ struct pld_driver gatemate_pld = {
.name = "gatemate",
.pld_create_command = &gatemate_pld_create_command,
.load = &gatemate_load,
+ .has_jtagspi_instruction = gatemate_has_jtagspi_instruction,
+ .connect_spi_to_jtag = gatemate_connect_spi_to_jtag,
+ .disconnect_spi_from_jtag = gatemate_disconnect_spi_from_jtag,
+ .get_stuff_bits = gatemate_get_stuff_bits,
};
diff --git a/tcl/board/gatemate_eval.cfg b/tcl/board/gatemate_eval.cfg
index cc078a0e3..c4d3f3dfd 100644
--- a/tcl/board/gatemate_eval.cfg
+++ b/tcl/board/gatemate_eval.cfg
@@ -14,3 +14,9 @@ transport select jtag
adapter speed 6000
source [find fpga/gatemate.cfg]
+
+set JTAGSPI_CHAIN_ID gatemate.pld
+source [find cpld/jtagspi.cfg]
+
+#jtagspi_init gatemate.pld "" -1
+#jtagspi_program workspace/blink/blink_slow.cfg.bit 0
-----------------------------------------------------------------------
Summary of changes:
src/pld/gatemate.c | 66 +++++++++++++++++++++++++++++++++++++++++++++
tcl/board/gatemate_eval.cfg | 6 +++++
2 files changed, 72 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|