summaryrefslogtreecommitdiff
path: root/ft2232_spi.c
diff options
context:
space:
mode:
authorstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2012-06-14 13:08:33 +0000
committerstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2012-06-14 13:08:33 +0000
commitc10838212a99affcfb56ae437f1bb0fefd86a8a5 (patch)
treedc195de50c1c66b463986cdfaade23e127ee87c3 /ft2232_spi.c
parent891533a89ba8c3f54c4c900d974144513731e2a9 (diff)
downloadflashrom-c10838212a99affcfb56ae437f1bb0fefd86a8a5.tar.gz
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 <ilya@total-knowledge.com> Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1542 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'ft2232_spi.c')
-rw-r--r--ft2232_spi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ft2232_spi.c b/ft2232_spi.c
index d11867e..aec2fd5 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -325,12 +325,12 @@ int ft2232_spi_init(void)
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));