[flashrom] [PATCH] ft2232_spi.c: use ftdi.h named constants instead of magic numbers

Antony Pavlov antonynpavlov at gmail.com
Thu Jan 22 23:53:10 CET 2015


Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 ft2232_spi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ft2232_spi.c b/ft2232_spi.c
index 7e7e2b1..4921caa 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -350,7 +350,7 @@ int ft2232_spi_init(void)
 
 	if (clock_5x) {
 		msg_pdbg("Disable divide-by-5 front stage\n");
-		buf[0] = 0x8a;		/* Disable divide-by-5. */
+		buf[0] = DIS_DIV_5;
 		if (send_buf(ftdic, buf, 1)) {
 			ret = -5;
 			goto ftdi_err;
@@ -361,7 +361,7 @@ int ft2232_spi_init(void)
 	}
 
 	msg_pdbg("Set clock divisor\n");
-	buf[0] = 0x86;		/* command "set divisor" */
+	buf[0] = TCK_DIVISOR;
 	buf[1] = (divisor / 2 - 1) & 0xff;
 	buf[2] = ((divisor / 2 - 1) >> 8) & 0xff;
 	if (send_buf(ftdic, buf, 3)) {
@@ -374,7 +374,7 @@ int ft2232_spi_init(void)
 
 	/* Disconnect TDI/DO to TDO/DI for loopback. */
 	msg_pdbg("No loopback of TDI/DO TDO/DI\n");
-	buf[0] = 0x85;
+	buf[0] = LOOPBACK_END;
 	if (send_buf(ftdic, buf, 1)) {
 		ret = -7;
 		goto ftdi_err;
@@ -453,7 +453,7 @@ static int ft2232_spi_send_command(struct flashctx *flash,
 	 * read command, then do the fetch of the results.
 	 */
 	if (readcnt) {
-		buf[i++] = 0x20;
+		buf[i++] = MPSSE_DO_READ;
 		buf[i++] = (readcnt - 1) & 0xff;
 		buf[i++] = ((readcnt - 1) >> 8) & 0xff;
 		ret = send_buf(ftdic, buf, i);
-- 
2.1.4





More information about the flashrom mailing list