diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-09-18 18:50:24 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-29 17:42:53 -0700 |
commit | 32549559c05867c9d7f99eb17f51a28e9419b799 (patch) | |
tree | 4f313932ff8f3c1aa116a081040e0bce6d601b8f | |
parent | 579605f0afc030ea5c0af85daa8fc5a725d301d8 (diff) | |
download | chrome-ec-32549559c05867c9d7f99eb17f51a28e9419b799.tar.gz |
Fizz: Initialize PMIC after AP power is ready
On proto3, PMIC isn't powered on POR, thus board_pmic_init fails.
With this change, EC waits until AP power is ready before it
notifies HOOK_CHIPSET_PRE_INIT where PMIC will be initialized.
When AP power is ready, PMIC should be ready as well.
BUG=b:65839247,b:64944394
BRANCH=none
TEST=Run reboot [/cold/ap-off] command on BJ and Type-C.
Change-Id: I7e7e07b5acf92167584966ded0a5f14fb6b04f0b
Reviewed-on: https://chromium-review.googlesource.com/672152
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/fizz/board.c | 12 | ||||
-rw-r--r-- | power/intel_x86.c | 20 |
2 files changed, 18 insertions, 14 deletions
diff --git a/board/fizz/board.c b/board/fizz/board.c index eb44a25845..185140bc59 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -232,9 +232,9 @@ static void board_pmic_init(void) { int err; int error_count = 0; + static uint8_t pmic_initialized = 0; - /* No need to re-init PMIC since settings are sticky across sysjump */ - if (system_jumped_to_this_image()) + if (pmic_initialized) return; /* Read vendor ID */ @@ -349,12 +349,18 @@ static void board_pmic_init(void) goto pmic_error; CPRINTS("PMIC init done"); + pmic_initialized = 1; return; pmic_error: CPRINTS("PMIC init failed"); } -DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_INIT_I2C + 1); + +static void chipset_pre_init(void) +{ + board_pmic_init(); +} +DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, chipset_pre_init, HOOK_PRIO_DEFAULT); /** * Notify the AC presence GPIO to the PCH. diff --git a/power/intel_x86.c b/power/intel_x86.c index ea0a8dc6c6..6c182344c4 100644 --- a/power/intel_x86.c +++ b/power/intel_x86.c @@ -277,14 +277,6 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) } #endif - /* Call hooks to initialize PMIC */ - hook_notify(HOOK_CHIPSET_PRE_INIT); - - if (power_wait_signals(CHIPSET_G3S5_POWERUP_SIGNAL)) { - chipset_force_shutdown(); - return POWER_G3; - } - #ifdef CONFIG_VBOOT_EFS /* * We have to test power readiness here (instead of S5->S3) @@ -292,11 +284,17 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) * which causes (short-powered) system to brown out. */ while (!system_can_boot_ap()) - /* LED blinks as HOOK_TICK events trigger. - * We can print percent & power as they - * improve. */ msleep(200); #endif + + /* Call hooks to initialize PMIC */ + hook_notify(HOOK_CHIPSET_PRE_INIT); + + if (power_wait_signals(CHIPSET_G3S5_POWERUP_SIGNAL)) { + chipset_force_shutdown(); + return POWER_G3; + } + power_s5_up = 1; return POWER_S5; |