Dreg has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/79299?usp=email )
Change subject: buspirate_spi: Add support for hiz output with pullups=off ......................................................................
buspirate_spi: Add support for hiz output with pullups=off
When working with low-voltage chips, the internal 10k pull-ups of the Bus Pirate might be too high. In such cases, it's necessary to create an external pull-up using lower-value resistors. For this, you can use the ``hiz`` parameter. This way, the Bus Pirate will operate as an open drain
Change-Id: I6d9909b23782ef3fcb1428fd127dae0d6b211855 Signed-off-by: Dreg dreg@rootkit.es --- M buspirate_spi.c M doc/classic_cli_manpage.rst 2 files changed, 22 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/99/79299/1
diff --git a/buspirate_spi.c b/buspirate_spi.c index 72c28b0..7436d80 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -325,6 +325,7 @@ int spispeed = 0x7; int serialspeed_index = -1; int ret = 0; + bool hiz = false; bool pullup = false; bool psu = false; bool aux = true; @@ -368,6 +369,17 @@ } free(tmp);
+ tmp = extract_programmer_param_str(cfg, "hiz"); + if (tmp) { + if (strcasecmp("on", tmp) == 0) + hiz = true; + else if (strcasecmp("off", tmp) == 0) + ; // ignore + else + msg_perr("Invalid hiz state, not using them.\n"); + } + free(tmp); + tmp = extract_programmer_param_str(cfg, "pullups"); if (tmp) { if (strcasecmp("on", tmp) == 0) @@ -692,9 +704,9 @@
/* Set SPI config: output type, idle, clock edge, sample */ bp_commbuf[0] = 0x80 | 0xa; - if (pullup) { + if (pullup || hiz) { bp_commbuf[0] &= ~(1 << 3); - msg_pdbg("Pull-ups enabled, so using HiZ pin output! (Open-Drain mode)\n"); + msg_pdbg("Pull-ups or HiZ enabled, so using HiZ pin output! (Open-Drain mode)\n"); } ret = buspirate_sendrecv(bp_commbuf, 1, 1); if (ret) diff --git a/doc/classic_cli_manpage.rst b/doc/classic_cli_manpage.rst index 5d6b7ef..3157793 100644 --- a/doc/classic_cli_manpage.rst +++ b/doc/classic_cli_manpage.rst @@ -763,6 +763,14 @@ where ``baud`` can be ``115200``, ``230400``, ``250000`` or ``2000000`` (``2M``). The default is ``2M`` baud for Bus Pirate hardware version 3.0 and greater, and 115200 otherwise.
+When working with low-voltage chips, the internal 10k pull-ups of the Bus Pirate might be too high. In such cases, it's +necessary to create an external pull-up using lower-value resistors. For this, you can use the ``hiz`` parameter. +This way, the Bus Pirate will operate as an open drain. Syntax is:: + + flashrom -p buspirate_spi:hiz=state + +where ``state`` can be ``on`` or ``off``. + An optional pullups parameter specifies the use of the Bus Pirate internal pull-up resistors. This may be needed if you are working with a flash ROM chip that you have physically removed from the board. Syntax is::