summaryrefslogtreecommitdiff
path: root/src/ec/google/chromeec/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ec/google/chromeec/ec.c')
-rw-r--r--src/ec/google/chromeec/ec.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index c57e18bbca..6e7ecdfb36 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -100,8 +100,7 @@ u32 google_chromeec_get_events_b(void)
}
#ifndef __SMM__
-/* Check for recovery mode and ensure EC is in RO */
-void google_chromeec_early_init(void)
+void google_chromeec_check_ec_image(int expected_type)
{
struct chromeec_command cec_cmd;
struct ec_response_get_version cec_resp = {{0}};
@@ -113,9 +112,7 @@ void google_chromeec_early_init(void)
cec_cmd.cmd_size_out = sizeof(cec_resp);
google_chromeec_command(&cec_cmd);
- if (cec_cmd.cmd_code ||
- (recovery_mode_enabled() &&
- (cec_resp.current_image != EC_IMAGE_RO))) {
+ if (cec_cmd.cmd_code || cec_resp.current_image != expected_type) {
struct ec_params_reboot_ec reboot_ec;
/* Reboot the EC and make it come back in RO mode */
reboot_ec.cmd = EC_REBOOT_COLD;
@@ -133,6 +130,15 @@ void google_chromeec_early_init(void)
}
}
+/* Check for recovery mode and ensure EC is in RO */
+void google_chromeec_early_init(void)
+{
+ /* If in recovery ensure EC is running RO firmware. */
+ if (recovery_mode_enabled()) {
+ google_chromeec_check_ec_image(EC_IMAGE_RO);
+ }
+}
+
u16 google_chromeec_get_board_version(void)
{
struct chromeec_command cmd;