Author: stefanct
Date: Thu Jun 14 15:08:33 2012
New Revision: 1542
URL: http://flashrom.org/trac/flashrom/changeset/1542

Log:
Fix setting the divisor in ft2232_spi.

The patch that should have improved the clock divisor setting in r1537 made
it much worse: the divisor used was from an uninitialized buffer.

Signed-off-by: Ilya A. Volynets-Evenbakh <[email protected]>
Acked-by: Stefan Tauner <[email protected]>

Modified:
   trunk/ft2232_spi.c

Modified: trunk/ft2232_spi.c
==============================================================================
--- trunk/ft2232_spi.c  Fri Jun  8 17:27:47 2012        (r1541)
+++ trunk/ft2232_spi.c  Thu Jun 14 15:08:33 2012        (r1542)
@@ -325,12 +325,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));

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

Reply via email to