Differentiate initial reset in avalon from subsequent ones.
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
diff --git a/driver-avalon.c b/driver-avalon.c
index f5bafb8..e71cfae 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -274,7 +274,7 @@ static void wait_avalon_ready(int fd)
}
}
-static int avalon_reset(struct cgpu_info *avalon, int fd)
+static int avalon_reset(struct cgpu_info *avalon, int fd, bool initial)
{
struct avalon_result ar;
struct avalon_task at;
@@ -292,10 +292,16 @@ static int avalon_reset(struct cgpu_info *avalon, int fd)
AVALON_DEFAULT_FREQUENCY);
wait_avalon_ready(fd);
+
ret = avalon_send_task(fd, &at, NULL);
if (unlikely(ret == AVA_SEND_ERROR))
return -1;
+ if (!initial) {
+ applog(LOG_ERR, "AVA%d reset sequence sent", avalon->device_id);
+ return 0;
+ }
+
ret = avalon_read(fd, (char *)&ar, AVALON_READ_SIZE);
if (unlikely(ret == AVA_GETS_ERROR))
return -1;
@@ -557,7 +563,7 @@ static bool avalon_detect_one(const char *devpath)
info->temp_old = 0;
info->frequency = frequency;
- ret = avalon_reset(avalon, fd);
+ ret = avalon_reset(avalon, fd, true);
if (ret) {
; /* FIXME: I think IT IS avalon and wait on reset;
* avalon_close(fd);
@@ -695,7 +701,7 @@ static void *avalon_get_results(void *userdata)
/* Lock to prevent more work being sent during reset */
mutex_lock(&info->qlock);
- avalon_reset(avalon, fd);
+ avalon_reset(avalon, fd, false);
avalon_idle(avalon, info, fd);
avalon->results = 0;
mutex_unlock(&info->qlock);
@@ -771,7 +777,7 @@ static void *avalon_send_tasks(void *userdata)
"AVA%i: Buffer full before all work queued",
avalon->device_id);
dev_error(avalon, REASON_DEV_COMMS_ERROR);
- avalon_reset(avalon, fd);
+ avalon_reset(avalon, fd, false);
avalon_idle(avalon, info, fd);
break;
}
@@ -793,8 +799,9 @@ static void *avalon_send_tasks(void *userdata)
applog(LOG_ERR, "AVA%i: Comms error(buffer)",
avalon->device_id);
dev_error(avalon, REASON_DEV_COMMS_ERROR);
- avalon_reset(avalon, fd);
+ avalon_reset(avalon, fd, false);
avalon_idle(avalon, info, fd);
+ break;
}
}
@@ -876,7 +883,7 @@ static void do_avalon_close(struct thr_info *thr)
pthread_cancel(info->read_thr);
pthread_cancel(info->write_thr);
- avalon_reset(avalon, fd);
+ avalon_reset(avalon, fd, false);
avalon_idle(avalon, info, fd);
avalon_free_work(thr);
avalon_close(fd);