Commit c64d95f267e8296592160d1b1ea80464252f6bb6

Con Kolivas 2013-06-21T21:59:44

Support new overclocking speeds for avalon: 325, 350 and 375

diff --git a/ASIC-README b/ASIC-README
index 6d10d9c..de349a6 100644
--- a/ASIC-README
+++ b/ASIC-README
@@ -103,7 +103,10 @@ It is possible to set this a little lower if you are trying to tune for short
 block mining (eg p2pool) but much lower and the device will start creating
 duplicate shares.
 
-Sample settings for different frequencies (last 2 values):
+Sample settings for valid different frequencies (last 2 values):
+34:375
+36:350
+39:325
 43:300
 45:282 (default)
 47:270
@@ -111,14 +114,14 @@ Sample settings for different frequencies (last 2 values):
 
 Frequency:
 This is the clock speed of the devices. Only specific values work, 256, 270,
-282 (default) and 300.
+282 (default), 300, 325, 350 and 375.
 
 If you use the full curses based interface with Avalons you will get this
 information:
-AVA 0: 22/ 46C  60%/2400R
+AVA 0: 22/ 46C  2400R
 
 The values are:
-ambient temp / highest device temp  set fan % / lowest detected fan RPM.
+ambient temp / highest device temp  lowest detected ASIC cooling fan RPM.
 
 Use the API for more detailed information than this.
 
diff --git a/driver-avalon.c b/driver-avalon.c
index 1e14732..7d0e483 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -96,18 +96,36 @@ static int avalon_init_task(struct avalon_task *at,
 	buf[9] = 0x01;
 	buf[10] = 0x00;
 	buf[11] = 0x00;
-	if (frequency == 256) {
-		buf[6] = 0x03;
-		buf[7] = 0x08;
-	} else if (frequency == 270) {
-		buf[6] = 0x73;
-		buf[7] = 0x08;
-	} else if (frequency == 282) {
-		buf[6] = 0xd3;
-		buf[7] = 0x08;
-	} else if (frequency == 300) {
-		buf[6] = 0x63;
-		buf[7] = 0x09;
+	switch (frequency) {
+		case 256:
+			buf[6] = 0x03;
+			buf[7] = 0x08;
+			break;
+		default:
+		case 270:
+			buf[6] = 0x73;
+			buf[7] = 0x08;
+			break;
+		case 282:
+			buf[6] = 0xd3;
+			buf[7] = 0x08;
+			break;
+		case 300:
+			buf[6] = 0x63;
+			buf[7] = 0x09;
+			break;
+		case 325:
+			buf[6] = 0x28;
+			buf[7] = 0x0a;
+			break;
+		case 350:
+			buf[6] = 0xf0;
+			buf[7] = 0x0a;
+			break;
+		case 375:
+			buf[6] = 0xb8;
+			buf[7] = 0x0b;
+			break;
 	}
 
 	return 0;
@@ -447,11 +465,14 @@ static bool get_options(int this_option_offset, int *baud, int *miner_count,
 					case 270:
 					case 282:
 					case 300:
+					case 325:
+					case 350:
+					case 375:
 						*frequency = tmp;
 						break;
 					default:
 						quit(1, "Invalid avalon-options for "
-							"frequency must be 256/270/282/300");
+							"frequency must be 256/270/282/300/325/350/375");
 					}
 				}
 			}