1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-06-30 21:52:36 +02:00

buspirate: Add psus option

This change adds a 'psus=<on|off>' option, to control the external Vcc
state of the bus pirate, allowing hardware where the SPI flash chip is
powered by the 3V3/5V lines directly.

Change-Id: I8a7d4b40c0f7f04f6976f6757f05b61f2c9958f9
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54887
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Jeremy Kerr
2021-05-23 17:58:06 +08:00
committed by Nico Huber
parent bc31bd027d
commit f9f9c9d2c6
2 changed files with 31 additions and 1 deletions

View File

@ -326,6 +326,7 @@ static int buspirate_spi_init(void)
int serialspeed_index = -1;
int ret = 0;
int pullup = 0;
int psu = 0;
unsigned char *bp_commbuf;
int bp_commbufsize;
@ -377,6 +378,17 @@ static int buspirate_spi_init(void)
}
free(tmp);
tmp = extract_programmer_param("psus");
if (tmp) {
if (strcasecmp("on", tmp) == 0)
psu = 1;
else if (strcasecmp("off", tmp) == 0)
; // ignore
else
msg_perr("Invalid psus state, not enabling.\n");
}
free(tmp);
/* Default buffer size is 19: 16 bytes data, 3 bytes control. */
#define DEFAULT_BUFSIZE (16 + 3)
bp_commbuf = malloc(DEFAULT_BUFSIZE);
@ -638,6 +650,10 @@ static int buspirate_spi_init(void)
bp_commbuf[0] |= (1 << 2);
msg_pdbg("Enabling pull-up resistors.\n");
}
if (psu == 1) {
bp_commbuf[0] |= (1 << 3);
msg_pdbg("Enabling PSUs.\n");
}
ret = buspirate_sendrecv(bp_commbuf, 1, 1);
if (ret) {
ret = 1;