Add basic initialisation for nf1 devices
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
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 9085e6f..c31b391 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -359,9 +359,6 @@ static void nf1_send_init(struct bitfury_info *info)
spi_add_data(info, 0x3000, atrvec, 19 * 4);
}
-#define nf1_spi_reset(bitfury, info) (spi_reset(bitfury, info))
-#define nf1_spi_txrx(bitfury, info) (spi_txrx(bitfury, info))
-
static bool nf1_reinit(struct cgpu_info *bitfury, struct bitfury_info *info)
{
spi_clear_buf(info);
@@ -369,7 +366,7 @@ static bool nf1_reinit(struct cgpu_info *bitfury, struct bitfury_info *info)
nf1_set_freq(info);
nf1_send_conf(info);
nf1_send_init(info);
- return nf1_spi_txrx(bitfury, info);
+ return spi_txrx(bitfury, info);
}
static bool nf1_set_spi_settings(struct cgpu_info *bitfury, struct bitfury_info *info)
@@ -482,6 +479,15 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
info->osc6_bits = 50;
ret = nf1_reinit(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);
+ }
out:
if (!ret)
nf1_close(bitfury);
@@ -1205,6 +1211,9 @@ static void bitfury_shutdown(struct thr_info *thr)
case IDENT_BXF:
bxf_close(info);
break;
+ case IDENT_NF1:
+ nf1_close(bitfury);
+ break;
default:
break;
}