Felix Singer has uploaded this change for review.

View Change

buspirate_spi.c: Move variable `pullup` into parameters struct

Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I6b571d2f034fc3f8657cc4e9a0f2891df84e38c3
---
M buspirate_spi.c
1 file changed, 15 insertions(+), 4 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/93/67893/1
diff --git a/buspirate_spi.c b/buspirate_spi.c
index 5580451..1abb9ec 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -318,6 +318,7 @@
struct buspirate_spi_parameters {
char *dev;
int spispeed;
+ bool pullup;
};

static int buspirate_spi_init(const struct programmer_cfg *cfg)
@@ -331,7 +332,6 @@
unsigned int hw_version_minor = 0;
int serialspeed_index = -1;
int ret = 0;
- bool pullup = false;
bool psu = false;
unsigned char *bp_commbuf;
int bp_commbufsize;
@@ -377,10 +377,11 @@
free(tmp);
}

+ parameters.pullup = false;
tmp = extract_programmer_param_str(cfg, "pullups");
if (tmp) {
if (strcasecmp("on", tmp) == 0)
- pullup = true;
+ parameters.pullup = true;
else if (strcasecmp("off", tmp) == 0)
; // ignore
else
@@ -656,7 +657,7 @@

/* Initial setup (SPI peripherals config): Enable power, CS high, AUX */
bp_commbuf[0] = 0x40 | 0x0b;
- if (pullup) {
+ if (parameters.pullup) {
bp_commbuf[0] |= (1 << 2);
msg_pdbg("Enabling pull-up resistors.\n");
}
@@ -686,7 +687,7 @@

/* Set SPI config: output type, idle, clock edge, sample */
bp_commbuf[0] = 0x80 | 0xa;
- if (pullup) {
+ if (parameters.pullup) {
bp_commbuf[0] &= ~(1 << 3);
msg_pdbg("Pull-ups enabled, so using HiZ pin output! (Open-Drain mode)\n");
}

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6b571d2f034fc3f8657cc4e9a0f2891df84e38c3
Gerrit-Change-Number: 67893
Gerrit-PatchSet: 1
Gerrit-Owner: Felix Singer <felixsinger@posteo.net>
Gerrit-MessageType: newchange