Commit e57d7825869d35e5caf2e6a6e7f8feebab9eff12

jaketri 2014-06-10T15:35:02

Hashfast hack to add per die voltage and clock offset (part2) - enable code only for devices with 4 dies

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;