google/gru: update the pwm regulator

As David commented the "Bob and other follow-ons match Gru, Kevin should
be the special case here", and update the calculations value for gru/bob
board.

From the actual tests, some regulator voltage than the actual set of less
than 20mv on bob board. (e.g: little-cpus and Center-logic) Update the
{min, max} regulator voltage for Bob board. Make sure we get the accurate
voltage.

BUG=chrome-os-partner:61497
BRANCH=none
TEST=boot up Bob, measure the voltage for little cpu and C-logic.

Change-Id: Iad881b41d67708776bfb681487cf8cec8518064e
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 25e133815f49018e7496c75077b8559c207350a4
Original-Change-Id: I3098c742c7ec355c88f45bd1d93f878a7976a6b4
Original-Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Original-Signed-off-by: Shasha Zhao <Sarah_Zhao@asus.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/424523
Original-Reviewed-by: David Schneider <dnschneid@chromium.org>
Original-Reviewed-by: Brian Norris <briannorris@chromium.org>
Original-Signed-off-by: Shasha Zhao <Sarah_Zhao@asus.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/430403
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/18460
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
diff --git a/src/mainboard/google/gru/pwm_regulator.c b/src/mainboard/google/gru/pwm_regulator.c
index a81480a..426b989 100644
--- a/src/mainboard/google/gru/pwm_regulator.c
+++ b/src/mainboard/google/gru/pwm_regulator.c
@@ -28,29 +28,39 @@
  * board design / resistors / capacitors / regulators but due to
  * clock dividers we actually get 3337.
  */
-#define PWM_PERIOD		3337
-#define PWM_DESIGN_VOLTAGE_MIN	8000
-#define PWM_DESIGN_VOLTAGE_MAX	15000
+#define PWM_PERIOD			3337
+#define PWM_DESIGN_VOLTAGE_MIN_OUTDATED	8000
+#define PWM_DESIGN_VOLTAGE_MAX_OUTDATED	15000
 
 /* Later boards (Kevin rev6+, Gru rev2+) use different regulator ranges. */
-int pwm_design_voltage_later[][2] = {
+int kevin6_pwm_design_voltage[][2] = {
 	[PWM_REGULATOR_GPU] = {7858, 12177},
 	[PWM_REGULATOR_BIG] = {7987, 13022},
 	[PWM_REGULATOR_LIT] = {7991, 13037},
 	[PWM_REGULATOR_CENTERLOG] = {8001, 10497}
 };
 
+int pwm_design_voltage[][2] = {
+	[PWM_REGULATOR_GPU] = {7864, 12177},
+	[PWM_REGULATOR_BIG] = {8001, 13022},
+	[PWM_REGULATOR_LIT] = {7977, 13078},
+	[PWM_REGULATOR_CENTERLOG] = {7994, 10499}
+};
+
 void pwm_regulator_configure(enum pwm_regulator pwm, int millivolt)
 {
 	int duty_ns, voltage_max, voltage_min;
 	int voltage = millivolt * 10; /* for higer calculation accuracy */
 
-	voltage_min = PWM_DESIGN_VOLTAGE_MIN;
-	voltage_max = PWM_DESIGN_VOLTAGE_MAX;
-	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];
+	voltage_min = pwm_design_voltage[pwm][0];
+	voltage_max = pwm_design_voltage[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_MIN_OUTDATED;
+		voltage_max = PWM_DESIGN_VOLTAGE_MAX_OUTDATED;
+	} else if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN) && board_id() >= 6){
+		voltage_min = kevin6_pwm_design_voltage[pwm][0];
+		voltage_max = kevin6_pwm_design_voltage[pwm][1];
 	}
 
 	assert(voltage <= voltage_max && voltage >= voltage_min);