Jacek Naglak has uploaded this change for review.

View Change

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
---
M ft2232_spi.c
1 file changed, 25 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/40/64440/1
diff --git a/ft2232_spi.c b/ft2232_spi.c
index bafed40..072eb38 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -58,6 +58,8 @@
#define GOOGLE_SERVO_V2_PID0 0x5002
#define GOOGLE_SERVO_V2_PID1 0x5003

+#define KT_LINK_PID 0xbbe2
+
static const struct dev_entry devs_ft2232spi[] = {
{FTDI_VID, FTDI_FT2232H_PID, OK, "FTDI", "FT2232H"},
{FTDI_VID, FTDI_FT4232H_PID, OK, "FTDI", "FT4232H"},
@@ -75,6 +77,7 @@
{OLIMEX_VID, OLIMEX_ARM_TINY_PID, OK, "Olimex", "ARM-USB-TINY"},
{OLIMEX_VID, OLIMEX_ARM_OCD_H_PID, OK, "Olimex", "ARM-USB-OCD-H"},
{OLIMEX_VID, OLIMEX_ARM_TINY_H_PID, OK, "Olimex", "ARM-USB-TINY-H"},
+ {FTDI_VID, KT_LINK_PID, OK, "Kristech", "KT-LINK"},

{0},
};
@@ -420,6 +423,13 @@
/* 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 - enable TMS */
+ aux_bits = 0x20;
+ pindir = 0x2b;
} else {
msg_perr("Error: Invalid device type specified.\n");
free(arg);
@@ -658,6 +668,21 @@
goto ftdi_err;
}

+ if ( ft2232_type == KT_LINK_PID) {
+ /* Enable kt-link jtag interface
+ * Set GPIOH4 output low - enable TMS
+ * Set GPIOH5 output low - enable TDI
+ * Set GPIOH6 output low - enable TCK */
+ msg_pdbg("Set data bits HighByte\n");
+ buf[0] = SET_BITS_HIGH;
+ buf[1] = 0x00;
+ buf[2] = 0x70;
+ 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");

To view, visit change 64440. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id58c675bc410ec3ef6d58603d13efc9ca53bb87c
Gerrit-Change-Number: 64440
Gerrit-PatchSet: 1
Gerrit-Owner: Jacek Naglak <jnaglak@tlen.pl>
Gerrit-MessageType: newchange