summaryrefslogtreecommitdiffstats
path: root/ft2232_spi.c
diff options
context:
space:
mode:
authorJacek Naglak <jnaglak@tlen.pl>2022-05-18 02:25:13 +0200
committerThomas Heijligen <src@posteo.de>2022-07-18 19:08:44 +0000
commit3543bfed84942eea8d4ba398001656f27e367a87 (patch)
tree2803795515fed78b903289d9c02e1d1468ea2738 /ft2232_spi.c
parented2da0f2bca3bb7316c7e81cfa3cfc068a31aa71 (diff)
downloadflashrom-3543bfed84942eea8d4ba398001656f27e367a87.tar.gz
flashrom-3543bfed84942eea8d4ba398001656f27e367a87.tar.bz2
flashrom-3543bfed84942eea8d4ba398001656f27e367a87.zip
ft2232_spi.c: Add support for kt-link jtag interface
Change tested writing, reading and erasing spi flashes pinout: jtag - spi 1 vcc - vcc, wp#, hold# 4 gnd - gnd 5 tdi - si 7 tms - cs# 9 tck - sck 13 tdo - so Connect pins 9 and 12 in EXT connector for 3.3V power. Signed-off-by: Jacek Naglak <jnaglak@tlen.pl> Change-Id: Id58c675bc410ec3ef6d58603d13efc9ca53bb87c Reviewed-on: https://review.coreboot.org/c/flashrom/+/64440 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'ft2232_spi.c')
-rw-r--r--ft2232_spi.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ft2232_spi.c b/ft2232_spi.c
index f4070ed9a..bbacc03b5 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -39,6 +39,7 @@
#define FTDI_FT4233H_PID 0x6041
#define TIAO_TUMPA_PID 0x8a98
#define TIAO_TUMPA_LITE_PID 0x8a99
+#define KT_LINK_PID 0xbbe2
#define AMONTEC_JTAGKEY_PID 0xCFF8
#define GOEPEL_VID 0x096C
@@ -65,6 +66,7 @@ static const struct dev_entry devs_ft2232spi[] = {
{FTDI_VID, FTDI_FT4233H_PID, OK, "FTDI", "FT4233H"},
{FTDI_VID, TIAO_TUMPA_PID, OK, "TIAO", "USB Multi-Protocol Adapter"},
{FTDI_VID, TIAO_TUMPA_LITE_PID, OK, "TIAO", "USB Multi-Protocol Adapter Lite"},
+ {FTDI_VID, KT_LINK_PID, OK, "Kristech", "KT-LINK"},
{FTDI_VID, AMONTEC_JTAGKEY_PID, OK, "Amontec", "JTAGkey"},
{GOEPEL_VID, GOEPEL_PICOTAP_PID, OK, "GOEPEL", "PicoTAP"},
{GOOGLE_VID, GOOGLE_SERVO_PID, OK, "Google", "Servo"},
@@ -333,6 +335,8 @@ static int ft2232_spi_init(void)
uint8_t cs_bits = 0x08;
uint8_t aux_bits = 0x00;
uint8_t pindir = 0x0b;
+ uint8_t aux_bits_high = 0x00;
+ uint8_t pindir_high = 0x00;
struct ftdi_context ftdic;
struct ft2232_data *spi_data;
@@ -421,6 +425,17 @@ static int ft2232_spi_init(void)
/* Flyswatter and Flyswatter-2 require GPIO bits 0x80
* and 0x40 to be driven low to enable output buffers */
pindir = 0xcb;
+ } else if (!strcasecmp(arg, "kt-link")) {
+ ft2232_type = KT_LINK_PID;
+ /* port B is used as uart */
+ channel_count = 1;
+ /* Set GPIOL1 output high - route TMS and TDO through multiplexers */
+ aux_bits = 0x20;
+ pindir = 0x2b;
+ /* Set GPIOH4 output low - enable TMS output buffer */
+ /* Set GPIOH5 output low - enable TDI output buffer */
+ /* Set GPIOH6 output low - enable TCK output buffer */
+ pindir_high = 0x70;
} else {
msg_perr("Error: Invalid device type specified.\n");
free(arg);
@@ -659,6 +674,17 @@ format_error:
goto ftdi_err;
}
+ if (pindir_high) {
+ msg_pdbg("Set data bits HighByte\n");
+ buf[0] = SET_BITS_HIGH;
+ buf[1] = aux_bits_high;
+ buf[2] = pindir_high;
+ if (send_buf(&ftdic, buf, 3)) {
+ ret = -8;
+ goto ftdi_err;
+ }
+ }
+
spi_data = calloc(1, sizeof(*spi_data));
if (!spi_data) {
msg_perr("Unable to allocate space for SPI master data\n");