summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2020-07-20 08:27:45 -0400
committerAnastasia Klimchuk <aklm@chromium.org>2023-04-13 09:41:13 +0000
commit6537d40e31519f7c066a6dd3835ea86569cafce7 (patch)
tree8c3a6a1423c036a0688e03a22d2ee6dec9b27a86
parent5b2716d99c483c13f403c09d3f85eadba835ada9 (diff)
downloadflashrom-git-6537d40e31519f7c066a6dd3835ea86569cafce7.tar.gz
buspirate: Add option for setting the aux pin
This adds a parameter to drive the aux pin low (or high if you explicitly want the previous behavior). Some boards need to have a reset pin driven low before the firmware can be safely flashed. With the Bus Pirate, this is most easily done with the auxiliary pin. Change-Id: Ieeecfdf1afc06dadda9b8f99547cd74854ca6775 Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/43608 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
-rw-r--r--buspirate_spi.c22
-rw-r--r--doc/classic_cli_manpage.rst8
2 files changed, 28 insertions, 2 deletions
diff --git a/buspirate_spi.c b/buspirate_spi.c
index d3114c41..72c28b0a 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -327,6 +327,7 @@ static int buspirate_spi_init(const struct programmer_cfg *cfg)
int ret = 0;
bool pullup = false;
bool psu = false;
+ bool aux = true;
unsigned char *bp_commbuf;
int bp_commbufsize;
@@ -389,6 +390,17 @@ static int buspirate_spi_init(const struct programmer_cfg *cfg)
}
free(tmp);
+ tmp = extract_programmer_param_str(cfg, "aux");
+ if (tmp) {
+ if (strcasecmp("high", tmp) == 0)
+ ; /* Default */
+ else if (strcasecmp("low", tmp) == 0)
+ aux = false;
+ else
+ msg_perr("Invalid AUX state, driving high by 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);
@@ -642,8 +654,8 @@ static int buspirate_spi_init(const struct programmer_cfg *cfg)
goto init_err_cleanup_exit;
}
- /* Initial setup (SPI peripherals config): Enable power, CS high, AUX */
- bp_commbuf[0] = 0x40 | 0x0b;
+ /* Initial setup (SPI peripherals config): Enable power, CS high */
+ bp_commbuf[0] = 0x40 | 0x09;
if (pullup) {
bp_commbuf[0] |= (1 << 2);
msg_pdbg("Enabling pull-up resistors.\n");
@@ -652,6 +664,12 @@ static int buspirate_spi_init(const struct programmer_cfg *cfg)
bp_commbuf[0] |= (1 << 3);
msg_pdbg("Enabling PSUs.\n");
}
+ if (aux) {
+ bp_commbuf[0] |= (1 << 1);
+ msg_pdbg("Driving AUX high.\n");
+ } else {
+ msg_pdbg("Driving AUX low.\n");
+ }
ret = buspirate_sendrecv(bp_commbuf, 1, 1);
if (ret)
goto init_err_cleanup_exit;
diff --git a/doc/classic_cli_manpage.rst b/doc/classic_cli_manpage.rst
index d46d9cac..45ef4aa9 100644
--- a/doc/classic_cli_manpage.rst
+++ b/doc/classic_cli_manpage.rst
@@ -780,6 +780,14 @@ where ``state`` can be ``on`` or ``off``.
This allows the bus pirate to power the ROM chip directly. This may also be used to provide the required pullup voltage
(when using the **pullups** option), by connecting the Bus Pirate's Vpu input to the appropriate Vcc pin.
+An optional aux parameter specifies the state of the Bus Pirate auxiliary pin.
+This may be used to drive the auxiliary pin high or low before a transfer.
+Syntax is::
+
+ flashrom -p buspirate_spi:aux=state
+
+where ``state`` can be ``high`` or ``low``. The default ``state`` is ``high``.
+
pickit2_spi programmer
^^^^^^^^^^^^^^^^^^^^^^