Commit 763612af239825f806036a8132e2835a8b947398

Con Kolivas 2014-01-05T09:12:19

Set all pin designations and directions in one call for nanofury and don't bother storing their values in the info struct.

diff --git a/driver-bitfury.c b/driver-bitfury.c
index ee45f97..6d0f790 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -280,11 +280,13 @@ out_close:
 
 static void nf1_close(struct cgpu_info *bitfury)
 {
+	struct gpio_pin gp;
 	int i;
 
 	/* Set all pins to input mode, ignoring return code */
 	for (i = 0; i < 9; i++)
-		mcp2210_set_gpio_input(bitfury, i);
+		gp.pin[i] = MCP2210_GPIO_INPUT;
+	mcp2210_set_gpio_pindirs(bitfury, &gp);
 }
 
 static void spi_clear_buf(struct bitfury_info *info)
@@ -486,20 +488,20 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
 {
 	char buf[MCP2210_BUFFER_LENGTH];
 	unsigned int length;
+	struct gpio_pin gp;
 	bool ret = false;
 	int i, val;
 
 	/* Set all pins to GPIO mode */
 	for (i = 0; i < 9; i++)
-		info->mcp.designation.pin[i] = MCP2210_PIN_GPIO;
-	if (!mcp2210_set_gpio_pin_designations(bitfury, &info->mcp.designation))
+		gp.pin[i] = MCP2210_PIN_GPIO;
+	if (!mcp2210_set_gpio_pin_designations(bitfury, &gp))
 		goto out;
 
 	/* Set all pins to input mode */
-	for (i = 0; i < 9; i++) {
-		if (!mcp2210_set_gpio_input(bitfury, i))
-			goto out;
-	}
+	for (i = 0; i < 9; i++)
+		gp.pin[i] = MCP2210_GPIO_INPUT;
+	if (!mcp2210_set_gpio_pindirs(bitfury, &gp))
 
 	/* Set LED and PWR pins to output and high */
 	if (!mcp2210_set_gpio_output(bitfury, NF1_PIN_LED, MCP2210_GPIO_PIN_HIGH))
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 55eb32e..c5cb9ba 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -32,9 +32,6 @@ extern int opt_bxf_temp_target;
 #define NF1_SPIBUF_SIZE 16384
 
 struct mcp_settings {
-	struct gpio_pin designation;
-	struct gpio_pin value;
-	struct gpio_pin direction;
 	unsigned int bitrate, icsv, acsv, cstdd, ldbtcsd, sdbd, bpst, spimode;
 };