[flashrom] [PATCH] Fix clock setting in ft2232_spi driver

ilya ilya at total-knowledge.com
Thu Jun 14 14:39:25 CEST 2012


Hello,

Looks like set clock divisor command was called with random values
for divisor itself.

Patch below fixes it. Now my calls to flashrom work much faster :)

Signed-off-by: Ilya A. Volynets-Evenbakh <ilya at total-knowledge.com>


Index: ft2232_spi.c
===================================================================
--- ft2232_spi.c        (revision 1541)
+++ ft2232_spi.c        (working copy)
@@ -325,12 +354,12 @@
 
        msg_pdbg("Set clock divisor\n");
        buf[0] = 0x86;          /* command "set divisor" */
+       buf[1] = (divisor / 2 - 1) & 0xff;
+       buf[2] = ((divisor / 2 - 1) >> 8) & 0xff;
        if (send_buf(ftdic, buf, 3)) {
                ret = -6;
                goto ftdi_err;
        }
-       buf[1] = (divisor / 2 - 1) & 0xff;
-       buf[2] = ((divisor / 2 - 1) >> 8) & 0xff;
 
        msg_pdbg("MPSSE clock: %f MHz, divisor: %u, SPI clock: %f MHz\n",
                 mpsse_clk, divisor, (double)(mpsse_clk / divisor));





More information about the flashrom mailing list