Merge branch 'master' into libusb1018
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 3c27872..366709a 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -188,7 +188,7 @@ static bool hfa_get_header(struct cgpu_info *hashfast, struct hf_header *h, uint
orig_len = len = sizeof(*h);
- /* Read for up to 200ms till we find the first occurrence of HF_PREAMBLE
+ /* Read for up to 500ms till we find the first occurrence of HF_PREAMBLE
* though it should be the first byte unless we get woefully out of
* sync. */
cgtimer_time(&ts_start);
@@ -197,7 +197,7 @@ static bool hfa_get_header(struct cgpu_info *hashfast, struct hf_header *h, uint
cgtimer_time(&ts_now);
cgtimer_sub(&ts_now, &ts_start, &ts_diff);
- if (cgtimer_to_ms(&ts_diff) > 200)
+ if (cgtimer_to_ms(&ts_diff) > 500)
return false;
if (unlikely(hashfast->usbinfo.nodev))
diff --git a/driver-hashfast.h b/driver-hashfast.h
index ea1fbb0..ea09100 100644
--- a/driver-hashfast.h
+++ b/driver-hashfast.h
@@ -24,7 +24,7 @@ bool opt_hfa_dfu_boot;
#define HASHFAST_MINER_THREADS 1
#define HFA_CLOCK_DEFAULT 550
-#define HFA_OVERHEAT_DEFAULT 85
+#define HFA_OVERHEAT_DEFAULT 90
// Matching fields for hf_statistics, but large #s for local accumulation, per-die
struct hf_long_statistics {
diff --git a/driver-minion.c b/driver-minion.c
index be4a38a..f66c020 100644
--- a/driver-minion.c
+++ b/driver-minion.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 Andrew Smith - BlackArrow Ltd
+ * Copyright 2013-2014 Andrew Smith - BlackArrow Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -33,6 +33,10 @@ static void minion_detect(__maybe_unused bool hotplug)
#define MINION_CHIPS 32
#define MINION_CORES 99
+/*
+ * TODO: These will need adjusting for final hardware
+ * Look them up and calculate them?
+ */
#define MINION_QUE_HIGH 4
#define MINION_QUE_LOW 2
@@ -1127,7 +1131,13 @@ static void enable_chip_cores(struct cgpu_info *minioncgpu, struct minion_info *
chip, READ_ADDR(MINION_CORE_ENA96_98),
rbuf, MINION_CORE_SIZ, data);
-
+ /*
+ * This will say it has completed the test 99 times faster than
+ * a single core speed since all work will be divided up across all
+ * 99 cores (even if they aren't there)
+ * Of course it will only have checked N/99 of the nonce range
+ * where N = the number of working cores
+ */
data[0] = 0xff;
data[1] = 0xff;
data[2] = 0xff;
@@ -1918,63 +1928,84 @@ static void *minion_spi_reply(void *userdata)
// them all anyway - to avoid high latency when there are only a few results due to low luck
ret = poll(&pfd, 1, MINION_REPLY_mS);
if (ret > 0) {
+ bool gotres;
int c;
read(minioninfo->gpiointfd, &c, 1);
-// applog(LOG_ERR, "%s%i: result interrupt",
-// minioncgpu->drv->name, minioncgpu->device_id);
+/*
+ applog(LOG_ERR, "%s%i: Interrupt",
+ minioncgpu->drv->name,
+ minioncgpu->device_id);
+*/
- // TODO: which chip do I check for interrupts? Do I need to check every one of them?
- SET_HEAD_READ(head, MINION_SYS_INT_STA);
- head->chip = 0;
- /*
- * TODO: can we lose an interrupt if it happens before it gets back to poll
- * but after 'get count of results' is done?
- * No since the but stays hi until we clear it
- */
- reply = do_ioctl(wbuf, wsiz, rbuf, rsiz);
- if (reply != (int)wsiz) {
- applog(LOG_ERR, "%s: chip %d int status returned %d (should be %d)",
- minioncgpu->drv->dname, chip, reply, (int)wsiz);
- }
+ gotres = false;
+ for (chip = 0; chip < MINION_CHIPS; chip++) {
+ if (minioninfo->chip[chip]) {
+ SET_HEAD_READ(head, MINION_SYS_INT_STA);
+ head->chip = chip;
+ reply = do_ioctl(wbuf, wsiz, rbuf, rsiz);
+ if (reply != (int)wsiz) {
+ applog(LOG_ERR, "%s: chip %d int status returned %d"
+ " (should be %d)",
+ minioncgpu->drv->dname,
+ chip, reply, (int)wsiz);
+ }
- if (rbuf[wsiz - rsiz] & MINION_RESULT_INT) {
- cgsem_post(&(minioninfo->scan_work));
-// applog(LOG_ERR, "%s%i: correct interrupt",
-// minioncgpu->drv->name, minioncgpu->device_id);
- }
+ if (rbuf[wsiz - rsiz] & MINION_RESULT_INT) {
+ gotres = true;
+/*
+ applog(LOG_ERR, "%s%i: chip %d got RES interrupt",
+ minioncgpu->drv->name,
+ minioncgpu->device_id,
+ chip);
+*/
+ }
- if (rbuf[wsiz - rsiz] & MINION_CMD_INT) {
- applog(LOG_ERR, "%s%i: got CMD interrupt",
- minioncgpu->drv->name, minioncgpu->device_id);
- }
+ if (rbuf[wsiz - rsiz] & MINION_CMD_INT) {
+ // Work queue is empty
+/*
+ applog(LOG_ERR, "%s%i: chip %d got CMD interrupt",
+ minioncgpu->drv->name,
+ minioncgpu->device_id,
+ chip);
+*/
+ }
/*
- {
- char *tmp;
- tmp = bin2hex(rbuf, wsiz);
- applog(LOG_ERR, "%s%i: interrupt: %s",
- minioncgpu->drv->name, minioncgpu->device_id,
- tmp);
- free(tmp);
- }
+ {
+ char *tmp;
+ tmp = bin2hex(rbuf, wsiz);
+ applog(LOG_ERR, "%s%i: chip %d interrupt: %s",
+ minioncgpu->drv->name,
+ minioncgpu->device_id,
+ chip, tmp);
+ free(tmp);
+ }
*/
- // TODO: try combining MINION_SYS_INT_STA and MINION_SYS_INT_CLR
- // in one ioctl()
-
- // Clear all the interrupt bits we got
- SET_HEAD_WRITE(head, MINION_SYS_INT_CLR);
- head->data[0] = rbuf[wsiz - rsiz];
- head->data[1] = 0x00;
- head->data[2] = 0x00;
- head->data[3] = 0x00;
- reply = do_ioctl(wbuf, wsiz, rbuf, 0);
- if (reply != (int)wsiz) {
- applog(LOG_ERR, "%s: chip %d int clear returned %d (should be %d)",
- minioncgpu->drv->dname, chip, reply, (int)wsiz);
+ // TODO: try combining MINION_SYS_INT_STA and
+ // MINION_SYS_INT_CLR in one ioctl()
+
+ // Clear all the interrupt bits we got
+ SET_HEAD_WRITE(head, MINION_SYS_INT_CLR);
+ head->data[0] = rbuf[wsiz - rsiz];
+ head->data[1] = 0x00;
+ head->data[2] = 0x00;
+ head->data[3] = 0x00;
+ reply = do_ioctl(wbuf, wsiz, rbuf, 0);
+ if (reply != (int)wsiz) {
+ applog(LOG_ERR, "%s: chip %d int clear returned %d"
+ " (should be %d)",
+ minioncgpu->drv->dname,
+ chip, reply, (int)wsiz);
+ }
+ }
}
+
+ // Doing this last means we can't miss an interrupt
+ if (gotres)
+ cgsem_post(&(minioninfo->scan_work));
}
}
diff --git a/usbutils.c b/usbutils.c
index aba650b..1b64184 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2586,7 +2586,7 @@ pipe_retry:
if (pipeerr)
cgpu->usbinfo.clear_fail_count++;
} while (pipeerr && ++retries < USB_RETRY_MAX);
- if (!err && ++pipe_retries < USB_RETRY_MAX)
+ if (!pipeerr && ++pipe_retries < USB_RETRY_MAX)
goto pipe_retry;
}
if ((endpoint & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)