From da3812208ea24f9438b7631374d22fc3ccee14bd Mon Sep 17 00:00:00 2001 From: Derek Huang Date: Thu, 15 Dec 2022 07:27:41 +0000 Subject: chromeos/cr50_enable_update.c: Clear EC AP_IDLE flag When AP boots up after Cr50 firmware update and reboot, AP finds that Cr50 reset is required for Cr50 to pick the new firmware so it trigger Cr50 reset and power off the system, AP expects system will power on automatically after Cr50 reset. However this is not the case for Chromebox, Chromebox EC set AP_IDLE flag when system is shutting down, when AP_IDLE flag is set in EC, the system stays at S5/G3 and wait for power button presssend. It cause an issue in factory that the operator needs to press power button to power on the DUT after Cr50 firmware update. This patch sends EC command to direct EC to clear AP_IDLE flag after AP shutdown so AP can boot up when Cr50 reset. BUG=b:261119366 BRANCH=firmware-brya-14505.B TEST=DUT boots up after Cr50 firmware update in factory test flow Change-Id: If97ffbe65f4783f17f4747a87b0bf89a2b021a3b Signed-off-by: Derek Huang Reviewed-on: https://review.coreboot.org/c/coreboot/+/70773 Reviewed-by: Subrata Banik Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) --- src/vendorcode/google/chromeos/cr50_enable_update.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/vendorcode/google/chromeos') diff --git a/src/vendorcode/google/chromeos/cr50_enable_update.c b/src/vendorcode/google/chromeos/cr50_enable_update.c index 6beea913ca..19f200605e 100644 --- a/src/vendorcode/google/chromeos/cr50_enable_update.c +++ b/src/vendorcode/google/chromeos/cr50_enable_update.c @@ -68,6 +68,19 @@ static int cr50_is_reset_needed(void) return 0; } +static void clear_ec_ap_idle(void) +{ + if (!CONFIG(CR50_RESET_CLEAR_EC_AP_IDLE_FLAG)) + return; + + /* Send EC command to clear AP_IDLE flag */ + if (!google_chromeec_reboot(EC_REBOOT_NO_OP, EC_REBOOT_FLAG_CLEAR_AP_IDLE | + EC_REBOOT_FLAG_ON_AP_SHUTDOWN)) + printk(BIOS_INFO, "Successfully clear AP_IDLE flag"); + else + printk(BIOS_ERR, "Failed to clear EC AP_IDLE flag"); +} + static void enable_update(void *unused) { int ret; @@ -156,8 +169,10 @@ static void enable_update(void *unused) } } - if (CONFIG(POWER_OFF_ON_CR50_UPDATE)) + if (CONFIG(POWER_OFF_ON_CR50_UPDATE)) { + clear_ec_ap_idle(); poweroff(); + } halt(); } BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_ENTRY, enable_update, NULL); -- cgit v1.2.3