google/gru: Fix up PWM regulator ranges

We did yet another small adjustment to the PWM regulator ranges for
Kevin rev6... this patch reflects that in code. Also rewrite code and
descriptions to indicate that these new ranges are not just for Kevin,
but also planned to be used on Gru rev2 and any future Gru derivatives
(which as I understand it is the plan, right?).

BRANCH=None
BUG=chrome-os-partner:54888
TEST=Booted my rev5, for whatever that's worth...

Change-Id: Id78501453814d0257ee86a05f6dbd6118b719309
Signed-off-by: Martin Roth <martinroth@chromium.org>
Original-Commit-Id: 4e8be3f09ac16c1c9782dee634e5704e0bd6c7f9
Original-Change-Id: I723dc09b9711c7c6d2b3402d012198438309a8ff
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/379921
Original-Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://review.coreboot.org/16580
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/src/mainboard/google/gru/pwm_regulator.c b/src/mainboard/google/gru/pwm_regulator.c
index f382b2b..d0cdf43 100644
--- a/src/mainboard/google/gru/pwm_regulator.c
+++ b/src/mainboard/google/gru/pwm_regulator.c
@@ -31,12 +31,12 @@
 #define PWM_DESIGN_VOLTAGE_MIN	8000
 #define PWM_DESIGN_VOLTAGE_MAX	15000
 
-/* The min & max design voltages are different after kevin-r6 */
-int kevin_voltage_min_max_r6[][2] = {
-	[PWM_REGULATOR_GPU] = {7910, 12139},
-	[PWM_REGULATOR_BIG] = {7986, 13057},
-	[PWM_REGULATOR_LIT] = {7997, 13002},
-	[PWM_REGULATOR_CENTERLOG] = {7996, 10507}
+/* Later boards (Kevin rev6+, Gru rev2+) use different regulator ranges. */
+int pwm_design_voltage_later[][2] = {
+	[PWM_REGULATOR_GPU] = {7858, 12177},
+	[PWM_REGULATOR_BIG] = {7987, 13022},
+	[PWM_REGULATOR_LIT] = {7991, 13037},
+	[PWM_REGULATOR_CENTERLOG] = {8001, 10497}
 };
 
 void pwm_regulator_configure(enum pwm_regulator pwm, int millivolt)
@@ -61,9 +61,10 @@
 
 	voltage_min = PWM_DESIGN_VOLTAGE_MIN;
 	voltage_max = PWM_DESIGN_VOLTAGE_MAX;
-	if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN) && board_id() >= 6) {
-		voltage_min = kevin_voltage_min_max_r6[pwm][0];
-		voltage_max = kevin_voltage_min_max_r6[pwm][1];
+	if (!(IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN) && board_id() < 6) &&
+	    !(IS_ENABLED(CONFIG_BOARD_GOOGLE_GRU) && board_id() < 2)) {
+		voltage_min = pwm_design_voltage_later[pwm][0];
+		voltage_max = pwm_design_voltage_later[pwm][1];
 	}
 
 	assert(voltage <= voltage_max && voltage >= voltage_min);