Hashfast hack to add per die voltage and clock offset (part2) - enable code only for devices with 4 dies
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
diff --git a/driver-hashfast.c b/driver-hashfast.c
index b15a3ee..80c794e 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -707,7 +707,11 @@ static void hfa_set_clock(struct cgpu_info *hashfast, struct hashfast_info *info
* usb_init_base message so we have to assume it's what we asked. */
info->base_clock = info->hash_clock_rate;
for (i = 0; i < info->asic_count; i++)
- info->die_data[i].hash_clock = info->base_clock + info->hash_clock_offset[i];
+ {
+ info->die_data[i].hash_clock = info->base_clock;
+ if (info->asic_count == 4)
+ info->die_data[i].hash_clock += info->hash_clock_offset[i];
+ }
}
/* Look for an op name match and apply any options to its first attempted
@@ -1400,7 +1404,11 @@ static bool hfa_init(struct thr_info *thr)
if (unlikely(!(info->die_data)))
quit(1, "Failed to calloc die_data");
for (i = 0; i < info->asic_count; i++)
- info->die_data[i].hash_clock = info->base_clock + info->hash_clock_offset[i];
+ {
+ info->die_data[i].hash_clock = info->base_clock;
+ if (info->asic_count == 4)
+ info->die_data[i].hash_clock += info->hash_clock_offset[i];
+ }
// The per-die statistics array
info->die_statistics = calloc(info->asic_count, sizeof(struct hf_long_statistics));
@@ -1444,7 +1452,8 @@ static bool hfa_init(struct thr_info *thr)
}
}
- for (i = 0; i < info->asic_count; i++)
+ if (info->asic_count == 4)
+ for (i = 0; i < info->asic_count; i++)
if (info->hash_clock_offset[i] != 0)
{
uint16_t hdata;