[flashrom] Bus Pirate pull-up resistors patch.

Brian Salcedo bsalcedo at gmx.us
Tue Jan 1 11:03:55 CET 2013


When working with some flash chips using the Bus Pirate programmer, the
use of the Bus Pirate's on-board pull-up resistors is sometimes
necessary.

Use of said pull-up resistors requires the user to apply a voltage to
the VPU pin of the Bus Pirate, and then command it to use them.

Included is a patch to initialize the Bus Pirate's pull-up resistors
with a 'pullups=1' at the command line:

e.g. flashrom -p buspirate_spi:dev=/dev/buspirate,pullups=1

Here is a link to information pertaining to what this patch does.
http://dangerousprototypes.com/docs/SPI_(binary)#0100wxyz_-_Configure_peripherals_w.3Dpower.2C_x.3Dpull-ups.2C_y.3DAUX.2C_z.3DCS

Currently, flashrom sends 0x4b, which does not set the "pull-ups" bit
high. Optionally sending 0x4f instead will enable them.


--- trunk/buspirate_spi.c	2013-01-01 04:03:42.507602657 -0500
+++ src/flashrom/buspirate_spi.c	2013-01-01 04:02:25.847578106
-0500 @@ -204,11 +204,13 @@
 	char *dev = NULL;
 	char *speed = NULL;
 	char *tmp;
+	char *pullups = NULL;
 	unsigned int fw_version_major = 0;
 	unsigned int fw_version_minor = 0;
 	int spispeed = 0x7;
 	int ret = 0;
 	int i;
+	int ipullup = 0;
 
 	dev = extract_programmer_param("dev");
 	if (dev && !strlen(dev)) {
@@ -220,6 +222,16 @@
 		return 1;
 	}
 
+	/* enable pull-up resistors? */
+	pullups = extract_programmer_param("pullups");
+	if(pullups) {
+		ipullup = atoi(pullups);
+
+		if(ipullup == 1) {
+			msg_pinfo("Enabled Bus Pirate pull-up
resistors.\n");
+		}
+	}
+
 	speed = extract_programmer_param("spispeed");
 	if (speed) {
 		for (i = 0; spispeeds[i].name; i++)
@@ -395,7 +407,7 @@
 	}
 
 	/* Initial setup (SPI peripherals config): Enable power, CS
high, AUX */
-	bp_commbuf[0] = 0x40 | 0xb;
+	bp_commbuf[0] = 0x40 | ((ipullup == 1) ? 0xf : 0xb);
 	ret = buspirate_sendrecv(bp_commbuf, 1, 1);
 	if (ret)
 		return 1;


Happy New Year!
Signed-off-by: Brian Salcedo <bsalcedo at gmx.us>




More information about the flashrom mailing list