summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2016-09-06 13:51:03 -0700
committerPatrick Georgi <pgeorgi@google.com>2016-10-04 21:16:34 +0200
commit1eb69b4a64b0bd96aa57b0e793667dd36d10ff17 (patch)
tree4bab7628a057b4f13bf9d2c6bb73d49a8b52d99a
parenta02e4a0428b943a7a92036c03e374e1ca8a27446 (diff)
downloadcoreboot-1eb69b4a64b0bd96aa57b0e793667dd36d10ff17.tar.xz
google/gru: Init the PWM pinmux after setting up the PWM
If we setup the PWM _after_ the pinmux then there's a period of time when we're driving the PWM incorrectly. Let's setup the regulator and _then_ configure the pinmux. This fixes no known bugs, but it is more correct and probably makes the signals look better at bootup. BRANCH=None BUG=None TEST=scope Change-Id: I311c0eded873b65e0489373e87b88bcdd8e4b806 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: fcf4d0ba29d82cce779c0b25ead36de4a95d97a1 Original-Change-Id: I5124f48d04a18c07bbd2d54bc08ee001c9c7e8d1 Original-Signed-off-by: Douglas Anderson <dianders@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/381592 Original-Reviewed-by: Simon Glass <sjg@google.com> Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/16700 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r--src/mainboard/google/gru/pwm_regulator.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/mainboard/google/gru/pwm_regulator.c b/src/mainboard/google/gru/pwm_regulator.c
index d0cdf43682..d6d2eecfb9 100644
--- a/src/mainboard/google/gru/pwm_regulator.c
+++ b/src/mainboard/google/gru/pwm_regulator.c
@@ -44,21 +44,6 @@ 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 */
- switch (pwm) {
- case PWM_REGULATOR_GPU:
- write32(&rk3399_grf->iomux_pwm_0, IOMUX_PWM_0);
- break;
- case PWM_REGULATOR_BIG:
- write32(&rk3399_grf->iomux_pwm_1, IOMUX_PWM_1);
- break;
- case PWM_REGULATOR_LIT:
- write32(&rk3399_pmugrf->iomux_pwm_2, IOMUX_PWM_2);
- break;
- case PWM_REGULATOR_CENTERLOG:
- write32(&rk3399_pmugrf->iomux_pwm_3a, IOMUX_PWM_3_A);
- break;
- }
-
voltage_min = PWM_DESIGN_VOLTAGE_MIN;
voltage_max = PWM_DESIGN_VOLTAGE_MAX;
if (!(IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN) && board_id() < 6) &&
@@ -80,4 +65,19 @@ void pwm_regulator_configure(enum pwm_regulator pwm, int millivolt)
/ (voltage_max - voltage_min);
pwm_init(pwm, PWM_PERIOD, duty_ns);
+
+ switch (pwm) {
+ case PWM_REGULATOR_GPU:
+ write32(&rk3399_grf->iomux_pwm_0, IOMUX_PWM_0);
+ break;
+ case PWM_REGULATOR_BIG:
+ write32(&rk3399_grf->iomux_pwm_1, IOMUX_PWM_1);
+ break;
+ case PWM_REGULATOR_LIT:
+ write32(&rk3399_pmugrf->iomux_pwm_2, IOMUX_PWM_2);
+ break;
+ case PWM_REGULATOR_CENTERLOG:
+ write32(&rk3399_pmugrf->iomux_pwm_3a, IOMUX_PWM_3_A);
+ break;
+ }
}