Added MPSSE reset according to FTDI Application Notes AN114.

Signed-off-by: Boris Baykov <[email protected]>
---
diff -U 5 -N ./flashrom/ft2232_spi.c ./flashrom.ftdi_mpsse_init/ft2232_spi.c
--- ./flashrom/ft2232_spi.c     2015-01-25 10:16:05.372174400 +0300
+++ ./flashrom.ftdi_mpsse_init/ft2232_spi.c     2015-01-25 10:17:50.000000000 
+0300
@@ -75,10 +75,11 @@
        {0},
 };
 
 #define DEFAULT_DIVISOR 2
 
+#define BITMODE_BITBANG_RESET  0
 #define BITMODE_BITBANG_NORMAL 1
 #define BITMODE_BITBANG_SPI    2
 
 /* The variables cs_bits and pindir store the values for the "set data bits 
low byte" MPSSE command that
  * sets the initial state and the direction of the I/O pins. The pin offsets 
are as follows:
@@ -352,10 +353,14 @@
 
        if (ftdi_write_data_set_chunksize(ftdic, 256)) {
                msg_perr("Unable to set chunk size (%s).\n", 
ftdi_get_error_string(ftdic));
        }
 
+       if (ftdi_set_bitmode(ftdic, 0x00, BITMODE_BITBANG_RESET) < 0) {
+               msg_perr("Unable to reset MPSSE controller (%s).\n", 
ftdi_get_error_string(ftdic));
+       }
+
        if (ftdi_set_bitmode(ftdic, 0x00, BITMODE_BITBANG_SPI) < 0) {
                msg_perr("Unable to set bitmode to SPI (%s).\n", 
ftdi_get_error_string(ftdic));
        }
 
        if (clock_5x) {

Attachment: flashrom-r1872-ftdi-mpsse-init.patch
Description: Binary data

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to