From 6c133a84ef4a32c35577a266905e02af8c2d9278 Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Mon, 5 Aug 2013 21:04:16 -0700 Subject: [PATCH] pit: setup voltage rails before system clocks This moves the call to setup_power() before system_clock_init(). This causes the PMIC to set up the voltage rails earlier so that the CPU clock can be set up at a faster rate (in the follow-up patch). After system clock init, we re-initialize the PMIC's I2C bus since the input clock rate will have changed. BUG=none BRANCH=none TEST=built and booted on Pit Change-Id: Ieb828ac25daad7ee95bfa4823aaaf161028c9c92 Reviewed-on: https://gerrit.chromium.org/gerrit/64744 Reviewed-by: Gabe Black Reviewed-by: Ronald G. Minnich Tested-by: David Hendricks Commit-Queue: David Hendricks --- src/mainboard/google/pit/romstage.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/pit/romstage.c b/src/mainboard/google/pit/romstage.c index 495110eec5..f29ca348ce 100644 --- a/src/mainboard/google/pit/romstage.c +++ b/src/mainboard/google/pit/romstage.c @@ -43,6 +43,8 @@ #define MMC0_GPIO_PIN (58) +#define PMIC_I2C_BUS 4 + struct pmic_write { int or_orig; // Whether to or in the original value. @@ -89,7 +91,7 @@ static void setup_power(int is_resume) /* Initialize I2C bus to configure PMIC. */ exynos_pinmux_i2c4(); - i2c_init(4, 1000000, 0x00); /* 1MHz */ + i2c_init(PMIC_I2C_BUS, 1000000, 0x00); /* 1MHz */ printk(BIOS_DEBUG, "%s: Setting up PMIC...\n", __func__); @@ -255,13 +257,17 @@ void main(void) start_romstage_time = timestamp_get(); #endif + setup_power(is_resume); + /* Clock must be initialized before console_init, otherwise you may need * to re-initialize serial console drivers again. */ system_clock_init(); console_init(); - setup_power(is_resume); + /* re-initialize PMIC I2C channel after (re-)setting system clocks */ + i2c_init(PMIC_I2C_BUS, 1000000, 0x00); /* 1MHz */ + #if CONFIG_COLLECT_TIMESTAMPS before_dram_time = timestamp_get(); #endif