Remove spi_detect_bitfury at nanofury startup and fix incorrect refresh time.
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 5090126..e358e57 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -417,16 +417,14 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
if (!nf1_reinit(bitfury, info))
goto out;
- ret = spi_detect_bitfury(bitfury, info);
- if (ret) {
- if (!add_cgpu(bitfury))
- quit(1, "Failed to add_cgpu in nf1_detect_one");
-
- update_usb_stats(bitfury);
- applog(LOG_INFO, "%s %d: Successfully initialised %s",
- bitfury->drv->name, bitfury->device_id, bitfury->device_path);
- spi_clear_buf(info);
- }
+ ret = true;
+ if (!add_cgpu(bitfury))
+ quit(1, "Failed to add_cgpu in nf1_detect_one");
+
+ update_usb_stats(bitfury);
+ applog(LOG_INFO, "%s %d: Successfully initialised %s",
+ bitfury->drv->name, bitfury->device_id, bitfury->device_path);
+ spi_clear_buf(info);
info->total_nonces = 1;
out:
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 4837764..581598a 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -30,8 +30,7 @@ extern int opt_bxf_temp_target;
#define NF1_PIN_PWR_EN 6
#define SPIBUF_SIZE 16384
-#define BITFURY_REFRESH_DELAY 1200
-#define BITFURY_DETECT_TRIES 3000 / BITFURY_REFRESH_DELAY
+#define BITFURY_REFRESH_DELAY 100
struct bitfury_payload {
unsigned char midstate[32];
diff --git a/libbitfury.c b/libbitfury.c
index 9c16b0d..e48fd07 100644
--- a/libbitfury.c
+++ b/libbitfury.c
@@ -213,31 +213,6 @@ void spi_add_data(struct bitfury_info *info, uint16_t addr, const void *buf, int
spi_add_buf_reverse(info, buf, len);
}
-bool spi_detect_bitfury(struct cgpu_info *bitfury, struct bitfury_info *info)
-{
- unsigned int newbuf[17], oldbuf[17];
- int i;
-
- memset(newbuf, 0, 17 * 4);
- memset(oldbuf, 0, 17 * 4);
-
- for (i = 0; i < BITFURY_DETECT_TRIES; i++) {
- spi_clear_buf(info);
- spi_add_break(info);
- spi_add_data(info, 0x3000, atrvec, 19 * 4);
- if (!spi_txrx(bitfury, info))
- return false;
- memcpy(newbuf, info->spibuf + 4, 17 * 4);
- if (newbuf[16] != 0 && newbuf[16] != 0xFFFFFFFF)
- return false;
- if (i && newbuf[16] != oldbuf[16])
- return true;
- cgsleep_ms(BITFURY_REFRESH_DELAY);
- memcpy(oldbuf, newbuf, 17 * 4);
- }
- return false;
-}
-
// Bit-banging reset... Each 3 reset cycles reset first chip in chain
bool spi_reset(struct cgpu_info *bitfury, struct bitfury_info *info)
{
diff --git a/libbitfury.h b/libbitfury.h
index b2075ed..79ed564 100644
--- a/libbitfury.h
+++ b/libbitfury.h
@@ -22,7 +22,6 @@ void spi_clear_buf(struct bitfury_info *info);
void spi_add_buf(struct bitfury_info *info, const void *buf, const int sz);
void spi_add_break(struct bitfury_info *info);
void spi_add_data(struct bitfury_info *info, uint16_t addr, const void *buf, int len);
-bool spi_detect_bitfury(struct cgpu_info *bitfury, struct bitfury_info *info);
bool spi_reset(struct cgpu_info *bitfury, struct bitfury_info *info);
bool spi_txrx(struct cgpu_info *bitfury, struct bitfury_info *info);
bool bitfury_checkresults(struct thr_info *thr, struct work *work, uint32_t nonce);