David Norris has uploaded this change for review.

View Change

buspirate_spi: Add 'aux' programmer option to control AUX pin.

Set aux=0 to drive AUX to GND.
Set aux=1 to drive AUX to +3.3 V (the previous behavior).

It is often convenient to use the AUX pin to control something on the
target board like a reset pin. This option allows for cases when AUX
should be driven to GND instead of +3.3 V as was the previous behavior.
Unfortunately the Bus Pirate's raw SPI mode does not appear to easily
support a High-Z mode for AUX but if I'm mistaken, "aux=z" should be
added to this patch accordingly.

Change-Id: I463ff7c57a67a3132d2fb3608f1d8408b84febd7
Signed-off-by: David A Norris <danorris@gmail.com>
---
M buspirate_spi.c
1 file changed, 36 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/98/72198/1
diff --git a/buspirate_spi.c b/buspirate_spi.c
index a40fb70..3aa13d4 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -331,6 +331,7 @@
bool psu = false;
unsigned char *bp_commbuf;
int bp_commbufsize;
+ int aux = 1;

dev = extract_programmer_param_str(cfg, "dev");
if (dev && !strlen(dev)) {
@@ -391,6 +392,17 @@
}
free(tmp);

+ tmp = extract_programmer_param_str(cfg, "aux");
+ if (aux) {
+ if (strcmp("1", tmp) == 0)
+ aux = 1;
+ else if (strcmp("0", tmp) == 0)
+ aux = 0;
+ else
+ msg_perr("Invalid aux state, leaving high (the default).\n");
+ }
+ free(tmp);
+
/* Default buffer size is 19: 16 bytes data, 3 bytes control. */
#define DEFAULT_BUFSIZE (16 + 3)
bp_commbuf = malloc(DEFAULT_BUFSIZE);
@@ -650,6 +662,10 @@
bp_commbuf[0] |= (1 << 2);
msg_pdbg("Enabling pull-up resistors.\n");
}
+ if (aux == 0) {
+ bp_commbuf[0] &= ~(1 << 1);
+ msg_pdbg("Setting AUX low.\n");
+ }
if (psu) {
bp_commbuf[0] |= (1 << 3);
msg_pdbg("Enabling PSUs.\n");

To view, visit change 72198. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I463ff7c57a67a3132d2fb3608f1d8408b84febd7
Gerrit-Change-Number: 72198
Gerrit-PatchSet: 1
Gerrit-Owner: David Norris <danorris@gmail.com>
Gerrit-MessageType: newchange