From d57a4e0c2769da1612b61cae91e44391bdefbaba Mon Sep 17 00:00:00 2001 From: Xiangfu Date: Mon, 8 Apr 2013 23:37:04 +0800 Subject: [PATCH 1/3] if hash_count == 0; reinit avalon, fix the 0MHS bug use the max value of temp1 and temp2 for fan control --- driver-avalon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/driver-avalon.c b/driver-avalon.c index 1ae03588..b4932e60 100644 --- a/driver-avalon.c +++ b/driver-avalon.c @@ -744,7 +744,7 @@ static inline void record_temp_fan(struct avalon_info *info, struct avalon_resul info->temp2 = 0 - ((~ar->temp2 & 0x7f) + 1); } - *temp_avg = info->temp2; + *temp_avg = info->temp2 > info->temp1 ? info->temp2 : info->temp1; if (info->temp0 > info->temp_max) info->temp_max = info->temp0; @@ -929,7 +929,7 @@ static int64_t avalon_scanhash(struct thr_info *thr) elapsed.tv_sec, elapsed.tv_usec); } } - if (result_wrong >= avalon_get_work_count) { + if (result_wrong >= avalon_get_work_count || hash_count == 0) { /* This means FPGA controller gave all wrong results, so * try to reset the Avalon */ do_avalon_close(thr); From f68930138d360fc3cd78ec71f332d72ae6bf015a Mon Sep 17 00:00:00 2001 From: Xiangfu Date: Mon, 8 Apr 2013 23:39:08 +0800 Subject: [PATCH 2/3] for some reason network down. one simple cgminer command: "cgminer -o 127.0.0.1:8888 -O fa:ke --avalon-options 115200:32:10:50:256" can idle the avalon for safe power and protect chip --- driver-avalon.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/driver-avalon.c b/driver-avalon.c index b4932e60..29662e4c 100644 --- a/driver-avalon.c +++ b/driver-avalon.c @@ -586,8 +586,8 @@ static bool avalon_detect_one(const char *devpath) } avalon_infos = realloc(avalon_infos, - sizeof(struct avalon_info *) * - (total_devices + 1)); + sizeof(struct avalon_info *) * + (total_devices + 1)); applog(LOG_INFO, "Avalon Detect: Found at %s, mark as %d", devpath, avalon->device_id); @@ -618,14 +618,11 @@ static bool avalon_detect_one(const char *devpath) info->temp_old = 0; info->frequency = frequency; - /* Do something for failed reset ? */ - if (0) { - /* Set asic to idle mode after detect */ - avalon_idle(avalon); - avalon->device_fd = -1; + /* Set asic to idle mode after detect */ + avalon_idle(avalon); + avalon->device_fd = -1; - avalon_close(fd); - } + avalon_close(fd); return true; } From dd1c8bd19890dd000177f9b3b7af592fbc3fe2c5 Mon Sep 17 00:00:00 2001 From: Xiangfu Date: Mon, 8 Apr 2013 23:55:09 +0800 Subject: [PATCH 3/3] fix the fan control on max temp2/3 --- driver-avalon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver-avalon.c b/driver-avalon.c index 29662e4c..b1d3fb3b 100644 --- a/driver-avalon.c +++ b/driver-avalon.c @@ -947,7 +947,7 @@ static int64_t avalon_scanhash(struct thr_info *thr) info->fan0, info->fan1, info->fan2, info->temp0, info->temp1, info->temp2, info->temp_max); info->temp_history_index++; - info->temp_sum += info->temp2; + info->temp_sum += avalon->temp; applog(LOG_DEBUG, "Avalon: temp_index: %d, temp_count: %d, temp_old: %d", info->temp_history_index, info->temp_history_count, info->temp_old); if (info->temp_history_index == info->temp_history_count) {