Fix more init sequence for nanofury.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
diff --git a/driver-bitfury.c b/driver-bitfury.c
index c31b391..ff4cffa 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -392,14 +392,16 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
mcp->designation.pin[i] = MCP2210_PIN_GPIO;
/* Set all pins to input mode */
mcp->direction.pin[i] = MCP2210_GPIO_INPUT;
+ mcp->value.pin[i] = MCP2210_GPIO_PIN_LOW;
}
- if (!mcp2210_set_gpio_settings(bitfury, mcp))
- goto out;
-
/* Set LED and PWR pins to output and high */
mcp->direction.pin[NF1_PIN_LED] = mcp->direction.pin[NF1_PIN_PWR_EN] = MCP2210_GPIO_OUTPUT;
mcp->value.pin[NF1_PIN_LED] = mcp->value.pin[NF1_PIN_PWR_EN] = MCP2210_GPIO_PIN_HIGH;
+
+ mcp->direction.pin[4] = MCP2210_GPIO_OUTPUT;
+ mcp->designation.pin[4] = MCP2210_PIN_CS;
+
if (!mcp2210_set_gpio_settings(bitfury, mcp))
goto out;
@@ -426,15 +428,14 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
/* Cancel any transfers in progress */
if (!mcp2210_spi_cancel(bitfury))
goto out;
- if (!mcp2210_get_spi_transfer_settings(bitfury, &info->mcp.bitrate, &info->mcp.icsv,
- &info->mcp.acsv, &info->mcp.cstdd, &info->mcp.ldbtcsd, &info->mcp.sdbd,
- &info->mcp.bpst, &info->mcp.spimode))
+ if (!mcp2210_get_spi_transfer_settings(bitfury, &mcp->bitrate, &mcp->icsv,
+ &mcp->acsv, &mcp->cstdd, &mcp->ldbtcsd, &mcp->sdbd, &mcp->bpst, &mcp->spimode))
goto out;
- info->mcp.bitrate = 12000000;
- info->mcp.icsv = 0xffff;
- info->mcp.acsv = 0xffef;
- info->mcp.cstdd = info->mcp.ldbtcsd = info->mcp.sdbd = info->mcp.spimode = 0;
- info->mcp.sdbd = 1;
+ mcp->bitrate = 12000000;
+ mcp->icsv = 0xffff;
+ mcp->acsv = 0xffef;
+ mcp->cstdd = mcp->ldbtcsd = mcp->sdbd = mcp->spimode = 0;
+ mcp->bpst = 1;
if (!nf1_set_spi_settings(bitfury, info))
goto out;
@@ -450,7 +451,7 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
goto out;
/* switch SCK to polarity (default SCK=1 in mode 2) */
- info->mcp.spimode = 2;
+ mcp->spimode = 2;
if (!nf1_set_spi_settings(bitfury, info))
goto out;
buf[0] = 0;
@@ -465,7 +466,7 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
goto out;
/* switch SCK to polarity (default SCK=0 in mode 0) */
- info->mcp.spimode = 0;
+ mcp->spimode = 0;
if (!nf1_set_spi_settings(bitfury, info))
goto out;
buf[0] = 0;