minion - make the SPI reset ms sleep a parameter and API settable
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
diff --git a/API-README b/API-README
index 0bbab5c..c510797 100644
--- a/API-README
+++ b/API-README
@@ -446,6 +446,7 @@ The list of requests - a (*) means it requires privileged access - and replies:
MBA opt=freq val=0-chip:100-1400 - set chip freq
MBA opt=ledcount val=0-100 - chip count for led
MBA opt=ledlimit val=0-200 - led off below GHs
+ MBA opt=spireset val=0-9999 - SPI reset sleep ms
lcd LCD An all-in-one short status summary of the miner
e.g. Elapsed,GHS av,GHS 5m,GHS 5s,Temp,
diff --git a/ASIC-README b/ASIC-README
index 553f345..938ed74 100644
--- a/ASIC-README
+++ b/ASIC-README
@@ -248,6 +248,7 @@ ASIC SPECIFIC COMMANDS
--minion-idlecount Report when IdleCount is >0 or changes
--minion-noautofreq Disable automatic frequency adjustment
--minion-overheat Enable directly halting any chip when the status exceeds 100C
+--minion-spireset Sleep time in milliseconds when doing an SPI reset (default: 200)
--minion-temp <arg> Set minion chip temperature threshold, single value or comma list, range 120-160 (default: 135C)
--nfu-bits <arg> Set nanofury bits for overclocking, range 32-63 (default: 50)
--rock-freq <arg> Set RockMiner frequency in MHz, range 125-500 (default: 270)
diff --git a/README b/README
index 9b14346..9b705a0 100644
--- a/README
+++ b/README
@@ -225,6 +225,7 @@ Options for both config file and command line:
--minion-ledlimit Turn off led when chips GHs are below this (default: 90)
--minion-noautofreq Disable automatic frequency adjustment
--minion-overheat Enable directly halting any chip when the status exceeds 100C
+--minion-spireset Sleep time in milliseconds when doing an SPI reset (default: 200)
--minion-temp <arg> Set minion chip temperature threshold, single value or comma list, range 120-160 (default: 135C)
--monitor|-m <arg> Use custom pipe cmd for output messages
--nfu-bits <arg> Set nanofury bits for overclocking, range 32-63 (default: 50)
diff --git a/cgminer.c b/cgminer.c
index ddf0605..1238b95 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -254,6 +254,7 @@ int opt_minion_ledcount;
int opt_minion_ledlimit = 90;
bool opt_minion_noautofreq;
bool opt_minion_overheat;
+int opt_minion_spireset = 200;
char *opt_minion_temp;
#endif
@@ -1372,6 +1373,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITHOUT_ARG("--minion-overheat",
opt_set_bool, &opt_minion_overheat,
"Enable directly halting any chip when the status exceeds 100C"),
+ OPT_WITH_ARG("--minion-spireset",
+ set_int_0_to_9999, opt_show_intval, &opt_minion_spireset,
+ "Sleep time in milliseconds when doing an SPI reset (default: 200)"),
OPT_WITH_ARG("--minion-temp",
opt_set_charp, NULL, &opt_minion_temp,
"Set minion chip temperature threshold, single value or comma list, range 120-160 (default: 135C)"),
diff --git a/driver-minion.c b/driver-minion.c
index 2ec6a49..48f3d2d 100644
--- a/driver-minion.c
+++ b/driver-minion.c
@@ -1757,7 +1757,7 @@ static bool minion_init_spi(struct cgpu_info *minioncgpu, struct minion_info *mi
if (reset) {
// TODO: maybe slow it down?
close(minioninfo->spifd);
- cgsleep_ms(100);
+ cgsleep_ms(opt_minion_spireset);
minioninfo->spifd = open(minioncgpu->device_path, O_RDWR);
if (minioninfo->spifd < 0)
goto bad_out;
@@ -2303,7 +2303,8 @@ static char *minion_set(struct cgpu_info *minioncgpu, char *option, char *settin
if (strcasecmp(option, "help") == 0) {
sprintf(replybuf, "reset: chip 0-%d freq: 0-%d:%d-%d "
- "ledcount: 0-100 ledlimit: 0-200",
+ "ledcount: 0-100 ledlimit: 0-200 "
+ "spireset: 0-9999",
minioninfo->chips - 1,
minioninfo->chips - 1,
MINION_FREQ_MIN, MINION_FREQ_MAX);
@@ -2415,6 +2416,23 @@ static char *minion_set(struct cgpu_info *minioncgpu, char *option, char *settin
return NULL;
}
+ if (strcasecmp(option, "spireset") == 0) {
+ if (!setting || !*setting) {
+ sprintf(replybuf, "missing spireset value");
+ return replybuf;
+ }
+
+ val = atoi(setting);
+ if (val < 0 || val > 9999) {
+ sprintf(replybuf, "invalid spireset: ms '%s' valid range 0-9999",
+ setting);
+ return replybuf;
+ }
+
+ opt_minion_spireset = val;
+ return NULL;
+ }
+
sprintf(replybuf, "Unknown option: %s", option);
return replybuf;
}
diff --git a/miner.h b/miner.h
index a26f35a..3e6f08a 100644
--- a/miner.h
+++ b/miner.h
@@ -1028,6 +1028,7 @@ extern int opt_minion_ledcount;
extern int opt_minion_ledlimit;
extern bool opt_minion_noautofreq;
extern bool opt_minion_overheat;
+extern int opt_minion_spireset;
extern char *opt_minion_temp;
#endif
#ifdef USE_USBUTILS