[flashrom] [PATCH] ft2232_spi.c: Added MPSSE controller reset

Boris Baykov dev at borisbaykov.com
Sun Jan 25 08:33:41 CET 2015


Added MPSSE reset according to FTDI Application Notes AN114.

Signed-off-by: Boris Baykov <dev at borisbaykov.com>
---
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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flashrom-r1872-ftdi-mpsse-init.patch
Type: application/octet-stream
Size: 1190 bytes
Desc: not available
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20150125/9233ba8d/attachment.obj>


More information about the flashrom mailing list