Nico Huber has submitted this change. ( https://review.coreboot.org/c/flashrom/+/54887 )
Change subject: buspirate: Add psus option ......................................................................
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 --- M buspirate_spi.c M flashrom.8.tmpl 2 files changed, 31 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
diff --git a/buspirate_spi.c b/buspirate_spi.c index 04b8fde..bfd0e05 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -326,6 +326,7 @@ int serialspeed_index = -1; int ret = 0; int pullup = 0; + int psu = 0; unsigned char *bp_commbuf; int bp_commbufsize;
@@ -377,6 +378,17 @@ } 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 @@ 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; diff --git a/flashrom.8.tmpl b/flashrom.8.tmpl index 4ae7e71..228e17b 100644 --- a/flashrom.8.tmpl +++ b/flashrom.8.tmpl @@ -952,7 +952,21 @@ More information about the Bus Pirate pull-up resistors and their purpose is available .URLB "http://dangerousprototypes.com/docs/Practical_guide_to_Bus_Pirate_pull-up_re..." \ "in a guide by dangerousprototypes" . -Only the external supply voltage (Vpu) is supported as of this writing. +.sp +The state of the Bus Pirate power supply pins is controllable through an optional +.B psus +parameter. Syntax is +.sp +.B " flashrom -p buspirate_spi:psus=state" +.sp +where +.B state +can be +.BR 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 +.B pullups +option), by connecting the Bus Pirate's Vpu input to the appropriate Vcc pin. .SS .BR "pickit2_spi " programmer .IP