diff options
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/google/chromeec/ec.c | 33 | ||||
-rw-r--r-- | src/ec/google/chromeec/ec.h | 1 |
2 files changed, 12 insertions, 22 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 1a381d716e..c8b6e7e10a 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -16,7 +16,6 @@ #include <stdint.h> #include <string.h> #include <console/console.h> -#include <bootmode.h> #include <arch/io.h> #include <delay.h> #include <halt.h> @@ -24,6 +23,7 @@ #include <elog.h> #include <rtc.h> #include <stdlib.h> +#include <vboot/vboot_common.h> #include "chip.h" #include "ec.h" @@ -198,18 +198,18 @@ void google_chromeec_check_ec_image(int expected_type) } } -/* Check for recovery mode and ensure EC is in RO */ +/* Check for recovery mode and ensure PD/EC is in RO */ void google_chromeec_early_init(void) { - if (IS_ENABLED(CONFIG_CHROMEOS)) { - /* Check USB PD chip state first */ - if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_PD)) - google_chromeec_early_pd_init(); - - /* If in recovery ensure EC is running RO firmware. */ - if (recovery_mode_enabled()) - google_chromeec_check_ec_image(EC_IMAGE_RO); - } + if (!IS_ENABLED(CONFIG_CHROMEOS) || !vboot_recovery_mode_enabled()) + return; + + /* Check USB PD chip state first */ + if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_PD)) + google_chromeec_check_pd_image(EC_IMAGE_RO); + + /* If in recovery ensure EC is running RO firmware. */ + google_chromeec_check_ec_image(EC_IMAGE_RO); } void google_chromeec_check_pd_image(int expected_type) @@ -241,15 +241,6 @@ void google_chromeec_check_pd_image(int expected_type) udelay(1000); } } - -/* Check for recovery mode and ensure PD is in RO */ -void google_chromeec_early_pd_init(void) -{ - /* If in recovery ensure PD is running RO firmware. */ - if (recovery_mode_enabled()) { - google_chromeec_check_pd_image(EC_IMAGE_RO); - } -} #endif u16 google_chromeec_get_board_version(void) @@ -521,7 +512,7 @@ void google_chromeec_init(void) } if (cec_cmd.cmd_code || - (recovery_mode_enabled() && + (vboot_recovery_mode_enabled() && (cec_resp.current_image != EC_IMAGE_RO))) { struct ec_params_reboot_ec reboot_ec; /* Reboot the EC and make it come back in RO mode */ diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index d3e6d78e4d..f765fe46ba 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -36,7 +36,6 @@ void google_chromeec_init(void); /* If recovery mode is enabled and EC is not running RO firmware reboot. */ void google_chromeec_early_init(void); -void google_chromeec_early_pd_init(void); /* Reboot if EC firmware is not expected type. */ void google_chromeec_check_ec_image(int expected_type); void google_chromeec_check_pd_image(int expected_type); |