Index: ft2232_spi.c
===================================================================
--- ft2232_spi.c	(Revision 1099)
+++ ft2232_spi.c	(Arbeitskopie)
@@ -45,6 +45,17 @@
 #define BITMODE_BITBANG_NORMAL	1
 #define BITMODE_BITBANG_SPI	2
 
+        /* Set data bits low-byte command:
+         *  value: 0x08  CS=high, DI=low, DO=low, SK=low
+         *    dir: 0x0b  CS=output, DI=input, DO=output, SK=output
+         *
+         * Jtagkey(2) needs to enable its output via Bit4 / GPIOL0
+         *  value: 0x18  OE=high, CS=high, DI=low, DO=low, SK=low
+         *    dir: 0x1b  OE=output, CS=output, DI=input, DO=output, SK=output
+         *
+         */
+static unsigned char CS_Bits = 0x08;
+static unsigned char Pin_Dir = 0x0b;
 static struct ftdi_context ftdic_context;
 
 static int send_buf(struct ftdi_context *ftdic, const unsigned char *buf, int size)
@@ -86,6 +97,12 @@
 			ft2232_type = FTDI_FT2232H;
 		else if (!strcasecmp(arg, "4232H"))
 			ft2232_type = FTDI_FT4232H;
+		else if (!strcasecmp(arg, "jtagkey")) {
+			ft2232_type = 0xCFF8;
+			ft2232_interface = INTERFACE_A;
+			CS_Bits = 0x18;
+			Pin_Dir	= 0x1b;
+		}
 		else {
 			msg_perr("Error: Invalid device type specified.\n");
 			free(arg);
@@ -178,14 +195,9 @@
 		return -1;
 
 	msg_pdbg("Set data bits\n");
-	/* Set data bits low-byte command:
-	 *  value: 0x08  CS=high, DI=low, DO=low, SK=low
-	 *    dir: 0x0b  CS=output, DI=input, DO=output, SK=output
-	 */
-#define CS_BIT 0x08
 	buf[0] = SET_BITS_LOW;
-	buf[1] = CS_BIT;
-	buf[2] = 0x0b;
+	buf[1] = CS_Bits;
+	buf[2] = Pin_Dir;
 	if (send_buf(ftdic, buf, 3))
 		return -1;
 
@@ -230,8 +242,8 @@
 	 */
 	msg_pspew("Assert CS#\n");
 	buf[i++] = SET_BITS_LOW;
-	buf[i++] = 0 & ~CS_BIT; /* assertive */
-	buf[i++] = 0x0b;
+	buf[i++] = 0 & ~CS_Bits; /* assertive */
+	buf[i++] = Pin_Dir;
 
 	if (writecnt) {
 		buf[i++] = 0x11;
@@ -272,8 +284,8 @@
 
 	msg_pspew("De-assert CS#\n");
 	buf[i++] = SET_BITS_LOW;
-	buf[i++] = CS_BIT;
-	buf[i++] = 0x0b;
+	buf[i++] = CS_Bits;
+	buf[i++] = Pin_Dir;
 	ret = send_buf(ftdic, buf, i);
 	failed |= ret;
 	if (ret)
